* elf32-i386.c (elf_i386_check_relocs <R_386_32, R_386_PC32>):

Ensure syms are dynamic if we might be emitting a reloc.
	(allocate_plt_and_got_and_discard_relocs): Don't discard relocs
	for undefweak or undefined syms..
	(elf_i386_relocate_section <R_386_32, R_386_PC32>): .. and emit.
This commit is contained in:
Alan Modra 2001-06-25 08:16:44 +00:00
parent 37ffda1076
commit 28d0b90eb7
2 changed files with 20 additions and 3 deletions

View file

@ -1,5 +1,11 @@
2001-06-25 Alan Modra <amodra@bigpond.net.au> 2001-06-25 Alan Modra <amodra@bigpond.net.au>
* elf32-i386.c (elf_i386_check_relocs <R_386_32, R_386_PC32>):
Ensure syms are dynamic if we might be emitting a reloc.
(allocate_plt_and_got_and_discard_relocs): Don't discard relocs
for undefweak or undefined syms..
(elf_i386_relocate_section <R_386_32, R_386_PC32>): .. and emit.
* elf32-i386.c (allocate_plt_and_got_and_discard_relocs): Discard * elf32-i386.c (allocate_plt_and_got_and_discard_relocs): Discard
relocs without ELF_LINK_HASH_DEF_DYNAMIC set. relocs without ELF_LINK_HASH_DEF_DYNAMIC set.
(elf_i386_relocate_section <R_386_32, R_386_PC32>): Remove (elf_i386_relocate_section <R_386_32, R_386_PC32>): Remove

View file

@ -725,6 +725,13 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
this reloc. */ this reloc. */
if (dynobj == NULL) if (dynobj == NULL)
htab->root.dynobj = dynobj = abfd; htab->root.dynobj = dynobj = abfd;
if (h != NULL && h->dynindx == -1)
{
if (! bfd_elf32_link_record_dynamic_symbol (info, h))
return false;
}
if (sreloc == NULL) if (sreloc == NULL)
{ {
const char *name; const char *name;
@ -1195,7 +1202,9 @@ allocate_plt_and_got_and_discard_relocs (h, inf)
|| (!info->shared || (!info->shared
&& (h->dynindx == -1 && (h->dynindx == -1
|| (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) != 0 || (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) != 0
|| (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0))) || ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0
&& h->root.type != bfd_link_hash_undefweak
&& h->root.type != bfd_link_hash_undefined))))
{ {
struct elf_i386_link_hash_entry *eh; struct elf_i386_link_hash_entry *eh;
struct elf_i386_dyn_relocs *c; struct elf_i386_dyn_relocs *c;
@ -1694,8 +1703,10 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
&& h != NULL && h != NULL
&& h->dynindx != -1 && h->dynindx != -1
&& (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 && (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
&& (h->elf_link_hash_flags && ((h->elf_link_hash_flags
& ELF_LINK_HASH_DEF_DYNAMIC) != 0)) & ELF_LINK_HASH_DEF_DYNAMIC) != 0
|| h->root.type == bfd_link_hash_undefweak
|| h->root.type == bfd_link_hash_undefined)))
{ {
Elf_Internal_Rel outrel; Elf_Internal_Rel outrel;
boolean skip, relocate; boolean skip, relocate;