aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1999-08-09 05:42:31 +0000
committerIan Lance Taylor <ian@airs.com>1999-08-09 05:42:31 +0000
commit91d3970e7deae6622b5b13cdb5367c4bd91b706c (patch)
tree91ea137f9ebdbb41b9ed626e7c7c8ed17f83f007 /bfd
parent75cd796a724c93df977df90b9fa8ebc448265c4a (diff)
downloadgdb-91d3970e7deae6622b5b13cdb5367c4bd91b706c.zip
gdb-91d3970e7deae6622b5b13cdb5367c4bd91b706c.tar.gz
gdb-91d3970e7deae6622b5b13cdb5367c4bd91b706c.tar.bz2
1999-08-09 Geoff Keating <geoffk@cygnus.com>
* elflink.h (elf_link_output_extsym): Don't output a weak reference to an undefined symbol just because it was defined weak in a shared object.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elflink.h17
2 files changed, 19 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 46e8c26..7b81796 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+1999-08-09 Geoff Keating <geoffk@cygnus.com>
+
+ * elflink.h (elf_link_output_extsym): Don't output a weak
+ reference to an undefined symbol just because it was defined weak
+ in a shared object.
+
1999-08-09 Eli Zaretskii <eliz@is.elta.co.il>
* coffgen.c (coff_find_nearest_line): When looking for file, use
diff --git a/bfd/elflink.h b/bfd/elflink.h
index 7b3a417..60de241 100644
--- a/bfd/elflink.h
+++ b/bfd/elflink.h
@@ -4840,14 +4840,23 @@ elf_link_output_extsym (h, data)
/* If we are marking the symbol as undefined, and there are no
non-weak references to this symbol from a regular object, then
- mark the symbol as weak undefined. We can't do this earlier,
+ mark the symbol as weak undefined; if there are non-weak
+ references, mark the symbol as strong. We can't do this earlier,
because it might not be marked as undefined until the
finish_dynamic_symbol routine gets through with it. */
if (sym.st_shndx == SHN_UNDEF
- && sym.st_info == ELF_ST_INFO (STB_GLOBAL, h->type)
&& (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) != 0
- && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR_NONWEAK) == 0)
- sym.st_info = ELF_ST_INFO (STB_WEAK, h->type);
+ && (ELF_ST_BIND(sym.st_info) == STB_GLOBAL
+ || ELF_ST_BIND(sym.st_info) == STB_WEAK))
+ {
+ int bindtype;
+
+ if ((h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR_NONWEAK) != 0)
+ bindtype = STB_GLOBAL;
+ else
+ bindtype = STB_WEAK;
+ sym.st_info = ELF_ST_INFO (bindtype, ELF_ST_TYPE (sym.st_info));
+ }
/* If this symbol should be put in the .dynsym section, then put it
there now. We have already know the symbol index. We also fill