* elflink.h (elf_link_add_object_symbols): Only add a weak

symbol if the real definition is in the dynamic symbol table.
	After finding the real definition, then, if it is dynamic, add the
	weak symbol to the dynamic symbol table.
PR 11244.
This commit is contained in:
Ian Lance Taylor 1996-12-13 02:29:37 +00:00
parent 8dd6fde3e5
commit 440f391466
2 changed files with 20 additions and 4 deletions

View File

@ -5,6 +5,11 @@ Thu Dec 12 15:07:20 1996 Michael Meissner <meissner@tiktok.cygnus.com>
Thu Dec 12 14:55:41 1996 Ian Lance Taylor <ian@cygnus.com>
* elflink.h (elf_link_add_object_symbols): Only add a weak
symbol if the real definition is in the dynamic symbol table.
After finding the real definition, then, if it is dynamic, add the
weak symbol to the dynamic symbol table.
* coff-aux.c (coff_m68k_aux_link_add_one_symbol): Make static.
* ppcboot.c (ppcboot_set_arch_mach): Don't define; it's a

View File

@ -810,8 +810,7 @@ elf_link_add_object_symbols (abfd, info)
reference or definition we just found. Keep a count of
the number of dynamic symbols we find. A dynamic symbol
is one which is referenced or defined by both a regular
object and a shared object, or one which is referenced or
defined by more than one shared object. */
object and a shared object. */
old_flags = h->elf_link_hash_flags;
dynsym = false;
if (! dynamic)
@ -834,8 +833,8 @@ elf_link_add_object_symbols (abfd, info)
if ((old_flags & (ELF_LINK_HASH_DEF_REGULAR
| ELF_LINK_HASH_REF_REGULAR)) != 0
|| (h->weakdef != NULL
&& (old_flags & (ELF_LINK_HASH_DEF_DYNAMIC
| ELF_LINK_HASH_REF_DYNAMIC)) != 0))
&& ! new_weakdef
&& h->weakdef->dynindx != -1))
dynsym = true;
}
@ -912,6 +911,18 @@ elf_link_add_object_symbols (abfd, info)
goto error_return;
}
/* If the real definition is in the list of dynamic
symbols, make sure the weak definition is put there
as well. If we don't do this, then the dynamic
loader might not merge the entries for the real
definition and the weak definition. */
if (h->dynindx != -1
&& hlook->dynindx == -1)
{
if (! _bfd_elf_link_record_dynamic_symbol (info, hlook))
goto error_return;
}
break;
}
}