Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7944 Discussions

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

AndrewC
New Contributor III
1,144 Views
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
1,144 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

0 Kudos
Sukruth_H_Intel
Employee
1,144 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

0 Kudos
TimP
Honored Contributor III
1,144 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.
0 Kudos
Reply