aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2015-09-03 04:13:21 -0700
committerH.J. Lu <hjl.tools@gmail.com>2015-09-03 04:17:05 -0700
commit77697d411ef33c3e603275b905ae965ff555400d (patch)
tree0dc7dbabc13db68d7544264fe965c68f44fba87b /bfd
parent8c650f161a95873e3dc08365fc9a74583df9de62 (diff)
downloadgdb-77697d411ef33c3e603275b905ae965ff555400d.zip
gdb-77697d411ef33c3e603275b905ae965ff555400d.tar.gz
gdb-77697d411ef33c3e603275b905ae965ff555400d.tar.bz2
Remove convert_mov_to_lea
* elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Remove convert_mov_to_lea.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elf64-x86-64.c53
2 files changed, 26 insertions, 32 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index cfd5f39..d51800e 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2015-09-03 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Remove
+ convert_mov_to_lea.
+
2015-09-02 H.J. Lu <hongjiu.lu@intel.com>
* elf32-i386.c (R_386_irelative): Renamed to ...
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index f753c7a..2230c15 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -3010,9 +3010,6 @@ elf_x86_64_convert_mov_to_lea (bfd *abfd, asection *sec,
asection *tsec;
char symtype;
bfd_vma toff, roff;
- enum {
- none, local, global
- } convert_mov_to_lea;
unsigned int opcode;
if (r_type != R_X86_64_GOTPCREL)
@@ -3030,17 +3027,11 @@ elf_x86_64_convert_mov_to_lea (bfd *abfd, asection *sec,
if (opcode != 0x8b)
continue;
- tsec = NULL;
- convert_mov_to_lea = none;
-
/* Get the symbol referred to by the reloc. */
if (r_symndx < symtab_hdr->sh_info)
{
Elf_Internal_Sym *isym;
- /* Silence older GCC warning. */
- h = NULL;
-
isym = bfd_sym_from_r_symndx (&htab->sym_cache,
abfd, r_symndx);
@@ -3048,20 +3039,20 @@ elf_x86_64_convert_mov_to_lea (bfd *abfd, asection *sec,
/* STT_GNU_IFUNC must keep R_X86_64_GOTPCREL relocation and
skip relocation against undefined symbols. */
- if (symtype != STT_GNU_IFUNC && isym->st_shndx != SHN_UNDEF)
- {
- if (isym->st_shndx == SHN_ABS)
- tsec = bfd_abs_section_ptr;
- else if (isym->st_shndx == SHN_COMMON)
- tsec = bfd_com_section_ptr;
- else if (isym->st_shndx == SHN_X86_64_LCOMMON)
- tsec = &_bfd_elf_large_com_section;
- else
- tsec = bfd_section_from_elf_index (abfd, isym->st_shndx);
+ if (symtype == STT_GNU_IFUNC || isym->st_shndx == SHN_UNDEF)
+ continue;
- toff = isym->st_value;
- convert_mov_to_lea = local;
- }
+ if (isym->st_shndx == SHN_ABS)
+ tsec = bfd_abs_section_ptr;
+ else if (isym->st_shndx == SHN_COMMON)
+ tsec = bfd_com_section_ptr;
+ else if (isym->st_shndx == SHN_X86_64_LCOMMON)
+ tsec = &_bfd_elf_large_com_section;
+ else
+ tsec = bfd_section_from_elf_index (abfd, isym->st_shndx);
+
+ h = NULL;
+ toff = isym->st_value;
}
else
{
@@ -3084,13 +3075,11 @@ elf_x86_64_convert_mov_to_lea (bfd *abfd, asection *sec,
tsec = h->root.u.def.section;
toff = h->root.u.def.value;
symtype = h->type;
- convert_mov_to_lea = global;
}
+ else
+ continue;
}
- if (convert_mov_to_lea == none)
- continue;
-
if (tsec->sec_info_type == SEC_INFO_TYPE_MERGE)
{
/* At this stage in linking, no SEC_MERGE symbol has been
@@ -3168,16 +3157,16 @@ elf_x86_64_convert_mov_to_lea (bfd *abfd, asection *sec,
changed_contents = TRUE;
changed_relocs = TRUE;
- if (convert_mov_to_lea == local)
+ if (h)
{
- if (local_got_refcounts != NULL
- && local_got_refcounts[r_symndx] > 0)
- local_got_refcounts[r_symndx] -= 1;
+ if (h->got.refcount > 0)
+ h->got.refcount -= 1;
}
else
{
- if (h->got.refcount > 0)
- h->got.refcount -= 1;
+ if (local_got_refcounts != NULL
+ && local_got_refcounts[r_symndx] > 0)
+ local_got_refcounts[r_symndx] -= 1;
}
}