+2017-06-16 Jiong Wang <jiong.wang@arm.com>
+
+ * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Use
+ SYMBOL_REFERENCES_LOCAL.
+
2017-06-15 Jiong Wang <jiong.wang@arm.com>
PR ld/21532
if (bfd_link_pic (info)
&& (input_section->flags & SEC_ALLOC) != 0
&& (input_section->flags & SEC_READONLY) != 0
- && h != NULL
- && !h->def_regular)
+ && !SYMBOL_REFERENCES_LOCAL (info, h))
{
int howto_index = bfd_r_type - BFD_RELOC_AARCH64_RELOC_START;
_bfd_error_handler
/* xgettext:c-format */
- (_("%B: relocation %s against external symbol `%s' can not be used"
- " when making a shared object; recompile with -fPIC"),
+ (_("%B: relocation %s against symbol `%s' which may bind "
+ "externally can not be used when making a shared object; "
+ "recompile with -fPIC"),
input_bfd, elfNN_aarch64_howto_table[howto_index].name,
h->root.root.string);
bfd_set_error (bfd_error_bad_value);
+2017-06-16 Jiong Wang <jiong.wang@arm.com>
+
+ * 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.
+
2017-06-15 H.J. Lu <hongjiu.lu@intel.com>
* exsup.c (elf_shlib_list_options): Display "-z stack-size=SIZE"
# test error handling on pcrel relocation for shared libraries.
run_dump_test_lp64 "pcrel_pic_undefined"
-run_dump_test_lp64 "pcrel_pic_defined_local"
+run_dump_test_lp64 "pcrel_pic_defined"
run_dump_test "limit-b"
run_dump_test "limit-bl"
+ .hidden global_b
.text
.align 2
main:
.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 - .
--- /dev/null
+#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.*
+++ /dev/null
-#name: PC-Rel relocation against defined
-#source: pcrel.s
-#objdump: -r
-#ld: -shared -e0 -defsym global_a=0x1000
-#...
#name: PC-Rel relocation against undefined
#source: pcrel.s
-#ld: -shared -e0
-#warning: .*: relocation R_AARCH64_ADR_PREL_PG_HI21 against external symbol.*fPIC.*
-#warning: .*: relocation R_AARCH64_ADR_PREL_PG_HI21_NC against external symbol.*fPIC.*
-#warning: .*: relocation R_AARCH64_ADR_PREL_LO21 against external symbol.*fPIC.*
-#warning: .*: relocation R_AARCH64_LD_PREL_LO19 against external symbol.*fPIC.*
-#warning: .*: relocation R_AARCH64_PREL16 against external symbol.*fPIC.*
-#warning: .*: relocation R_AARCH64_PREL32 against external symbol.*fPIC.*
-#warning: .*: relocation R_AARCH64_PREL64 against external symbol.*fPIC.*
+#ld: -shared -e0 -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.*