summaryrefslogtreecommitdiff
path: root/bfd/bfd-in2.h
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2005-05-03 17:05:51 +0000
committerAlan Modra <amodra@bigpond.net.au>2005-05-03 17:05:51 +0000
commitb5b2c246e49ab830e0488aef3cfe9b873ec60d22 (patch)
tree7b55510133c57fa41d22683a5f8ff4f099f585a0 /bfd/bfd-in2.h
parent35a98770d34892d92bb0b248e34ab378ac0723f9 (diff)
downloadgdb-b5b2c246e49ab830e0488aef3cfe9b873ec60d22.tar.gz
* section.c (bfd_section_list_remove): Don't clear s->next.
(bfd_section_list_append): Always init s->prev. (bfd_section_list_prepend): Define. (bfd_section_list_insert_after): Minor optimization. (bfd_section_removed_from_list): Rewrite. * elf.c (assign_section_numbers): Simplify list traversal now that bfd_section_list_remove doesn't destroy removed section next ptr. * sunos.c (sunos_add_dynamic_symbols): Likewise. * elfxx-ia64.c (elfNN_ia64_object_p): Use bfd_section_list_prepend. * xcofflink.c (_bfd_xcoff_bfd_final_link): Simplify list traversal. * bfd-in2.h: Regenerate.
Diffstat (limited to 'bfd/bfd-in2.h')
-rw-r--r--bfd/bfd-in2.h33
1 files changed, 26 insertions, 7 deletions
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 545e4427634..944a33a1a39 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -1451,10 +1451,7 @@ extern const struct bfd_symbol * const bfd_ind_symbol;
else \
(ABFD)->sections = _next; \
if (_next) \
- { \
- _next->prev = _prev; \
- _s->next = NULL; \
- } \
+ _next->prev = _prev; \
else \
(ABFD)->section_last = _prev; \
} \
@@ -1471,10 +1468,32 @@ extern const struct bfd_symbol * const bfd_ind_symbol;
_abfd->section_last->next = _s; \
} \
else \
- _abfd->sections = _s; \
+ { \
+ _s->prev = NULL; \
+ _abfd->sections = _s; \
+ } \
_abfd->section_last = _s; \
} \
while (0)
+#define bfd_section_list_prepend(ABFD, S) \
+ do \
+ { \
+ asection *_s = S; \
+ bfd *_abfd = ABFD; \
+ _s->prev = NULL; \
+ if (_abfd->sections) \
+ { \
+ _s->next = _abfd->sections; \
+ _abfd->sections->prev = _s; \
+ } \
+ else \
+ { \
+ _s->next = NULL; \
+ _abfd->section_last = _s; \
+ } \
+ _abfd->sections = _s; \
+ } \
+ while (0)
#define bfd_section_list_insert_after(ABFD, A, S) \
do \
{ \
@@ -1485,7 +1504,7 @@ extern const struct bfd_symbol * const bfd_ind_symbol;
_s->prev = _a; \
_a->next = _s; \
if (_next) \
- _s->next->prev = _s; \
+ _next->prev = _s; \
else \
(ABFD)->section_last = _s; \
} \
@@ -1506,7 +1525,7 @@ extern const struct bfd_symbol * const bfd_ind_symbol;
} \
while (0)
#define bfd_section_removed_from_list(ABFD, S) \
- ((S)->next == NULL && (S) != (ABFD)->section_last)
+ ((S)->next == NULL ? (ABFD)->section_last != (S) : (S)->next->prev != (S))
void bfd_section_list_clear (bfd *);