aboutsummaryrefslogtreecommitdiff
path: root/ld/ldexp.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2014-12-22 14:43:49 +1030
committerAlan Modra <amodra@gmail.com>2014-12-23 23:36:50 +1030
commitcd8e2bcf0d51e91ab8da72ec63048790e3720b03 (patch)
tree74f3cf1905d6afcc5aba440f51b5ecb4d8e63a3a /ld/ldexp.c
parent18d6a79d3527acd718cc8acd9395d1bf4cc4ce0a (diff)
downloadgdb-cd8e2bcf0d51e91ab8da72ec63048790e3720b03.zip
gdb-cd8e2bcf0d51e91ab8da72ec63048790e3720b03.tar.gz
gdb-cd8e2bcf0d51e91ab8da72ec63048790e3720b03.tar.bz2
Correct logic for "defined by object"
The old code missed testing bfd_link_hash_undefweak, and wrongly excluded bfd_link_hash_common symbols. It is also clearer to invert the set of enum bfd_link_hash_type values tested. bfd_link_hash_indirect and bfd_link_hash_warning will never appear here. * ldexp.c (update_definedness): Correct logic setting by_object.
Diffstat (limited to 'ld/ldexp.c')
-rw-r--r--ld/ldexp.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ld/ldexp.c b/ld/ldexp.c
index 2828933..e9e95f9 100644
--- a/ld/ldexp.c
+++ b/ld/ldexp.c
@@ -304,11 +304,11 @@ update_definedness (const char *name, struct bfd_link_hash_entry *h)
einfo (_("%P%F: bfd_hash_lookup failed creating symbol %s\n"), name);
/* If the symbol was already defined, and not by a script, then it
- must be defined by an object file. */
+ must be defined by an object file or by the linker target code. */
if (!defentry->by_script
- && h->type != bfd_link_hash_undefined
- && h->type != bfd_link_hash_common
- && h->type != bfd_link_hash_new)
+ && (h->type == bfd_link_hash_defined
+ || h->type == bfd_link_hash_defweak
+ || h->type == bfd_link_hash_common))
defentry->by_object = 1;
defentry->by_script = 1;