public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* section ids
@ 2000-07-09 19:16 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2000-07-09 19:16 UTC (permalink / raw)
  To: binutils

I've checked in the following patch to make the section sequence ids
non-negative for the standard sections.  There wasn't really anything
wrong with the original scheme, but this way is a little more logical, and
may avoid future surprises (eg. sprintf %x printing lots of digits and
overflowing buffers)

Alan Modra
-- 
Linuxcare.  Support for the Revolution.

bfd/ChangeLog
	* section.c (bfd_make_section_anyway): Start section_id at 0x10.
	(STD_SECTION): Avoid negative ids, instead use 0 to 3.

--- section.c	2000/07/08 12:08:43	1.15
+++ section.c	2000/07/10 02:01:23
@@ -552,8 +552,8 @@ static const asymbol global_syms[] =
 #define STD_SECTION(SEC, FLAGS, SYM, NAME, IDX)	\
   const asymbol * const SYM = (asymbol *) &global_syms[IDX]; \
   const asection SEC = \
-    /* name, id,       index, next, flags, user_set_vma, reloc_done, */	\
-    { NAME,  -1-(IDX), 0,     NULL, FLAGS, 0,            0,		\
+    /* name, id,  index, next, flags, user_set_vma, reloc_done,      */	\
+    { NAME,  IDX, 0,     NULL, FLAGS, 0,            0,			\
 									\
     /* linker_mark, gc_mark, vma, lma, _cooked_size, _raw_size,      */	\
        0,           0,       0,   0,   0,            0,			\
@@ -693,7 +693,7 @@ bfd_make_section_anyway (abfd, name)
      bfd *abfd;
      const char *name;
 {
-  static int section_id = 0;
+  static int section_id = 0x10;  /* id 0 to 3 used by STD_SECTION.  */
   asection *newsect;
   asection **prev = &abfd->sections;
   asection *sect = abfd->sections;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-07-09 19:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-07-09 19:16 section ids Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).