bfd/elfnn-aarch64, veneer stub alignment

Pekka Seppänen pexu@kapsi.fi
Tue Feb 20 16:57:00 GMT 2018


Hi.

Is is possible to set the minimum alignment for the generated veneers? 
What currently happens with the aarch64_long_branch_stub veneer template 
is that while the template itself is just fine:

bfd/elfnn-aarch64.c: 2167
   0x58000090,     /*  ldr   ip0, 1f */
   0x10000011,     /*  adr   ip1, #0 */
   0x8b110210,     /*  add   ip0, ip0, ip1 */
   0xd61f0200,     /*  br  ip0 */
   0x00000000,     /* 1: .xword or .word
            R_AARCH64_PRELNN(X) + 12
          */
   0x00000000

should the veneer stub land on a word (i.e. 4 byte) aligned address, 
things might not go so well. This means that `ldr ip0, 1f' will no 
longer load a xword-aligned (i.e. 8 byte) local, as 1 is no longer 
xword-aligned, and that'll raise an exception if the hardware alignment 
check is enabled -- of course, there's a catch in this case, as if the 
MMU happens the be disabled (say, during bootstrapping) all accesses 
must be always aligned.

The word alignment can be also seen at 
`ld/testsuite/ld-aarch64/farcall-back.d', so that got me wondering, if 
the chosen default alignment is too narrow (and how to change that, if 
required, as with this case).


-- Pekka



More information about the Binutils mailing list