This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: PR ld/12277: Linker error: "final link failed: Nonrepresentable section on output"


On 01/02/2011 23:18, Dave Korn wrote:
> On 01/02/2011 23:11, Dave Korn wrote:
> 
>>   I need to see what we're doing with the BFD usrdata field.  A quick grep
>> suggests it points to the input statement, which if it can be relied on will
>> entirely obviate the need for either the suffix or an extra flag in BFD.
> 
>   No, or not directly, anyway; it isn't set early enough.

  Actually, I spoke too soon.  It gets set when load_symbols calls
ldlang_add_file, which happens before the actual call to bfd_link_add_symbols,
so I think it should be safe.  Was going to send this in along with the rest
of the patches as a bundle later, but here's a preview.

    cheers,
      DaveK

>From fc7521535ba78da4c5601fe98cb5b2409f61f352 Mon Sep 17 00:00:00 2001
From: Dave Korn <dave.korn.cygwin@gmail.com>
Date: Wed, 2 Feb 2011 04:11:59 +0000
Subject: [PATCH] ld/ChangeLog:

2011-02-01  Dave Korn  <...

	* plugin.c (IRONLY_SUFFIX): Delete.
	(IRONLY_SUFFIX_LEN): Likewise.
	(plugin_get_ir_dummy_bfd): Don't append IRONLY_SUFFIX.
	(is_ir_dummy_bfd): Don't look for it; check claimed flag of enclosing
	lang input statement instead.
---
 ld/plugin.c |   23 ++++-------------------
 1 files changed, 4 insertions(+), 19 deletions(-)

diff --git a/ld/plugin.c b/ld/plugin.c
index cd8aeb9..e6cc436 100644
--- a/ld/plugin.c
+++ b/ld/plugin.c
@@ -36,15 +36,6 @@
 #include <Windows.h>
 #endif
 
-/* 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)
-
 /* Stores a single argument passed to a plugin.  */
 typedef struct plugin_arg
 {
@@ -236,8 +227,7 @@ plugin_get_ir_dummy_bfd (const char *name, bfd *srctemplate)
   bfd *abfd;
 
   bfd_use_reserved_id = 1;
-  abfd = bfd_create (concat (name, IRONLY_SUFFIX, (const char *)NULL),
-		     srctemplate);
+  abfd = bfd_create (name, srctemplate);
   bfd_set_arch_info (abfd, bfd_get_arch_info (srctemplate));
   bfd_make_writable (abfd);
   bfd_copy_private_bfd_data (srctemplate, abfd);
@@ -256,14 +246,9 @@ plugin_get_ir_dummy_bfd (const char *name, bfd *srctemplate)
 static bfd_boolean
 is_ir_dummy_bfd (const bfd *abfd)
 {
-  size_t namlen;
+  ASSERT(abfd->usrdata);
+  return ((lang_input_statement_type *)(abfd->usrdata))->claimed;
 
-  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);
 }
 
 /* Helpers to convert between BFD and GOLD symbol formats.  */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]