summaryrefslogtreecommitdiff
path: root/bfd/bfd-in2.h
diff options
context:
space:
mode:
authorH.J. Lu <hjl@lucon.org>2005-05-03 01:05:03 +0000
committerH.J. Lu <hjl@lucon.org>2005-05-03 01:05:03 +0000
commita3a106724500f96c70f60a60d787a90a251544b9 (patch)
tree6bfeb774f70af99d2a5dae364a75bcc6ea5a1082 /bfd/bfd-in2.h
parent295788446b078c72b210f09efa132c819a8ba275 (diff)
downloadgdb-a3a106724500f96c70f60a60d787a90a251544b9.tar.gz
bfd/
2005-05-02 H.J. Lu <hongjiu.lu@intel.com> * bfd.c (bfd): Remove section_tail and add section_last. (bfd_preserve): Likewise. (bfd_preserve_save): Likewise. (bfd_preserve_restore): Likewise. * opncls.c (_bfd_new_bfd): Likewise. * coffcode.h (coff_compute_section_file_positions): Updated. (coff_compute_section_file_positions): Likewise. * elf.c (assign_section_numbers): Likewise. * elf32-i370.c (i370_elf_size_dynamic_sections): Likewise. * elf64-mmix.c (mmix_elf_final_link): Likewise. * elfxx-ia64.c (elfNN_ia64_object_p): Likewise. * elfxx-mips.c (_bfd_mips_elf_link_hash_table_create): Likewise. * sunos.c (sunos_add_dynamic_symbols): Likewise. * xcofflink.c (_bfd_xcoff_bfd_final_link): Likewise. * ecoff.c (bfd_debug_section): Initialize prev. * section.c (bfd_section): Add prev. (bfd_section_list_remove): Updated. (bfd_section_list_append): New. (bfd_section_list_insert_after): New. (bfd_section_list_insert_before): New. (bfd_section_list_insert): Removed. (bfd_section_removed_from_list): Updated. (STD_SECTION): Initialize prev. (bfd_section_init): Updated. (bfd_section_list_clear): Updated. * bfd-in2.h: Regenerated. gas/ 2005-05-02 H.J. Lu <hongjiu.lu@intel.com> * write.c (write_object_file): Use bfd_section_double_list_remove to remove sections. ld/ 2005-05-02 H.J. Lu <hongjiu.lu@intel.com> * emultempl/elf32.em (gld${EMULATION_NAME}_strip_empty_section): Updated for bfd_section_list_remove change. * ldlang.c (lang_insert_orphan): Likewise. (strip_excluded_output_sections): Likewise. (sort_sections_by_lma): New. (lang_check_section_addresses): Sort the sections before checking addresses.
Diffstat (limited to 'bfd/bfd-in2.h')
-rw-r--r--bfd/bfd-in2.h91
1 files changed, 75 insertions, 16 deletions
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index 1e373f28fc2..64a153fc339 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -1063,6 +1063,9 @@ typedef struct bfd_section
/* The next section in the list belonging to the BFD, or NULL. */
struct bfd_section *next;
+ /* The previous section in the list belonging to the BFD, or NULL. */
+ struct bfd_section *prev;
+
/* The field flags contains attributes of the section. Some
flags are read in from the object file, and some are
synthesized from other information. */
@@ -1437,31 +1440,87 @@ extern const struct bfd_symbol * const bfd_ind_symbol;
/* Macros to handle insertion and deletion of a bfd's sections. These
only handle the list pointers, ie. do not adjust section_count,
target_index etc. */
+#define bfd_section_double_list_remove(ABFD, S) \
+ do \
+ { \
+ asection *_s = S; \
+ asection *_next = _s->next; \
+ asection *_prev = _s->prev; \
+ if (_prev) \
+ _prev->next = _next; \
+ else \
+ (ABFD)->sections = _next; \
+ if (_next) \
+ { \
+ _next->prev = _prev; \
+ _s->next = NULL; \
+ } \
+ else \
+ (ABFD)->section_last = _prev; \
+ } \
+ while (0)
#define bfd_section_list_remove(ABFD, PS) \
+ bfd_section_double_list_remove ((ABFD), *(PS))
+#define bfd_section_double_list_append(ABFD, S) \
+ do \
+ { \
+ asection *_s = S; \
+ bfd *_abfd = ABFD; \
+ _s->next = NULL; \
+ if (_abfd->section_last) \
+ { \
+ _s->prev = _abfd->section_last; \
+ _abfd->section_last->next = _s; \
+ } \
+ else \
+ _abfd->sections = _s; \
+ _abfd->section_last = _s; \
+ } \
+ while (0)
+#define bfd_section_double_list_insert_after(ABFD, A, S) \
do \
{ \
- asection **_ps = PS; \
- asection *_s = *_ps; \
- *_ps = _s->next; \
- if (_s->next == NULL) \
- (ABFD)->section_tail = _ps; \
+ asection *_a = A; \
+ asection *_s = S; \
+ if (_a) \
+ { \
+ asection *_next = _a->next; \
+ _s->next = _next; \
+ _s->prev = _a; \
+ _a->next = _s; \
+ if (_next) \
+ _s->next->prev = _s; \
+ else \
+ (ABFD)->section_last = _s; \
+ } \
else \
- _s->next = NULL; \
+ bfd_section_double_list_append ((ABFD), (S)); \
} \
while (0)
-#define bfd_section_list_insert(ABFD, PS, S) \
+#define bfd_section_double_list_insert_before(ABFD, B, S) \
do \
{ \
- asection **_ps = PS; \
+ asection *_b = B; \
asection *_s = S; \
- _s->next = *_ps; \
- *_ps = _s; \
- if (_s->next == NULL) \
- (ABFD)->section_tail = &_s->next; \
+ if (_b) \
+ { \
+ asection *_prev = _b->prev; \
+ _s->prev = _prev; \
+ _s->next = _b; \
+ _b->prev = _s; \
+ if (_prev) \
+ _prev->next = _s; \
+ else \
+ (ABFD)->sections = _s; \
+ } \
+ else \
+ bfd_section_double_list_append ((ABFD), (S)); \
} \
while (0)
+#define bfd_section_list_insert(ABFD, PS, S) \
+ bfd_section_double_list_insert_before ((ABFD), *(PS), (S))
#define bfd_section_removed_from_list(ABFD, S) \
- ((S)->next == NULL && &(S)->next != (ABFD)->section_tail)
+ ((S)->next == NULL && (S) != (ABFD)->section_last)
void bfd_section_list_clear (bfd *);
@@ -4026,8 +4085,8 @@ struct bfd
/* Pointer to linked list of sections. */
struct bfd_section *sections;
- /* The place where we add to the section list. */
- struct bfd_section **section_tail;
+ /* The last section on the section list. */
+ struct bfd_section *section_last;
/* The number of sections. */
unsigned int section_count;
@@ -4287,7 +4346,7 @@ struct bfd_preserve
flagword flags;
const struct bfd_arch_info *arch_info;
struct bfd_section *sections;
- struct bfd_section **section_tail;
+ struct bfd_section *section_last;
unsigned int section_count;
struct bfd_hash_table section_htab;
};