* opncls.c (_bfd_id_counter): Rename to bfd_id_counter.
authorAlan Modra <amodra@gmail.com>
Mon, 25 Oct 2010 06:14:30 +0000 (06:14 +0000)
committerAlan Modra <amodra@gmail.com>
Mon, 25 Oct 2010 06:14:30 +0000 (06:14 +0000)
(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.

bfd/ChangeLog
bfd/bfd-in2.h
bfd/opncls.c

index f5749a9ace3d568fa77364fcdc45debb01ef75ef..78d93268e8b0bd2d460340315791ae4b5baba376 100644 (file)
@@ -1,3 +1,11 @@
+2010-10-25  Alan Modra  <amodra@gmail.com>
+
+       * 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.
+
 2010-10-22  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        * elfxx-sparc.c (tpoff): Define bed, static_tls_size.
index 4bd47caeb817df96523e2463c1402d911a44b185..b1228e8d4b8bec8159aaf67e7a32f62b301d8f86 100644 (file)
@@ -964,6 +964,7 @@ extern struct coff_comdat_info *bfd_coff_get_comdat_section
 void bfd_init (void);
 
 /* Extracted from opncls.c.  */
+extern unsigned int bfd_use_reserved_id;
 bfd *bfd_fopen (const char *filename, const char *target,
     const char *mode, int fd);
 
index 79c3274bcc107deb5812c80b43750978aa3664a6..d6d645237e90d439b75bb0827d326ff5c9ac401c 100644 (file)
@@ -1,6 +1,6 @@
 /* opncls.c -- open and close a BFD.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000,
-   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
    Free Software Foundation, Inc.
 
    Written by Cygnus Support.
 #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 *
This page took 0.033722 seconds and 4 git commands to generate.