aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2022-06-23 01:10:44 -0700
committerFangrui Song <i@maskray.me>2022-06-23 01:10:44 -0700
commit83c325007c5599fa9b60b8d5f7b84842160e1d1b (patch)
tree426017dc48259ad79946e1bd3faed0b9e4a608a6 /bfd
parent4fb55bf6a9606eb7b626c30a9f4e71d6c2d4fbb2 (diff)
downloadgdb-83c325007c5599fa9b60b8d5f7b84842160e1d1b.zip
gdb-83c325007c5599fa9b60b8d5f7b84842160e1d1b.tar.gz
gdb-83c325007c5599fa9b60b8d5f7b84842160e1d1b.tar.bz2
aarch64: Allow PC-relative relocations against protected STT_FUNC for -shared
__attribute__((visibility("protected"))) void *foo() { return (void *)foo; } gcc -fpic -shared -fuse-ld=bfd fails with the confusing diagnostic: relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `foo' which may bind externally can not be used when making a shared object; recompile with -fPIC Call _bfd_elf_symbol_refs_local_p with local_protected==true to suppress the error. The new behavior matches gold and ld.lld. Note: if some code tries to use direct access relocations to take the address of foo (likely due to -fno-pic), the pointer equality will break, but the error should be reported on the executable link, not on the innocent shared object link. glibc 2.36 will give a warning at relocation resolving time.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/elfnn-aarch64.c2
1 files changed, 1 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;