Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
7679 Discussions

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

AndrewC
New Contributor II
535 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
535 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
535 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
535 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