forked from Imagelibrary/binutils-gdb
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.
This commit is contained in:
@@ -164,6 +164,9 @@ CODE_FRAGMENT
|
||||
. {* 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. *}
|
||||
@@ -538,31 +541,73 @@ CODE_FRAGMENT
|
||||
.{* 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_list_remove(ABFD, PS) \
|
||||
.#define bfd_section_list_remove(ABFD, S) \
|
||||
. do \
|
||||
. { \
|
||||
. asection **_ps = PS; \
|
||||
. asection *_s = *_ps; \
|
||||
. *_ps = _s->next; \
|
||||
. if (_s->next == NULL) \
|
||||
. (ABFD)->section_tail = _ps; \
|
||||
. else \
|
||||
. _s->next = NULL; \
|
||||
. } \
|
||||
. while (0)
|
||||
.#define bfd_section_list_insert(ABFD, PS, S) \
|
||||
. do \
|
||||
. { \
|
||||
. asection **_ps = PS; \
|
||||
. asection *_s = S; \
|
||||
. _s->next = *_ps; \
|
||||
. *_ps = _s; \
|
||||
. if (_s->next == NULL) \
|
||||
. (ABFD)->section_tail = &_s->next; \
|
||||
. 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_removed_from_list(ABFD, S) \
|
||||
. ((S)->next == NULL && &(S)->next != (ABFD)->section_tail)
|
||||
.#define bfd_section_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_list_insert_after(ABFD, A, S) \
|
||||
. do \
|
||||
. { \
|
||||
. asection *_a = A; \
|
||||
. asection *_s = S; \
|
||||
. asection *_next = _a->next; \
|
||||
. _s->next = _next; \
|
||||
. _s->prev = _a; \
|
||||
. _a->next = _s; \
|
||||
. if (_next) \
|
||||
. _s->next->prev = _s; \
|
||||
. else \
|
||||
. (ABFD)->section_last = _s; \
|
||||
. } \
|
||||
. while (0)
|
||||
.#define bfd_section_list_insert_before(ABFD, B, S) \
|
||||
. do \
|
||||
. { \
|
||||
. asection *_b = B; \
|
||||
. asection *_s = S; \
|
||||
. asection *_prev = _b->prev; \
|
||||
. _s->prev = _prev; \
|
||||
. _s->next = _b; \
|
||||
. _b->prev = _s; \
|
||||
. if (_prev) \
|
||||
. _prev->next = _s; \
|
||||
. else \
|
||||
. (ABFD)->sections = _s; \
|
||||
. } \
|
||||
. while (0)
|
||||
.#define bfd_section_removed_from_list(ABFD, S) \
|
||||
. ((S)->next == NULL && (S) != (ABFD)->section_last)
|
||||
.
|
||||
*/
|
||||
|
||||
@@ -592,8 +637,8 @@ static const asymbol global_syms[] =
|
||||
#define STD_SECTION(SEC, FLAGS, SYM, NAME, IDX) \
|
||||
const asymbol * const SYM = (asymbol *) &global_syms[IDX]; \
|
||||
asection SEC = \
|
||||
/* name, id, index, next, flags, user_set_vma, */ \
|
||||
{ NAME, IDX, 0, NULL, FLAGS, 0, \
|
||||
/* name, id, index, next, prev, flags, user_set_vma, */ \
|
||||
{ NAME, IDX, 0, NULL, NULL, FLAGS, 0, \
|
||||
\
|
||||
/* linker_mark, linker_has_input, gc_mark, segment_mark, */ \
|
||||
0, 0, 1, 0, \
|
||||
@@ -705,8 +750,7 @@ bfd_section_init (bfd *abfd, asection *newsect)
|
||||
|
||||
section_id++;
|
||||
abfd->section_count++;
|
||||
*abfd->section_tail = newsect;
|
||||
abfd->section_tail = &newsect->next;
|
||||
bfd_section_list_append (abfd, newsect);
|
||||
return newsect;
|
||||
}
|
||||
|
||||
@@ -736,7 +780,7 @@ void
|
||||
bfd_section_list_clear (bfd *abfd)
|
||||
{
|
||||
abfd->sections = NULL;
|
||||
abfd->section_tail = &abfd->sections;
|
||||
abfd->section_last = NULL;
|
||||
abfd->section_count = 0;
|
||||
memset (abfd->section_htab.table, 0,
|
||||
abfd->section_htab.size * sizeof (struct bfd_hash_entry *));
|
||||
|
||||
Reference in New Issue
Block a user