Apply Philip Blundell's patch to prevent range checks on weak symbols.
This commit is contained in:
parent
2f66722d55
commit
59f2c4e703
2 changed files with 24 additions and 10 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
1999-09-13 Philip Blundell <pb@nexus.co.uk>
|
||||||
|
|
||||||
|
* elf32-arm.h (elf32_arm_final_link_relocate): Don't range-check
|
||||||
|
PC24 relocs if the target is an undefined weak symbol.
|
||||||
|
(arm_add_to_rel): Fix compiler warning.
|
||||||
|
(elf32_arm_plt0_entry): Correct comments.
|
||||||
|
|
||||||
1999-09-13 Alan Modra <alan@spri.levels.unisa.edu.au>
|
1999-09-13 Alan Modra <alan@spri.levels.unisa.edu.au>
|
||||||
|
|
||||||
* elfcode.h (write_relocs): Check for the_bfd NULL when handling
|
* elfcode.h (write_relocs): Check for the_bfd NULL when handling
|
||||||
|
|
|
@ -81,7 +81,7 @@ static int elf32_thumb_to_arm_stub
|
||||||
|
|
||||||
/* The first entry in a procedure linkage table looks like
|
/* The first entry in a procedure linkage table looks like
|
||||||
this. It is set up so that any shared library function that is
|
this. It is set up so that any shared library function that is
|
||||||
called before the relocation has been set up calles the dynamic
|
called before the relocation has been set up calls the dynamic
|
||||||
linker first */
|
linker first */
|
||||||
|
|
||||||
static const bfd_byte elf32_arm_plt0_entry [PLT_ENTRY_SIZE] =
|
static const bfd_byte elf32_arm_plt0_entry [PLT_ENTRY_SIZE] =
|
||||||
|
@ -89,7 +89,7 @@ static const bfd_byte elf32_arm_plt0_entry [PLT_ENTRY_SIZE] =
|
||||||
0x04, 0xe0, 0x2d, 0xe5, /* str lr, [sp, #-4]! */
|
0x04, 0xe0, 0x2d, 0xe5, /* str lr, [sp, #-4]! */
|
||||||
0x10, 0xe0, 0x9f, 0xe5, /* ldr lr, [pc, #16] */
|
0x10, 0xe0, 0x9f, 0xe5, /* ldr lr, [pc, #16] */
|
||||||
0x0e, 0xe0, 0x8f, 0xe0, /* adr lr, pc, lr */
|
0x0e, 0xe0, 0x8f, 0xe0, /* adr lr, pc, lr */
|
||||||
0x08, 0xf0, 0xbe, 0xe5 /* ldr pc, [lr, #-4] */
|
0x08, 0xf0, 0xbe, 0xe5 /* ldr pc, [lr, #8]! */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Subsequent entries in a procedure linkage table look like
|
/* Subsequent entries in a procedure linkage table look like
|
||||||
|
@ -1229,12 +1229,19 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* It is not an error for an undefined weak reference to be
|
||||||
|
out of range. Any program that branches to such a symbol
|
||||||
|
is going to crash anyway, so there is no point worrying
|
||||||
|
about getting the destination exactly right. */
|
||||||
|
if (! h || h->root.type != bfd_link_hash_undefweak)
|
||||||
|
{
|
||||||
/* Perform a signed range check. */
|
/* Perform a signed range check. */
|
||||||
signed_addend = value;
|
signed_addend = value;
|
||||||
signed_addend >>= howto->rightshift;
|
signed_addend >>= howto->rightshift;
|
||||||
if (signed_addend > ((bfd_signed_vma)(howto->dst_mask >> 1))
|
if (signed_addend > ((bfd_signed_vma)(howto->dst_mask >> 1))
|
||||||
|| signed_addend < - ((bfd_signed_vma) ((howto->dst_mask + 1) >> 1)))
|
|| signed_addend < - ((bfd_signed_vma) ((howto->dst_mask + 1) >> 1)))
|
||||||
return bfd_reloc_overflow;
|
return bfd_reloc_overflow;
|
||||||
|
}
|
||||||
|
|
||||||
value = (signed_addend & howto->dst_mask)
|
value = (signed_addend & howto->dst_mask)
|
||||||
| (bfd_get_32 (input_bfd, hit_data) & (~ howto->dst_mask));
|
| (bfd_get_32 (input_bfd, hit_data) & (~ howto->dst_mask));
|
||||||
|
@ -1586,7 +1593,7 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
|
||||||
static void
|
static void
|
||||||
arm_add_to_rel (abfd, address, howto, increment)
|
arm_add_to_rel (abfd, address, howto, increment)
|
||||||
bfd * abfd;
|
bfd * abfd;
|
||||||
bfd_vma address;
|
bfd_byte * address;
|
||||||
reloc_howto_type * howto;
|
reloc_howto_type * howto;
|
||||||
bfd_signed_vma increment;
|
bfd_signed_vma increment;
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue