diff options
author | Jiong Wang <jiong.wang@arm.com> | 2017-06-16 14:20:38 +0100 |
---|---|---|
committer | Jiong Wang <jiong.wang@arm.com> | 2017-06-16 14:20:38 +0100 |
commit | d68f19767dfbb33c1813563d5a4af0731a1855c5 (patch) | |
tree | 27afb23abad3e0ebaa2121a63a8d7cf191eeef39 /bfd | |
parent | a87dc45adc983a8e6ec3db8d18cd31c35abd2048 (diff) | |
download | gdb-d68f19767dfbb33c1813563d5a4af0731a1855c5.zip gdb-d68f19767dfbb33c1813563d5a4af0731a1855c5.tar.gz gdb-d68f19767dfbb33c1813563d5a4af0731a1855c5.tar.bz2 |
[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.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 5 | ||||
-rw-r--r-- | bfd/elfnn-aarch64.c | 8 |
2 files changed, 9 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 879ced7..c7241ba 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +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 diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c index e27f067..b61bb8a 100644 --- a/bfd/elfnn-aarch64.c +++ b/bfd/elfnn-aarch64.c @@ -5329,15 +5329,15 @@ 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 - && 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); |