Community
cancel
Showing results for 
Search instead for 
Did you mean: 
AndrewC
New Contributor I
375 Views

gcc equivalent of icc "-align" (Linux x86-64)

My understanding is that gcc by default aligns on 4 byte boundaries. The intel option "-align" aligns on "natural" boundaries. which I assume as long as you stay away from long double ( 16 bytes) is aligning on 8.

Is there a gcc 4 switch equivalent? I am only concerned about 64-bit code generation.
0 Kudos
3 Replies
SergeyKostrov
Valued Contributor II
375 Views

Quoting vasci_intel
...Is there a gcc 4 switch equivalent? I am only concerned about 64-bit code generation.


GCC haslots of align-relatedoptions ( switches ):

gcc -v --help > gcc_options.txt

or

g++ -v --help > gpp_options.txt

Best regards,
Sergey

Sukruth_H_Intel
Employee
375 Views

Hi,
You can also use the "-Zp" options which is used to specify the alignmentfor structures on byte boundaries.

n-->Is the byte size boundary. Possible values are 1, 2, 4, 8, or 16. (Default:16).
Hope this helps you.

Thanks,
Sukruth H.V

TimP
Black Belt
375 Views

gcc on linux x86_64 normally follows its ABI dictates fairly well, with objects of size 16 bytes or more given 16-byte alignment. I think there were a few early versions which might have set 8-byte alignments under -Os, if so, that could be over-ridden by -mpreferred-stack-boundary=4. I doubt gcc4 would have this problem.
32-bit gcc would drop to 4-byte alignment only under -Os, although 8-byte alignment is frequent.
Admittedly, it seems difficult to look up this question, although, as Sergey said, gcc -v -help gives useful information.
Reply