diff options
author | Jiong Wang <jiong.wang@arm.com> | 2014-08-26 15:48:47 +0100 |
---|---|---|
committer | Jiong Wang <jiong.wang@arm.com> | 2014-08-26 15:48:47 +0100 |
commit | 614b09cefb3bafa840fe5ed06c58024b0ff9c1cb (patch) | |
tree | 8f81648e5f08f7309aeb9a379e38e78a3b14ae56 /bfd | |
parent | 2836a869c4607fd1200b928986092ffed20c1d32 (diff) | |
download | gdb-614b09cefb3bafa840fe5ed06c58024b0ff9c1cb.zip gdb-614b09cefb3bafa840fe5ed06c58024b0ff9c1cb.tar.gz gdb-614b09cefb3bafa840fe5ed06c58024b0ff9c1cb.tar.bz2 |
[AArch64] Improve copy relocation support on four absolute relocation types
2014-08-26 Jiong Wang <jiong.wang@arm.com>
bfd/
* elfnn-aarch64.c (elfNN_aarch64_check_relocs): Initialize non_got_ref
properly for MOVW_G0/1/2_NC and MOVW_G3. Reject them when linking
shared library.
(elfNN_aarch64_gc_sweep_hook): Add check on these relocs.
ld/testsuite/
* ld-aarch64/copy-relocs-so.s: New test file.
* ld-aarch64/copy-relocs-exe.s: Likewise.
* ld-aarch64/copy-relocs.d: New expectation file.
* ld-aarch64/emit-relocs-264-bad.d: New test file.
* ld-aarch64/emit-relocs-266-bad.d: Likewise.
* ld-aarch64/emit-relocs-268-bad.d: Likewise.
* ld-aarch64/emit-relocs-269-bad.d: Likewise.
* ld-aarch64/aarch64-elf.exp: Run new added test.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 7 | ||||
-rw-r--r-- | bfd/elfnn-aarch64.c | 33 |
2 files changed, 30 insertions, 10 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 9e5b6d9..d94f590 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +2014-08-26 Jiong Wang <jiong.wang@arm.com> + + * elfnn-aarch64.c (elfNN_aarch64_check_relocs): Initialize non_got_ref + properly for MOVW_G0/1/2_NC and MOVW_G3. Reject them when linking + shared library. + (elfNN_aarch64_gc_sweep_hook): Add check on these relocs. + 2014-08-26 Nick Clifton <nickc@redhat.com> * config.bfd: Fix typo in or1knd selection. diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c index 4dfb604..d7b3037 100644 --- a/bfd/elfnn-aarch64.c +++ b/bfd/elfnn-aarch64.c @@ -4766,16 +4766,6 @@ elfNN_aarch64_gc_sweep_hook (bfd *abfd, } break; - case BFD_RELOC_AARCH64_ADR_HI21_NC_PCREL: - case BFD_RELOC_AARCH64_ADR_HI21_PCREL: - case BFD_RELOC_AARCH64_ADR_LO21_PCREL: - if (h != NULL && info->executable) - { - if (h->plt.refcount > 0) - h->plt.refcount -= 1; - } - break; - case BFD_RELOC_AARCH64_CALL26: case BFD_RELOC_AARCH64_JUMP26: /* If this is a local symbol then we resolve it @@ -4787,6 +4777,13 @@ elfNN_aarch64_gc_sweep_hook (bfd *abfd, h->plt.refcount -= 1; break; + case BFD_RELOC_AARCH64_MOVW_G0_NC: + case BFD_RELOC_AARCH64_MOVW_G1_NC: + case BFD_RELOC_AARCH64_MOVW_G2_NC: + case BFD_RELOC_AARCH64_MOVW_G3: + case BFD_RELOC_AARCH64_ADR_HI21_NC_PCREL: + case BFD_RELOC_AARCH64_ADR_HI21_PCREL: + case BFD_RELOC_AARCH64_ADR_LO21_PCREL: case BFD_RELOC_AARCH64_NN: if (h != NULL && info->executable) { @@ -5283,6 +5280,22 @@ elfNN_aarch64_check_relocs (bfd *abfd, struct bfd_link_info *info, break; } + case BFD_RELOC_AARCH64_MOVW_G0_NC: + case BFD_RELOC_AARCH64_MOVW_G1_NC: + case BFD_RELOC_AARCH64_MOVW_G2_NC: + case BFD_RELOC_AARCH64_MOVW_G3: + if (info->shared) + { + int howto_index = bfd_r_type - BFD_RELOC_AARCH64_RELOC_START; + (*_bfd_error_handler) + (_("%B: relocation %s against `%s' can not be used when making " + "a shared object; recompile with -fPIC"), + abfd, elfNN_aarch64_howto_table[howto_index].name, + (h) ? h->root.root.string : "a local symbol"); + bfd_set_error (bfd_error_bad_value); + return FALSE; + } + case BFD_RELOC_AARCH64_ADR_HI21_NC_PCREL: case BFD_RELOC_AARCH64_ADR_HI21_PCREL: case BFD_RELOC_AARCH64_ADR_LO21_PCREL: |