* elflink.h (elf_link_add_object_symbols): Do not resolve a common

symbol against a STT_FUNC symbol in a shared library.
This commit is contained in:
Ian Lance Taylor
1996-08-11 03:39:46 +00:00
parent f494d50348
commit 4596421b67
2 changed files with 21 additions and 3 deletions

View File

@ -1,3 +1,8 @@
Sat Aug 10 22:59:17 1996 Ian Lance Taylor <ian@cygnus.com>
* elflink.h (elf_link_add_object_symbols): Do not resolve a common
symbol against a STT_FUNC symbol in a shared library.
Fri Aug 9 12:44:57 1996 Ian Lance Taylor <ian@cygnus.com> Fri Aug 9 12:44:57 1996 Ian Lance Taylor <ian@cygnus.com>
* xcofflink.c (xcoff_link_add_dynamic_symbols): If a descriptor * xcofflink.c (xcoff_link_add_dynamic_symbols): If a descriptor

View File

@ -679,17 +679,25 @@ elf_link_add_object_symbols (abfd, info)
by some other object. If it has, we want to use the by some other object. If it has, we want to use the
existing definition, and we do not want to report a existing definition, and we do not want to report a
multiple symbol definition error; we do this by multiple symbol definition error; we do this by
clobbering sec to be bfd_und_section_ptr. */ clobbering sec to be bfd_und_section_ptr. We treat a
common symbol as a definition if the symbol in the shared
library is a function, since common symbols always
represent variables; this can cause confusion in
principle, but any such confusion would seem to indicate
an erroneous program or shared library. */
if (dynamic && definition) if (dynamic && definition)
{ {
if (h->root.type == bfd_link_hash_defined if (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak || h->root.type == bfd_link_hash_defweak
|| (h->root.type == bfd_link_hash_common || (h->root.type == bfd_link_hash_common
&& bind == STB_WEAK)) && (bind == STB_WEAK
|| ELF_ST_TYPE (sym.st_info) == STT_FUNC)))
{ {
sec = bfd_und_section_ptr; sec = bfd_und_section_ptr;
definition = false; definition = false;
size_change_ok = true; size_change_ok = true;
if (h->root.type == bfd_link_hash_common)
type_change_ok = true;
} }
} }
@ -700,7 +708,10 @@ elf_link_add_object_symbols (abfd, info)
objects, even if they are defined after the dynamic objects, even if they are defined after the dynamic
object in the link. */ object in the link. */
if (! dynamic if (! dynamic
&& definition && (definition
|| (bfd_is_com_section (sec)
&& (h->root.type == bfd_link_hash_defweak
|| h->type == STT_FUNC)))
&& (h->root.type == bfd_link_hash_defined && (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak) || h->root.type == bfd_link_hash_defweak)
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
@ -715,6 +726,8 @@ elf_link_add_object_symbols (abfd, info)
h->root.type = bfd_link_hash_undefined; h->root.type = bfd_link_hash_undefined;
h->root.u.undef.abfd = h->root.u.def.section->owner; h->root.u.undef.abfd = h->root.u.def.section->owner;
size_change_ok = true; size_change_ok = true;
if (bfd_is_com_section (sec))
type_change_ok = true;
} }
} }