]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Correct logic for "defined by object"
authorAlan Modra <amodra@gmail.com>
Mon, 22 Dec 2014 04:13:49 +0000 (14:43 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 11 Feb 2015 12:36:39 +0000 (23:06 +1030)
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.

ld/ChangeLog
ld/ldexp.c

index 2c006f959da076429391b908cc13db9bea982402..2896965d6100f03fcce09c26e4205a8e76a6196a 100644 (file)
@@ -1,6 +1,9 @@
 2015-02-11  Alan Modra  <amodra@gmail.com>
 
        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
index 28289338decbde86ad356ff980835c084696a717..e9e95f9ddebdd5f5da6f472078a7c06c7df4fbfd 100644 (file)
@@ -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;