is there a way to find the maximum alignment supported by the linker?

Toby Douglass toby.douglass@minodes.com
Sun Jun 11 19:34:00 GMT 2017


Hej, all.

GCC supports an attribute "alignment".

The docs state the extent to which alignment can be modified depends
on the linker, and it can be very small.

In my code, I have two options; I can either align by double word
length (i.e. 8 or 16 bytes, depending on target) or I can align by the
size required for "atomic isolation", which is to say on Intel
cache-line length, which is up to and including 128 bytes, and on
arm/aarch64 up to and including 2048 bytes, which is the maximum
exclusive reservation granule size.

The docs state if you ask for too much alignment, the linker will fall
back to doing only the most it can do, which isn't very satisfactory,
since you have no idea if it's happening or what that value is.

Is there a way to find out the maximum alignment supported by the iinker?



More information about the Gcc-help mailing list