summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2004-04-16 03:44:35 +0000
committerAlan Modra <amodra@bigpond.net.au>2004-04-16 03:44:35 +0000
commit94257ed064240665bce5ed15d239ab96264b374b (patch)
treee929c10c1e62cc87a32cb93869cc23b6be46f546
parentb074c8ff7c5ea5a44e108cad06a878d2fecef9b7 (diff)
downloadgdb-94257ed064240665bce5ed15d239ab96264b374b.tar.gz
* elflink.c (_bfd_elf_merge_symbol): Treat weak as strong only
when it is a definition.
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elflink.c22
2 files changed, 18 insertions, 9 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index ddf44d3d788..a895cf82235 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2004-04-16 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elflink.c (_bfd_elf_merge_symbol): Treat weak as strong only
+ when it is a definition.
+
2004-04-16 Alan Modra <amodra@bigpond.net.au>
* elf32-sparc.c (elf32_sparc_relocate_section): Don't abort
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 4c27f8840e6..6628db34cce 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -887,16 +887,20 @@ _bfd_elf_merge_symbol (bfd *abfd,
oldweak = (h->root.type == bfd_link_hash_defweak
|| h->root.type == bfd_link_hash_undefweak);
- /* If a new weak symbol comes from a regular file and the old symbol
- comes from a dynamic library, we treat the new one as strong.
- Similarly, an old weak symbol from a regular file is treated as
- strong when the new symbol comes from a dynamic library. Further,
- an old weak symbol from a dynamic library is treated as strong if
- the new symbol is from a dynamic library. This reflects the way
- glibc's ld.so works. */
- if (!newdyn && olddyn)
+ /* If a new weak symbol definition comes from a regular file and the
+ old symbol comes from a dynamic library, we treat the new one as
+ strong. Similarly, an old weak symbol definition from a regular
+ file is treated as strong when the new symbol comes from a dynamic
+ library. Further, an old weak symbol from a dynamic library is
+ treated as strong if the new symbol is from a dynamic library.
+ This reflects the way glibc's ld.so works.
+
+ Do this before setting *type_change_ok or *size_change_ok so that
+ we warn properly when dynamic library symbols are overridden. */
+
+ if (newdef && !newdyn && olddyn)
newweak = FALSE;
- if (newdyn)
+ if (olddef && newdyn)
oldweak = FALSE;
/* It's OK to change the type if either the existing symbol or the