section indices for special sections
Tom Tromey
tromey@redhat.com
Wed Jan 2 19:11:00 GMT 2013
I was hoping to use the BFD section index in gdb to identify a section,
to remove some redundant information from symbols and also shrink their
size.
However, I discovered that the various special sections like *ABS* are
global, not per-BFD, and their 'index' fields are not useful.
I wonder what you think of the appended patch. It gives negative
indices to these special sections. If it seems ok I would either have
gdb look at the size of the std_section array, or introduce a new define
so gdb can know how many special sections to expect.
I regression tested this against ld, gas, and binutils, but not gdb.
I suspect it may have issues there, so I would only want to apply it
after finishing my gdb patch series and testing this.
Tom
* section.c (BFD_FAKE_SECTION): Set 'index' field.
* bfd-in2.h: Rebuild.
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index ceacf8f..a5ff702 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -1693,7 +1693,7 @@ extern asection _bfd_std_section[4];
#define BFD_FAKE_SECTION(SEC, FLAGS, SYM, NAME, IDX) \
/* name, id, index, next, prev, flags, user_set_vma, */ \
- { NAME, IDX, 0, NULL, NULL, FLAGS, 0, \
+ { NAME, IDX, - IDX - 1, NULL, NULL, FLAGS, 0, \
\
/* linker_mark, linker_has_input, gc_mark, decompress_status, */ \
0, 0, 1, 0, \
diff --git a/bfd/section.c b/bfd/section.c
index a59bc71..6a417d1 100644
--- a/bfd/section.c
+++ b/bfd/section.c
@@ -663,7 +663,7 @@ CODE_FRAGMENT
.
.#define BFD_FAKE_SECTION(SEC, FLAGS, SYM, NAME, IDX) \
. {* name, id, index, next, prev, flags, user_set_vma, *} \
-. { NAME, IDX, 0, NULL, NULL, FLAGS, 0, \
+. { NAME, IDX, - IDX - 1, NULL, NULL, FLAGS, 0, \
. \
. {* linker_mark, linker_has_input, gc_mark, decompress_status, *} \
. 0, 0, 1, 0, \
--
1.7.7.6
More information about the Binutils
mailing list