aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-i386.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2018-05-18 06:43:19 -0700
committerH.J. Lu <hjl.tools@gmail.com>2018-05-18 06:43:34 -0700
commit011b32fd4270fb7111ee1f63695ccd44562ee7df (patch)
tree110abd5acda6059b6296fa3ba26bfa65543ce9de /bfd/elf32-i386.c
parent4bba0fb1c6d391a217c25e44398a7e1c7090155f (diff)
downloadgdb-011b32fd4270fb7111ee1f63695ccd44562ee7df.zip
gdb-011b32fd4270fb7111ee1f63695ccd44562ee7df.tar.gz
gdb-011b32fd4270fb7111ee1f63695ccd44562ee7df.tar.bz2
x86: Don't set eh->local_ref to 1 for linker defined symbols
Since symbols created by HIDDEN and PROVIDE_HIDDEN assignments in linker script may be marked as defined, but not hidden, we can't set eh->local_ref to 1 in _bfd_x86_elf_link_symbol_references_local. Also R_386_GOT32X should be handled as just like R_386_GOT32 when relocating a section. The input R_386_GOT32X relocations, which can be relaxed, should have been converted to R_386_PC32, R_386_32 or R_386_GOTOFF. bfd/ PR ld/23189 * elf32-i386.c (elf_i386_relocate_section): Handle R_386_GOT32X like R_386_GOT32. * elfxx-x86.c (_bfd_x86_elf_link_symbol_references_local): Don't set eh->local_ref to 1 for linker defined symbols. ld/ PR ld/23189 * testsuite/ld-i386/i386.exp: Run pr23189. * testsuite/ld-x86-64/x86-64.exp: Likewise. * testsuite/ld-i386/pr23189.d: New file. * testsuite/ld-i386/pr23189.s: Likewise. * testsuite/ld-i386/pr23189.t: Likewise. * testsuite/ld-x86-64/pr23189.d: Likewise. * testsuite/ld-x86-64/pr23189.s: Likewise. * testsuite/ld-x86-64/pr23189.t: Likewise.
Diffstat (limited to 'bfd/elf32-i386.c')
-rw-r--r--bfd/elf32-i386.c59
1 files changed, 0 insertions, 59 deletions
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 580a591..3dd709a 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -2451,66 +2451,7 @@ skip_ifunc:
switch (r_type)
{
case R_386_GOT32X:
- /* Avoid optimizing _DYNAMIC since ld.so may use its
- link-time address. */
- if (h == htab->elf.hdynamic)
- goto r_386_got32;
-
- if (bfd_link_pic (info))
- {
- /* It is OK to convert mov to lea and convert indirect
- branch to direct branch. It is OK to convert adc,
- add, and, cmp, or, sbb, sub, test, xor only when PIC
- is false. */
- unsigned int opcode, addend;
- addend = bfd_get_32 (input_bfd, contents + rel->r_offset);
- if (addend != 0)
- goto r_386_got32;
- opcode = bfd_get_8 (input_bfd, contents + rel->r_offset - 2);
- if (opcode != 0x8b && opcode != 0xff)
- goto r_386_got32;
- }
-
- /* Resolve "mov GOT[(%reg)], %reg",
- "call/jmp *GOT[(%reg)]", "test %reg, foo@GOT[(%reg)]"
- and "binop foo@GOT[(%reg)], %reg". */
- if (h == NULL
- || (h->plt.offset == (bfd_vma) -1
- && h->got.offset == (bfd_vma) -1)
- || htab->elf.sgotplt == NULL)
- abort ();
-
- offplt = (htab->elf.sgotplt->output_section->vma
- + htab->elf.sgotplt->output_offset);
-
- /* It is relative to .got.plt section. */
- if (h->got.offset != (bfd_vma) -1)
- /* Use GOT entry. Mask off the least significant bit in
- GOT offset which may be set by R_386_GOT32 processing
- below. */
- relocation = (htab->elf.sgot->output_section->vma
- + htab->elf.sgot->output_offset
- + (h->got.offset & ~1) - offplt);
- else
- /* Use GOTPLT entry. */
- relocation = (h->plt.offset / plt_entry_size
- - htab->plt.has_plt0 + 3) * 4;
-
- if (!bfd_link_pic (info))
- {
- /* If not PIC, add the .got.plt section address for
- baseless addressing. */
- unsigned int modrm;
- modrm = bfd_get_8 (input_bfd, contents + rel->r_offset - 1);
- if ((modrm & 0xc7) == 0x5)
- relocation += offplt;
- }
-
- unresolved_reloc = FALSE;
- break;
-
case R_386_GOT32:
-r_386_got32:
/* Relocation is to the entry for this symbol in the global
offset table. */
if (htab->elf.sgot == NULL)