aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf64-x86-64.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2015-07-01 09:32:47 -0700
committerH.J. Lu <hjl.tools@gmail.com>2015-07-01 09:33:27 -0700
commitdfc87947b5ac6d6382c225449d4fdce411c7ee66 (patch)
treee26df80704577625f748fd23474dff0921a6f52c /bfd/elf64-x86-64.c
parentbbcbf914a6ad801bfa7d4e56150217a1d53e07af (diff)
downloadgdb-dfc87947b5ac6d6382c225449d4fdce411c7ee66.zip
gdb-dfc87947b5ac6d6382c225449d4fdce411c7ee66.tar.gz
gdb-dfc87947b5ac6d6382c225449d4fdce411c7ee66.tar.bz2
Refactor elf_x86_64_convert_mov_to_lea
* elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Refactor.
Diffstat (limited to 'bfd/elf64-x86-64.c')
-rw-r--r--bfd/elf64-x86-64.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 3022deb..a4dfdc8 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -2952,16 +2952,21 @@ elf_x86_64_convert_mov_to_lea (bfd *abfd, asection *sec,
enum {
none, local, global
} convert_mov_to_lea;
+ unsigned int opcode;
if (r_type != R_X86_64_GOTPCREL)
continue;
roff = irel->r_offset;
- /* Don't convert R_X86_64_GOTPCREL relocation if it isn't for mov
- instruction. */
- if (roff < 2
- || bfd_get_8 (abfd, contents + roff - 2) != 0x8b)
+ if (roff < 2)
+ continue;
+
+ opcode = bfd_get_8 (abfd, contents + roff - 2);
+
+ /* PR ld/18591: Don't convert R_X86_64_GOTPCREL relocation if it
+ isn't for mov instruction. */
+ if (opcode != 0x8b)
continue;
tsec = NULL;