aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/elfnn-aarch64.c2
-rw-r--r--ld/testsuite/ld-aarch64/aarch64-elf.exp1
-rw-r--r--ld/testsuite/ld-aarch64/pcrel-protected.s11
-rw-r--r--ld/testsuite/ld-aarch64/pcrel_pic_protected.d7
4 files changed, 20 insertions, 1 deletions
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index ce2632e..c688b7cf 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -5888,7 +5888,7 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto,
if (bfd_link_pic (info)
&& (input_section->flags & SEC_ALLOC) != 0
&& (input_section->flags & SEC_READONLY) != 0
- && !SYMBOL_REFERENCES_LOCAL (info, h))
+ && !_bfd_elf_symbol_refs_local_p (h, info, 1))
{
int howto_index = bfd_r_type - BFD_RELOC_AARCH64_RELOC_START;
diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarch64/aarch64-elf.exp
index 3116227..3c45f87 100644
--- a/ld/testsuite/ld-aarch64/aarch64-elf.exp
+++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp
@@ -248,6 +248,7 @@ run_dump_test_lp64 "local-addend-r"
# test error handling on pcrel relocation for shared libraries.
run_dump_test_lp64 "pcrel_pic_undefined"
run_dump_test_lp64 "pcrel_pic_defined"
+run_dump_test_lp64 "pcrel_pic_protected"
run_dump_test "limit-b"
run_dump_test "limit-bl"
diff --git a/ld/testsuite/ld-aarch64/pcrel-protected.s b/ld/testsuite/ld-aarch64/pcrel-protected.s
new file mode 100644
index 0000000..24c6232
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/pcrel-protected.s
@@ -0,0 +1,11 @@
+.protected protected_a, protected_b, protected_c
+.type protected_b, %object
+.type protected_c, %function
+
+.text
+ adrp x0, protected_a
+ add x0, x0, :lo12:protected_a
+ adrp x0, protected_b
+ add x0, x0, :lo12:protected_b
+ adrp x0, protected_c
+ add x0, x0, :lo12:protected_c
diff --git a/ld/testsuite/ld-aarch64/pcrel_pic_protected.d b/ld/testsuite/ld-aarch64/pcrel_pic_protected.d
new file mode 100644
index 0000000..1b6f24c
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/pcrel_pic_protected.d
@@ -0,0 +1,7 @@
+#name: PC-Rel relocation against protected
+#source: pcrel-protected.s
+#target: [check_shared_lib_support]
+#ld: -shared -e0 --defsym protected_a=0x1000 --defsym protected_b=0x1010 --defsym protected_c=0x1020
+#readelf: -r -W
+#...
+There are no relocations in this file.