From: H.J. Lu Date: Mon, 11 Apr 2005 22:21:23 +0000 (+0000) Subject: 2005-04-11 H.J. Lu X-Git-Tag: msnyder-tracepoint-checkpoint-branchpoint~636 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ab82c5b97fcf97e081a3ea5e2291882963fecdae;p=external%2Fbinutils.git 2005-04-11 H.J. Lu * linker.c (_bfd_generic_link_output_symbols): Also check if the output section of an input section has been removed from the output file. * section.c (bfd_section_list_remove): Clear the next field of the removed section. (bfd_section_removed_from_list): New. * bfd-in2.h: Regenerated. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 7accdd9..365b7d9 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,14 @@ +2005-04-11 H.J. Lu + + * linker.c (_bfd_generic_link_output_symbols): Also check if + the output section of an input section has been removed from + the output file. + + * section.c (bfd_section_list_remove): Clear the next field + of the removed section. + (bfd_section_removed_from_list): New. + * bfd-in2.h: Regenerated. + 2005-04-11 David S. Miller * elf32-sparc.c (elf32_sparc_relocate_section, diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 6266420..bed224d 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -1445,6 +1445,8 @@ extern const struct bfd_symbol * const bfd_ind_symbol; *_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) \ @@ -1458,6 +1460,8 @@ extern const struct bfd_symbol * const bfd_ind_symbol; (ABFD)->section_tail = &_s->next; \ } \ while (0) +#define bfd_section_removed_from_list(ABFD, S) \ + ((S)->next == NULL && &(S)->next != (ABFD)->section_tail) void bfd_section_list_clear (bfd *); diff --git a/bfd/linker.c b/bfd/linker.c index f940d32..89630c0 100644 --- a/bfd/linker.c +++ b/bfd/linker.c @@ -2363,12 +2363,14 @@ _bfd_generic_link_output_symbols (bfd *output_bfd, abort (); /* If this symbol is in a section which is not being included - in the output file, then we don't want to output the symbol. - - Gross. .bss and similar sections won't have the linker_mark - field set. */ - if ((sym->section->flags & SEC_HAS_CONTENTS) != 0 - && ! sym->section->linker_mark) + in the output file, then we don't want to output the + symbol. .bss and similar sections won't have the linker_mark + field set. We also check if its output section has been + removed from the output file. */ + if (((sym->section->flags & SEC_HAS_CONTENTS) != 0 + && ! sym->section->linker_mark) + || bfd_section_removed_from_list (output_bfd, + sym->section->output_section)) output = FALSE; if (output) diff --git a/bfd/section.c b/bfd/section.c index 49a8703..914d182 100644 --- a/bfd/section.c +++ b/bfd/section.c @@ -546,6 +546,8 @@ CODE_FRAGMENT . *_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) \ @@ -559,6 +561,8 @@ CODE_FRAGMENT . (ABFD)->section_tail = &_s->next; \ . } \ . while (0) +.#define bfd_section_removed_from_list(ABFD, S) \ +. ((S)->next == NULL && &(S)->next != (ABFD)->section_tail) . */