GAS: Maximum alignment of variables in custom sections
Matthew Fernandez
matthew.fernandez@gmail.com
Sun Jul 26 00:06:00 GMT 2015
Hi binutils folks,
This question is about targeting ARM using GAS from an x86_64 host, so apologies if this is the wrong place for such issues.
For some reason GAS seems to limit the maximum alignment constraint of variables to 15 bits:
$ cat foo.c
char foo[1] __attribute__((aligned(1 << 16))) __attribute__((section("bar")));
$ arm-none-eabi-gcc -c foo.c
/tmp/ccR55qTB.s: Assembler messages:
/tmp/ccR55qTB.s:15: Error: alignment too large: 15 assumed
This constraint does not seem to exist in Clang:
$ clang -target arm-none-eabi -integrated-as -c foo.c
$ echo $?
0
This only appears to affect variables in custom sections, as otherwise GCC emits a .comm directive instead of .align,
which GAS does not appear to constrain. My version of GAS is "GNU assembler (2.24-2ubuntu2+4) 2.24", but this limitation
seems to be in the current tip of binutils:
// gas/config/tc-arm.c:2980 @ f0b0791b05ed335e5d74d843d828645805db1f9c
long max_alignment = 15;
My question is, why is this limit is 15 bits? I'm not aware of anything in the hardware/ELF specs that would prevent
larger alignment. The limitation seems to vary across targets and it is not clear where the value of 15 for ARM is
derived from. Please CC me directly in replies as I'm not on the list.
Thanks,
Matthew
More information about the Binutils
mailing list