From d68f19767dfbb33c1813563d5a4af0731a1855c5 Mon Sep 17 00:00:00 2001 From: Jiong Wang <jiong.wang@arm.com> Date: Fri, 16 Jun 2017 14:20:38 +0100 Subject: [AArch64] Use SYMBOL_REFERENCES_LOCAL in one symbol check 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. --- ld/testsuite/ld-aarch64/pcrel_pic_defined.d | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 ld/testsuite/ld-aarch64/pcrel_pic_defined.d (limited to 'ld/testsuite/ld-aarch64/pcrel_pic_defined.d') diff --git a/ld/testsuite/ld-aarch64/pcrel_pic_defined.d b/ld/testsuite/ld-aarch64/pcrel_pic_defined.d new file mode 100644 index 0000000..743e810 --- /dev/null +++ b/ld/testsuite/ld-aarch64/pcrel_pic_defined.d @@ -0,0 +1,10 @@ +#name: PC-Rel relocation against defined +#source: pcrel.s +#ld: -shared -e0 -defsym global_a=0x1000 -defsym global_b=0x2000 +#warning: .*: relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `global_a.*bind externally.*fPIC.* +#warning: .*: relocation R_AARCH64_ADR_PREL_PG_HI21_NC against symbol `global_a.*bind externally.*fPIC.* +#warning: .*: relocation R_AARCH64_ADR_PREL_LO21 against symbol `global_a.*bind externally.*fPIC.* +#warning: .*: relocation R_AARCH64_LD_PREL_LO19 against symbol `global_a.*bind externally.*fPIC.* +#warning: .*: relocation R_AARCH64_PREL16 against symbol `global_a.*bind externally.*fPIC.* +#warning: .*: relocation R_AARCH64_PREL32 against symbol `global_a.*bind externally.*fPIC.* +#warning: .*: relocation R_AARCH64_PREL64 against symbol `global_a.*bind externally.*fPIC.* -- cgit v1.1