OSDN Git Service

[PATCH] Do not use dummy bfd suffix for recognition, make it human-readable instead.
authordavek <davek>
Thu, 10 Mar 2011 19:22:24 +0000 (19:22 +0000)
committerdavek <davek>
Thu, 10 Mar 2011 19:22:24 +0000 (19:22 +0000)
ld/ChangeLog:

2011-03-10  Dave Korn  <dave.korn.cygwin@gmail.com>

* plugin.c (IRONLY_SUFFIX): Revise to nicely human-readable form.
(IRONLY_SUFFIX_LEN): Delete.
(plugin_get_ir_dummy_bfd): Don't append IRONLY_SUFFIX.
(is_ir_dummy_bfd): Don't look for suffix; check claimed flag of
enclosing lang input statement instead.

ld/ChangeLog
ld/plugin.c

index d3c5235..0fdbd41 100644 (file)
@@ -1,5 +1,13 @@
 2011-03-10  Dave Korn  <dave.korn.cygwin@gmail.com>
 
+       * plugin.c (IRONLY_SUFFIX): Revise to nicely human-readable form.
+       (IRONLY_SUFFIX_LEN): Delete.
+       (plugin_get_ir_dummy_bfd): Don't append IRONLY_SUFFIX.
+       (is_ir_dummy_bfd): Don't look for suffix; check claimed flag of
+       enclosing lang input statement instead.
+
+2011-03-10  Dave Korn  <dave.korn.cygwin@gmail.com>
+
        * emultempl/pe.em (gld_${EMULATION_NAME}_place_orphan): Preserve
        alignment of input sections when creating orphan output sections
        during relocatable link.
index a68aea3..2fd8291 100644 (file)
@@ -41,12 +41,8 @@ bfd_boolean report_plugin_symbols;
 
 /* The suffix to append to the name of the real (claimed) object file
    when generating a dummy BFD to hold the IR symbols sent from the
-   plugin.  */
-#define IRONLY_SUFFIX          ".ironly\004"
-
-/* This is sizeof an array of chars, not sizeof a const char *.  We
-   also have to avoid inadvertently counting the trailing NUL.  */
-#define IRONLY_SUFFIX_LEN      (sizeof (IRONLY_SUFFIX) - 1)
+   plugin.  For cosmetic use only; appears in maps, crefs etc.  */
+#define IRONLY_SUFFIX " (symbol from plugin)"
 
 /* Stores a single argument passed to a plugin.  */
 typedef struct plugin_arg
@@ -253,14 +249,14 @@ plugin_get_ir_dummy_bfd (const char *name, bfd *srctemplate)
 static bfd_boolean
 is_ir_dummy_bfd (const bfd *abfd)
 {
-  size_t namlen;
-
-  if (abfd == NULL)
-    return FALSE;
-  namlen = strlen (abfd->filename);
-  if (namlen < IRONLY_SUFFIX_LEN)
-    return FALSE;
-  return !strcmp (abfd->filename + namlen - IRONLY_SUFFIX_LEN, IRONLY_SUFFIX);
+  /* ABFD can sometimes legitimately be NULL, e.g. when called from one
+     of the linker callbacks for a symbol in the *ABS* or *UND* sections.
+     Likewise, the usrdata field may be NULL if ABFD was added by the
+     backend without a corresponding input statement, as happens e.g.
+     when processing DT_NEEDED dependencies.  */
+  return abfd
+        && abfd->usrdata
+        && ((lang_input_statement_type *)(abfd->usrdata))->claimed;
 }
 
 /* Helpers to convert between BFD and GOLD symbol formats.  */