diff options
author | Alan Modra <amodra@gmail.com> | 2004-04-15 02:55:20 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2004-04-15 02:55:20 +0000 |
commit | 15b43f483cb30a12d97cbc8d10465e130dd92de6 (patch) | |
tree | 42cf7b2471b3a040fa52feebeae7191cf3208963 /bfd/elflink.c | |
parent | a4b6e8f6a466006ecc37ba4965a80aace7d434c2 (diff) | |
download | gdb-15b43f483cb30a12d97cbc8d10465e130dd92de6.zip gdb-15b43f483cb30a12d97cbc8d10465e130dd92de6.tar.gz gdb-15b43f483cb30a12d97cbc8d10465e130dd92de6.tar.bz2 |
* elflink.c (_bfd_elf_merge_symbol): Treat weak as strong only
when it is a definition.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r-- | bfd/elflink.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c index 4c27f88..6628db3 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 |