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: mips and frv testsuite failures after plugin patch


On Mon, Oct 25, 2010 at 07:20:37AM +0100, Dave Korn wrote:
>   Urgh.  Any other targets?  A quick grep suggests bfin and m68k might be
> affected too.

Yep.

m68k-linux  +FAIL: ld-m68k/got-multigot-12-13-14-34-35-ok
m68k-linux  +FAIL: ld-m68k/got-xgot-12-13-14-15-34-35-ok

>   Groan.  Would it be suitable to update the testcases so they match the new
> order of outputs?

No, that won't work because you made the plugin support conditional.

>   ... oooooor, I could make _bfd_delete_bfd decrement the _bfd_id_counter when
> it notices we're deleting the last-created BFD?  Hmm, I like that idea.  It
> seems a lot simpler.  There shouldn't be any problem with the notion of
> speculatively allocating an ID and then recycling it immediately (at any rate,
> before any other IDs are allocated).

Or this.

bfd/
	* opncls.c (_bfd_id_counter): Rename to bfd_id_counter.
	(bfd_reserved_id_counter, bfd_use_reserved_id): New vars.
	(_bfd_new_bfd): Use negative id when bfd_use_reserved_id.
	(bfd_create): Doc fix.
	* bfd-in2.h: Regenerate.
ld/
	* plugin.c (plugin_get_ir_dummy_bfd): Set bfd_use_reserved_id.
	Formatting.

Index: bfd/opncls.c
===================================================================
RCS file: /cvs/src/src/bfd/opncls.c,v
retrieving revision 1.64
diff -u -p -r1.64 opncls.c
--- bfd/opncls.c	26 May 2010 07:37:36 -0000	1.64
+++ bfd/opncls.c	25 Oct 2010 04:56:54 -0000
@@ -38,9 +38,17 @@
 #define S_IXOTH 0001	/* Execute by others.  */
 #endif
 
-/* Counter used to initialize the bfd identifier.  */
+/* Counters used to initialize the bfd identifier.  */
 
-static unsigned int _bfd_id_counter = 0;
+static unsigned int bfd_id_counter = 0;
+static unsigned int bfd_reserved_id_counter = 0;
+
+/*
+CODE_FRAGMENT
+.{* Set to N to open the next N BFDs using an alternate id space.  *}
+.extern unsigned int bfd_use_reserved_id;
+*/
+unsigned int bfd_use_reserved_id = 0;
 
 /* fdopen is a loser -- we should use stdio exclusively.  Unfortunately
    if we do that we can't use fcntl.  */
@@ -56,7 +64,13 @@ _bfd_new_bfd (void)
   if (nbfd == NULL)
     return NULL;
 
-  nbfd->id = _bfd_id_counter++;
+  if (bfd_use_reserved_id)
+    {
+      nbfd->id = --bfd_reserved_id_counter;
+      --bfd_use_reserved_id;
+    }
+  else
+    nbfd->id = bfd_id_counter++;
 
   nbfd->memory = objalloc_create ();
   if (nbfd->memory == NULL)
@@ -753,7 +767,7 @@ SYNOPSIS
 DESCRIPTION
 	Create a new BFD in the manner of <<bfd_openw>>, but without
 	opening a file. The new BFD takes the target from the target
-	used by @var{template}. The format is always set to <<bfd_object>>.
+	used by @var{templ}. The format is always set to <<bfd_object>>.
 */
 
 bfd *
Index: ld/plugin.c
===================================================================
RCS file: /cvs/src/src/ld/plugin.c,v
retrieving revision 1.4
diff -u -p -r1.4 plugin.c
--- ld/plugin.c	20 Oct 2010 17:01:05 -0000	1.4
+++ ld/plugin.c	25 Oct 2010 04:57:23 -0000
@@ -224,16 +224,18 @@ bfd *
 plugin_get_ir_dummy_bfd (const char *name, bfd *srctemplate)
 {
   asection *sec;
-  bfd *abfd = bfd_create (
-		concat (name, IRONLY_SUFFIX, (const char *)NULL),
-		srctemplate);
+  bfd *abfd;
+
+  bfd_use_reserved_id = 1;
+  abfd = bfd_create (concat (name, IRONLY_SUFFIX, (const char *)NULL),
+		     srctemplate);
   bfd_set_arch_info (abfd, bfd_get_arch_info (srctemplate));
   bfd_make_writable (abfd);
   /* Create a minimal set of sections to own the symbols.  */
   sec = bfd_make_section_old_way (abfd, ".text");
   bfd_set_section_flags (abfd, sec,
-	SEC_CODE | SEC_HAS_CONTENTS | SEC_READONLY
-	| SEC_ALLOC | SEC_LOAD | SEC_KEEP);
+			 (SEC_CODE | SEC_HAS_CONTENTS | SEC_READONLY
+			  | SEC_ALLOC | SEC_LOAD | SEC_KEEP));
   sec->output_section = sec;
   sec->output_offset = 0;
   return abfd;

-- 
Alan Modra
Australia Development Lab, IBM


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