summaryrefslogtreecommitdiff
path: root/bfd/elf32-i386.c
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/elf32-i386.c')
-rw-r--r--bfd/elf32-i386.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 417957214db..d549ffee716 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -3993,7 +3993,9 @@ elf_i386_relocate_section (bfd *output_bfd,
- gotplt->output_section->vma
- gotplt->output_offset);
- if ((*(contents + rel->r_offset - 1) & 0xc7) == 0x5)
+ if (rel->r_offset > 1
+ && (*(contents + rel->r_offset - 1) & 0xc7) == 0x5
+ && *(contents + rel->r_offset - 2) != 0x8d)
{
if (bfd_link_pic (info))
goto disallow_got32;
@@ -4263,13 +4265,15 @@ r_386_got32:
relocation = (htab->elf.sgot->output_section->vma
+ htab->elf.sgot->output_offset + off);
- if ((*(contents + rel->r_offset - 1) & 0xc7) == 0x5)
+ if (rel->r_offset > 1
+ && (*(contents + rel->r_offset - 1) & 0xc7) == 0x5
+ && *(contents + rel->r_offset - 2) != 0x8d)
{
if (bfd_link_pic (info))
{
/* For PIC, disallow R_386_GOT32 without a base
- register since we don't know what the GOT base
- is. */
+ register, except for "lea foo@GOT, %reg", since
+ we don't know what the GOT base is. */
const char *name;
disallow_got32: