mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-27 04:52:05 +08:00
d68f19767d
For some pc-relative relocations we want to allow them under PIC mode while a normal global symbol defined in the same dynamic object can still bind externally through copy relocation. So, we should not allow pc-relative relocation against such symbol. SYMBOL_REFERENCES_LOCAL should be used and is more accurate than the original individual checks. bfd/ * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Use SYMBOL_REFERENCES_LOCAL. ld/ * testsuite/ld-aarch64/aarch64-elf.exp: Update test name * testsuite/ld-aarch64/pcrel.s: Add new testcases. * testsuite/ld-aarch64/pcrel_pic_undefined.d: Update the expected warnings. * testsuite/ld-aarch64/pcrel_pic_defined_local.d: Rename ... * testsuite/ld-aarch64/pcrel_pic_defined.d: ... to this. Update expected warnings.
27 lines
585 B
ArmAsm
27 lines
585 B
ArmAsm
.hidden global_b
|
|
.text
|
|
.align 2
|
|
main:
|
|
# R_AARCH64_ADR_PREL_PG_HI21
|
|
# R_AARCH64_ADR_PREL_PG_HI21_NC
|
|
# R_AARCH64_ADR_LO_21
|
|
adrp x0, :pg_hi21:global_a
|
|
adrp x1, :pg_hi21_nc:global_a
|
|
adr x2, global_a
|
|
|
|
#R_AARCH64_LD_PREL_LO19
|
|
ldr x3, global_a
|
|
|
|
# R_AARCH64_PREL16
|
|
# R_AARCH64_PREL32
|
|
# R_AARCH64_PREL64
|
|
.hword global_a - .
|
|
.word global_a - .
|
|
.xword global_a - .
|
|
|
|
# Defined global symbol may bind externally because of copy relocation,
|
|
# while defined hidden symbol binds locally. LD should be able to
|
|
# differenciate this.
|
|
adrp x0, :pg_hi21:global_b
|
|
.xword global_b - .
|