diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2013-11-12 15:46:55 -0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2013-11-17 08:57:56 -0800 |
commit | c33205431ae179ed500f2840759a7624af1a23d4 (patch) | |
tree | 3a0a8253cc51e3a32c1cde36e5cabf70daa00930 /bfd | |
parent | b13704181fe2e5d89f95342d9a173df8b9a1a34c (diff) | |
download | gdb-c33205431ae179ed500f2840759a7624af1a23d4.zip gdb-c33205431ae179ed500f2840759a7624af1a23d4.tar.gz gdb-c33205431ae179ed500f2840759a7624af1a23d4.tar.bz2 |
Add R_X86_64_PC32_BND and R_X86_64_PLT32_BND
bfd/
* elf64-x86-64.c (x86_64_elf_howto_table): Add R_X86_64_PC32_BND
and R_X86_64_PLT32_BND.
(R_X86_64_standard): Replace R_X86_64_RELATIVE64 with
R_X86_64_PLT32_BND.
(IS_X86_64_PCREL_TYPE): Add R_X86_64_PLT32_BND.
(x86_64_reloc_map): Add BFD_RELOC_X86_64_PC32_BND and
BFD_RELOC_X86_64_PLT32_BND.
(elf_x86_64_check_relocs): Handle R_X86_64_PC32_BND and
R_X86_64_PLT32_BND.
(elf_x86_64_gc_sweep_hook): Likewise.
(elf_x86_64_relocate_section): Likewise.
* reloc.c (bfd_reloc_code_real): Add BFD_RELOC_X86_64_PC32_BND
and BFD_RELOC_X86_64_PLT32_BND.
* bfd-in2.h: Regenerated.
* libbfd.h: Likewise.
gas/
* config/tc-i386.c (reloc): Add an argument, bnd_prefix, to
indicate if instruction has the BND prefix. Return
BFD_RELOC_X86_64_PC32_BND instead of BFD_RELOC_32_PCREL if
bnd_prefix isn't zero.
(output_branch): Pass BFD_RELOC_X86_64_PC32_BND to frag_var
if needed.
(output_jump): Update reloc call.
(output_interseg_jump): Likewise.
(output_disp): Likewise.
(output_imm): Likewise.
(x86_cons_fix_new): Likewise.
(lex_got): Add an argument, bnd_prefix, to indicate if
instruction has the BND prefix. Use BFD_RELOC_X86_64_PLT32_BND
if needed.
(x86_cons): Update lex_got call.
(i386_immediate): Likewise.
(i386_displacement): Likewise.
(md_apply_fix): Handle BFD_RELOC_X86_64_PC32_BND and
BFD_RELOC_X86_64_PLT32_BND.
(tc_gen_reloc): Likewise.
* config/tc-i386-intel.c (i386_operator): Update lex_got call.
gas/testsuite/
* gas/i386/i386.exp: Run x86-64-mpx-branch-1 and
x86-64-mpx-branch-2 on 64-bit ELF targets.
* gas/i386/x86-64-mpx-branch-1.d: New file.
* gas/i386/x86-64-mpx-branch-1.s: Likewise.
* gas/i386/x86-64-mpx-branch-2.d: Likewise.
* gas/i386/x86-64-mpx-branch-2.s: Likewise.
include/elf/
* x86-64.h: Add R_X86_64_PC32_BND and R_X86_64_PLT32_BND.
ld/testsuite/
* ld-x86-64/mpx.exp: New file.
* ld-x86-64/mpx1.out: Likewise.
* ld-x86-64/mpx1a.c: Likewise.
* ld-x86-64/mpx1a.rd: Likewise.
* ld-x86-64/mpx1b.c: Likewise.
* ld-x86-64/mpx1c.c: Likewise.
* ld-x86-64/mpx1c.rd: Likewise.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 18 | ||||
-rw-r--r-- | bfd/bfd-in2.h | 2 | ||||
-rw-r--r-- | bfd/elf64-x86-64.c | 28 | ||||
-rw-r--r-- | bfd/libbfd.h | 2 | ||||
-rw-r--r-- | bfd/reloc.c | 4 |
5 files changed, 51 insertions, 3 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 94b89a0..b5869d5 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,21 @@ +2013-11-17 H.J. Lu <hongjiu.lu@intel.com> + + * elf64-x86-64.c (x86_64_elf_howto_table): Add R_X86_64_PC32_BND + and R_X86_64_PLT32_BND. + (R_X86_64_standard): Replace R_X86_64_RELATIVE64 with + R_X86_64_PLT32_BND. + (IS_X86_64_PCREL_TYPE): Add R_X86_64_PLT32_BND. + (x86_64_reloc_map): Add BFD_RELOC_X86_64_PC32_BND and + BFD_RELOC_X86_64_PLT32_BND. + (elf_x86_64_check_relocs): Handle R_X86_64_PC32_BND and + R_X86_64_PLT32_BND. + (elf_x86_64_gc_sweep_hook): Likewise. + (elf_x86_64_relocate_section): Likewise. + * reloc.c (bfd_reloc_code_real): Add BFD_RELOC_X86_64_PC32_BND + and BFD_RELOC_X86_64_PLT32_BND. + * bfd-in2.h: Regenerated. + * libbfd.h: Likewise. + 2013-11-15 H.J. Lu <hongjiu.lu@intel.com> * elf32-i386.c (elf_i386_allocate_dynrelocs): Make room for diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 79f2130..846116b 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -3125,6 +3125,8 @@ instruction. */ BFD_RELOC_X86_64_TLSDESC_CALL, BFD_RELOC_X86_64_TLSDESC, BFD_RELOC_X86_64_IRELATIVE, + BFD_RELOC_X86_64_PC32_BND, + BFD_RELOC_X86_64_PLT32_BND, /* ns32k relocations */ BFD_RELOC_NS32K_IMM_8, diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 6ff5f36..8eac635 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -172,12 +172,18 @@ static reloc_howto_type x86_64_elf_howto_table[] = HOWTO(R_X86_64_RELATIVE64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_X86_64_RELATIVE64", FALSE, MINUS_ONE, MINUS_ONE, FALSE), + HOWTO(R_X86_64_PC32_BND, 0, 2, 32, TRUE, 0, complain_overflow_signed, + bfd_elf_generic_reloc, "R_X86_64_PC32_BND", FALSE, 0xffffffff, 0xffffffff, + TRUE), + HOWTO(R_X86_64_PLT32_BND, 0, 2, 32, TRUE, 0, complain_overflow_signed, + bfd_elf_generic_reloc, "R_X86_64_PLT32_BND", FALSE, 0xffffffff, 0xffffffff, + TRUE), /* We have a gap in the reloc numbers here. R_X86_64_standard counts the number up to this point, and R_X86_64_vt_offset is the value to subtract from a reloc type of R_X86_64_GNU_VT* to form an index into this table. */ -#define R_X86_64_standard (R_X86_64_RELATIVE64 + 1) +#define R_X86_64_standard (R_X86_64_PLT32_BND + 1) #define R_X86_64_vt_offset (R_X86_64_GNU_VTINHERIT - R_X86_64_standard) /* GNU extension to record C++ vtable hierarchy. */ @@ -199,6 +205,7 @@ static reloc_howto_type x86_64_elf_howto_table[] = ( ((TYPE) == R_X86_64_PC8) \ || ((TYPE) == R_X86_64_PC16) \ || ((TYPE) == R_X86_64_PC32) \ + || ((TYPE) == R_X86_64_PC32_BND) \ || ((TYPE) == R_X86_64_PC64)) /* Map BFD relocs to the x86_64 elf relocs. */ @@ -248,6 +255,8 @@ static const struct elf_reloc_map x86_64_reloc_map[] = { BFD_RELOC_X86_64_TLSDESC_CALL, R_X86_64_TLSDESC_CALL, }, { BFD_RELOC_X86_64_TLSDESC, R_X86_64_TLSDESC, }, { BFD_RELOC_X86_64_IRELATIVE, R_X86_64_IRELATIVE, }, + { BFD_RELOC_X86_64_PC32_BND, R_X86_64_PC32_BND,}, + { BFD_RELOC_X86_64_PLT32_BND, R_X86_64_PLT32_BND,}, { BFD_RELOC_VTABLE_INHERIT, R_X86_64_GNU_VTINHERIT, }, { BFD_RELOC_VTABLE_ENTRY, R_X86_64_GNU_VTENTRY, }, }; @@ -1542,8 +1551,10 @@ elf_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, case R_X86_64_32: case R_X86_64_64: case R_X86_64_PC32: + case R_X86_64_PC32_BND: case R_X86_64_PC64: case R_X86_64_PLT32: + case R_X86_64_PLT32_BND: case R_X86_64_GOTPCREL: case R_X86_64_GOTPCREL64: if (htab->elf.dynobj == NULL) @@ -1706,6 +1717,7 @@ elf_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, break; case R_X86_64_PLT32: + case R_X86_64_PLT32_BND: /* This symbol requires a procedure linkage table entry. We actually build the entry in adjust_dynamic_symbol, because this might be a case of linking PIC code which is @@ -1766,6 +1778,7 @@ elf_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, case R_X86_64_PC8: case R_X86_64_PC16: case R_X86_64_PC32: + case R_X86_64_PC32_BND: case R_X86_64_PC64: case R_X86_64_64: pointer: @@ -1782,7 +1795,9 @@ pointer: /* We may need a .plt entry if the function this reloc refers to is in a shared lib. */ h->plt.refcount += 1; - if (r_type != R_X86_64_PC32 && r_type != R_X86_64_PC64) + if (r_type != R_X86_64_PC32 + && r_type != R_X86_64_PC32_BND + && r_type != R_X86_64_PC64) h->pointer_equality_needed = 1; } @@ -2066,6 +2081,7 @@ elf_x86_64_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info, case R_X86_64_PC8: case R_X86_64_PC16: case R_X86_64_PC32: + case R_X86_64_PC32_BND: case R_X86_64_PC64: case R_X86_64_SIZE32: case R_X86_64_SIZE64: @@ -2075,6 +2091,7 @@ elf_x86_64_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info, /* Fall thru */ case R_X86_64_PLT32: + case R_X86_64_PLT32_BND: case R_X86_64_PLTOFF64: if (h != NULL) { @@ -3441,8 +3458,10 @@ elf_x86_64_relocate_section (bfd *output_bfd, } /* FALLTHROUGH */ case R_X86_64_PC32: + case R_X86_64_PC32_BND: case R_X86_64_PC64: case R_X86_64_PLT32: + case R_X86_64_PLT32_BND: goto do_relocation; case R_X86_64_GOTPCREL: @@ -3687,6 +3706,7 @@ elf_x86_64_relocate_section (bfd *output_bfd, break; case R_X86_64_PLT32: + case R_X86_64_PLT32_BND: /* Relocation is to the entry for this symbol in the procedure linkage table. */ @@ -3719,6 +3739,7 @@ elf_x86_64_relocate_section (bfd *output_bfd, case R_X86_64_PC8: case R_X86_64_PC16: case R_X86_64_PC32: + case R_X86_64_PC32_BND: if (info->shared && (input_section->flags & SEC_ALLOC) != 0 && (input_section->flags & SEC_READONLY) != 0 @@ -3726,7 +3747,8 @@ elf_x86_64_relocate_section (bfd *output_bfd, { bfd_boolean fail = FALSE; bfd_boolean branch - = (r_type == R_X86_64_PC32 + = ((r_type == R_X86_64_PC32 + || r_type == R_X86_64_PC32_BND) && is_32bit_relative_branch (contents, rel->r_offset)); if (SYMBOL_REFERENCES_LOCAL (info, h)) diff --git a/bfd/libbfd.h b/bfd/libbfd.h index 4f98108..4aaecbf 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -1307,6 +1307,8 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_X86_64_TLSDESC_CALL", "BFD_RELOC_X86_64_TLSDESC", "BFD_RELOC_X86_64_IRELATIVE", + "BFD_RELOC_X86_64_PC32_BND", + "BFD_RELOC_X86_64_PLT32_BND", "BFD_RELOC_NS32K_IMM_8", "BFD_RELOC_NS32K_IMM_16", "BFD_RELOC_NS32K_IMM_32", diff --git a/bfd/reloc.c b/bfd/reloc.c index 8778e1d..77a04f8 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -2699,6 +2699,10 @@ ENUMX BFD_RELOC_X86_64_TLSDESC ENUMX BFD_RELOC_X86_64_IRELATIVE +ENUMX + BFD_RELOC_X86_64_PC32_BND +ENUMX + BFD_RELOC_X86_64_PLT32_BND ENUMDOC x86-64/elf relocations |