Files
binutils-gdb/ld/testsuite/ld-aarch64/farcall-bl-section.d
Richard Earnshaw 5ad7fd27ba aarch64: Don't relax relocations to static function symbols
The aarch64 ABI states that long branch veneers may be added to
facilitate linking code that is beyond the range of a 26-bit call or
branch; but it requires that the target symbol be a function symbol.

Ensure that this latter condition is maintained by rejecting
relaxation of a static function symbol to it's section symbol.

Note that there should probably be a fix to the linker to enforce this
during link time.  I've not done this for now because that might break
some existing object code that has been built with older versions of
gas.  At some point we should revisit this.

This change also causes a small change in the LD testsuite: instead of
generating some veneers with the section name we now (correctly)
generate them using the name of the called function.
2026-01-12 10:55:55 +00:00

37 lines
785 B
Makefile

#name: aarch64-farcall-bl-section
#source: farcall-bl-section.s
#as:
#ld: -Ttext 0x1000 --section-start .foo=0x8001000
#objdump: -dr
#...
Disassembly of section .text:
.* <_start>:
1000: 94000006 bl 1018 <__bar_veneer>
1004: 94000009 bl 1028 <__bar2_veneer>
1008: d65f03c0 ret
100c: d503201f nop
1010: 1400000e b 1048 <__bar2_veneer\+0x20>
1014: d503201f nop
.* <__bar_veneer>:
1018: 90040010 adrp x16, 8001000 <bar>
101c: 91000210 add x16, x16, #0x0
1020: d61f0200 br x16
1024: 00000000 udf #0
.* <__bar2_veneer>:
1028: 90040010 adrp x16, 8001000 <bar>
102c: 91001210 add x16, x16, #0x4
1030: d61f0200 br x16
...
Disassembly of section .foo:
.* <bar>:
8001000: d65f03c0 ret
.* <bar2>:
8001004: d65f03c0 ret