diff options
author | Ian Lance Taylor <ian@airs.com> | 1996-08-11 03:39:46 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1996-08-11 03:39:46 +0000 |
commit | 4596421b6715cf00d2630e4b3d8372278b42d7d1 (patch) | |
tree | ca68ae48b61e1d87708faeb7de8b9a82932cf589 /bfd | |
parent | f494d50348ac1e18c32def4e94703ee5d7eb61bc (diff) | |
download | gdb-4596421b6715cf00d2630e4b3d8372278b42d7d1.zip gdb-4596421b6715cf00d2630e4b3d8372278b42d7d1.tar.gz gdb-4596421b6715cf00d2630e4b3d8372278b42d7d1.tar.bz2 |
* elflink.h (elf_link_add_object_symbols): Do not resolve a common
symbol against a STT_FUNC symbol in a shared library.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 5 | ||||
-rw-r--r-- | bfd/elflink.h | 19 |
2 files changed, 21 insertions, 3 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index b185f7d..c0cc316 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -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> * xcofflink.c (xcoff_link_add_dynamic_symbols): If a descriptor diff --git a/bfd/elflink.h b/bfd/elflink.h index 04ef289..27398a4 100644 --- a/bfd/elflink.h +++ b/bfd/elflink.h @@ -679,17 +679,25 @@ elf_link_add_object_symbols (abfd, info) by some other object. If it has, we want to use the existing definition, and we do not want to report a 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 (h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak || (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; definition = false; 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 object in the link. */ 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_defweak) && (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.u.undef.abfd = h->root.u.def.section->owner; size_change_ok = true; + if (bfd_is_com_section (sec)) + type_change_ok = true; } } |