summaryrefslogtreecommitdiff
path: root/bfd/opncls.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2010-10-25 06:14:29 +0000
committerAlan Modra <amodra@bigpond.net.au>2010-10-25 06:14:29 +0000
commit17a8c93a46b89a6e8a25090ee093e5f7f87b312a (patch)
treee491b239d207e2f5659e11c760a913dc2ca02cf4 /bfd/opncls.c
parentd9df8f96690f7b1df47d9fa27870645c8b76696c (diff)
downloadbinutils-redhat-17a8c93a46b89a6e8a25090ee093e5f7f87b312a.tar.gz
* 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.
Diffstat (limited to 'bfd/opncls.c')
-rw-r--r--bfd/opncls.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/bfd/opncls.c b/bfd/opncls.c
index 79c3274bcc..d6d645237e 100644
--- a/bfd/opncls.c
+++ b/bfd/opncls.c
@@ -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.
@@ -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 *