diff options
author | Alan Modra <amodra@gmail.com> | 2005-05-04 11:00:28 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2005-05-04 11:00:28 +0000 |
commit | 8423293d34986cfa218f79b2b2f1ff9bf77d468f (patch) | |
tree | 330cd698b1cb69439de3e3dc7add1d1af4812772 /bfd/section.c | |
parent | 53e09e0aaf3d13e4b893744e2fe79edde7edfd20 (diff) | |
download | binutils-8423293d34986cfa218f79b2b2f1ff9bf77d468f.zip binutils-8423293d34986cfa218f79b2b2f1ff9bf77d468f.tar.gz binutils-8423293d34986cfa218f79b2b2f1ff9bf77d468f.tar.bz2 |
bfd/
* section.c (struct bfd_section): Replace link_order_head and
link_order_tail with map_head and map_tail union.
(STD_SECTION): Update.
(_bfd_strip_section_from_output): Delete.
* aoutx.h: Update throughout for above changes.
* coff-ppc.c: Likewise.
* cofflink.c: Likewise.
* ecoff.c: Likewise.
* elf-eh-frame.c: Likewise.
* elf-m10300.c: Likewise.
* elf.c: Likewise.
* elf32-arm.c: Likewise.
* elf32-cris.c: Likewise.
* elf32-hppa.c: Likewise.
* elf32-i386.c: Likewise.
* elf32-m32r.c: Likewise.
* elf32-m68hc1x.c: Likewise.
* elf32-m68k.c: Likewise.
* elf32-ppc.c: Likewise.
* elf32-s390.c: Likewise.
* elf32-sh.c: Likewise.
* elf32-vax.c: Likewise.
* elf32-xtensa.c: Likewise.
* elf64-alpha.c: Likewise.
* elf64-hppa.c: Likewise.
* elf64-ppc.c: Likewise.
* elf64-s390.c: Likewise.
* elf64-sh64.c: Likewise.
* elf64-x86-64.c: Likewise.
* elflink.c: Likewise.
* elfxx-ia64.c: Likewise.
* elfxx-mips.c: Likewise.
* elfxx-sparc.c: Likewise.
* linker.c: Likewise.
* merge.c: Likewise.
* pdp11.c: Likewise.
* xcofflink.c: Likewise.
* elflink.c (bfd_boolean bfd_elf_size_dynsym_hash_dynstr): Split
out from bfd_elf_size_dynamic_sections.
* bfd-in.h (bfd_boolean bfd_elf_size_dynsym_hash_dynstr): Declare.
* bfd-in2.h: Regenerate.
ld/
* ldemul.c: Include bfdlink.h.
(ldemul_before_allocation): Assume before_allocation is non-zero.
(before_allocation_default): Call strip_excluded_output_sections.
* ldlang.c (stripped_excluded_sections): New variable.
(lang_add_section): Build input section list for each output
section, attached via map_head and map_tail pointers.
(strip_excluded_output_sections): Make global. Traverse the
input section lists to find which output sections can go. Clear
link_order pointers and set stripped_excluded_sections.
(lang_process): Call strip_excluded_output_sections.
* ldlang.h (strip_excluded_output_sections): Declare.
* ldwrite.c: Update throuhout for link_order_head -> map_head change.
* emultempl/aix.em (before_allocation): Call
strip_excluded_output_sections.
* emultempl/armcoff.em (before_allocation): Likewise.
* emultempl/beos.em (before_allocation): Likewise.
* emultempl/linux.em (before_allocation): Likewise.
* emultempl/pe.em (before_allocation): Likewise.
* emultempl/sunos.em (before_allocation): Likewise.
* emultempl/elf32.em (before_allocation): Likewise. Call
bfd_elf_size_dynsym_hash_dynstr too.
* emultempl/lnk960.em (lnk960_before_allocation): Delete.
(ld_lnk960): Use before_allocation_default.
Diffstat (limited to 'bfd/section.c')
-rw-r--r-- | bfd/section.c | 58 |
1 files changed, 10 insertions, 48 deletions
diff --git a/bfd/section.c b/bfd/section.c index 0f39632..b3b6230 100644 --- a/bfd/section.c +++ b/bfd/section.c @@ -497,8 +497,14 @@ CODE_FRAGMENT . struct bfd_symbol *symbol; . struct bfd_symbol **symbol_ptr_ptr; . -. struct bfd_link_order *link_order_head; -. struct bfd_link_order *link_order_tail; +. {* Early in the link process, map_head and map_tail are used to build +. a list of input sections attached to an output section. Later, +. output sections use these fields for a list of bfd_link_order +. structs. *} +. union { +. struct bfd_link_order *link_order; +. struct bfd_section *s; +. } map_head, map_tail; .} asection; . .{* These sections are global, and are managed by BFD. The application @@ -692,8 +698,8 @@ static const asymbol global_syms[] = /* symbol_ptr_ptr, */ \ (struct bfd_symbol **) &SYM, \ \ - /* link_order_head, link_order_tail */ \ - NULL, NULL \ + /* map_head, map_tail */ \ + { NULL }, { NULL } \ } STD_SECTION (bfd_com_section, SEC_IS_COMMON, bfd_com_symbol, @@ -1443,50 +1449,6 @@ DESCRIPTION /* FUNCTION - _bfd_strip_section_from_output - -SYNOPSIS - void _bfd_strip_section_from_output - (struct bfd_link_info *info, asection *section); - -DESCRIPTION - Remove @var{section} from the output. If the output section - becomes empty, remove it from the output bfd. - - This function won't actually do anything except twiddle flags - if called too late in the linking process, when it's not safe - to remove sections. -*/ -void -_bfd_strip_section_from_output (struct bfd_link_info *info, asection *s) -{ - asection *os; - asection *is; - bfd *abfd; - - s->flags |= SEC_EXCLUDE; - - /* If the section wasn't assigned to an output section, or the - section has been discarded by the linker script, there's nothing - more to do. */ - os = s->output_section; - if (os == NULL || os->owner == NULL) - return; - - /* If the output section has other (non-excluded) input sections, we - can't remove it. */ - for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link_next) - for (is = abfd->sections; is != NULL; is = is->next) - if (is->output_section == os && (is->flags & SEC_EXCLUDE) == 0) - return; - - /* If the output section is empty, flag it for removal too. - See ldlang.c:strip_excluded_output_sections for the action. */ - os->flags |= SEC_EXCLUDE; -} - -/* -FUNCTION bfd_generic_is_group_section SYNOPSIS |