This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb/binutils-2_25-branch] Correct logic for "defined by object"
- From: Alan Modra <amodra at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 11 Feb 2015 12:50:50 -0000
- Subject: [binutils-gdb/binutils-2_25-branch] Correct logic for "defined by object"
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=dc0c7300d32be5d2b696e08cb835a1714dcd44be
commit dc0c7300d32be5d2b696e08cb835a1714dcd44be
Author: Alan Modra <amodra@gmail.com>
Date: Mon Dec 22 14:43:49 2014 +1030
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.
Diff:
---
ld/ChangeLog | 3 +++
ld/ldexp.c | 8 ++++----
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 2c006f9..2896965 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -2,6 +2,9 @@
Apply from master.
2014-12-23 Alan Modra <amodra@gmail.com>
+ * ldexp.c (update_definedness): Correct logic setting by_object.
+
+ 2014-12-23 Alan Modra <amodra@gmail.com>
* ldexp.c (struct definedness_hash_entry, definedness_table)
(definedness_newfunc, symbol_defined, update_definedness): Move
and rename from..
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;