diff options
author | Alan Modra <amodra@gmail.com> | 2005-07-14 13:54:23 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2005-07-14 13:54:23 +0000 |
commit | a3c2b96af6bbf3ab11d9f5532093c8c3c346df4a (patch) | |
tree | 3dd2957dd59a3b39e4a89b121783842534195ddc /ld | |
parent | bfaaa3c28b9c0ada4c322c895e4cf1349abfd10d (diff) | |
download | gdb-a3c2b96af6bbf3ab11d9f5532093c8c3c346df4a.zip gdb-a3c2b96af6bbf3ab11d9f5532093c8c3c346df4a.tar.gz gdb-a3c2b96af6bbf3ab11d9f5532093c8c3c346df4a.tar.bz2 |
bfd/
* bfd-in.h (_bfd_elf_fix_excluded_sec_syms): Declare.
(_bfd_elf_provide_section_bound_symbols): Remove param name.
Formatting.
* bfd-in2.h: Regenerate.
* elflink.c (bfd_elf_gc_sections): Don't call generic function.
(_bfd_elf_provide_symbol): Formatting.
(_bfd_elf_provide_section_bound_symbols): Remove all hacks, just
create section relative syms.
(fix_syms, _bfd_elf_fix_excluded_sec_syms): New functions.
* elf32-ppc.c (ppc_elf_set_sdata_syms): Use
_bfd_elf_provide_section_bound_symbols.
* reloc.c (bfd_mark_used_section): Delete.
(bfd_generic_gc_sections): Don't call the above.
ld/
* ldlang.c (strip_excluded_output_sections): Don't call
bfd_gc_sections.
* emultempl/elf32.em (gld*_provide_bound_symbols): Move.
(gld*_provide_init_fini_syms): Move.
(gld*_before_allocation): Call the above from here..
(gld*_finish): ..not here. Call _bfd_elf_fix_excluded_sec_syms.
* emultempl/hppaelf.em (hppaelf_finish): Likewise.
* emultempl/ppc64elf.em (ppc_finish): Likewise.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 11 | ||||
-rw-r--r-- | ld/emultempl/elf32.em | 89 | ||||
-rw-r--r-- | ld/emultempl/hppaelf.em | 2 | ||||
-rw-r--r-- | ld/emultempl/ppc64elf.em | 2 | ||||
-rw-r--r-- | ld/ldlang.c | 8 |
5 files changed, 57 insertions, 55 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index f995fc5..78f4f68 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,14 @@ +2005-07-14 Alan Modra <amodra@bigpond.net.au> + + * ldlang.c (strip_excluded_output_sections): Don't call + bfd_gc_sections. + * emultempl/elf32.em (gld*_provide_bound_symbols): Move. + (gld*_provide_init_fini_syms): Move. + (gld*_before_allocation): Call the above from here.. + (gld*_finish): ..not here. Call _bfd_elf_fix_excluded_sec_syms. + * emultempl/hppaelf.em (hppaelf_finish): Likewise. + * emultempl/ppc64elf.em (ppc_finish): Likewise. + 2005-07-10 Ralf Corsepius <ralf.corsepius@rtems.org> * configure.tgt: Remove sparc*-*-rtemsaout*, i[3-7]86-go32-rtems*, diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em index da7af0b..9480c2c 100644 --- a/ld/emultempl/elf32.em +++ b/ld/emultempl/elf32.em @@ -61,7 +61,6 @@ static void gld${EMULATION_NAME}_before_allocation (void); static bfd_boolean gld${EMULATION_NAME}_place_orphan (lang_input_statement_type *file, asection *s); static void gld${EMULATION_NAME}_layout_sections_again (void); -static void gld${EMULATION_NAME}_provide_init_fini_syms (void); static void gld${EMULATION_NAME}_finish (void) ATTRIBUTE_UNUSED; EOF @@ -1040,6 +1039,47 @@ if test x"$LDEMUL_BEFORE_ALLOCATION" != xgld"$EMULATION_NAME"_before_allocation; fi cat >>e${EMULATION_NAME}.c <<EOF +static void +gld${EMULATION_NAME}_provide_bound_symbols (const char *sec, + const char *start, + const char *end) +{ + asection *s = bfd_get_section_by_name (output_bfd, sec); + _bfd_elf_provide_section_bound_symbols (&link_info, s, start, end); +} + +/* If not building a shared library, provide + + __preinit_array_start + __preinit_array_end + __init_array_start + __init_array_end + __fini_array_start + __fini_array_end + + They are set here rather than via PROVIDE in the linker + script, because using PROVIDE inside an output section + statement results in unnecessary output sections. Using + PROVIDE outside an output section statement runs the risk of + section alignment affecting where the section starts. */ + +static void +gld${EMULATION_NAME}_provide_init_fini_syms (void) +{ + if (!link_info.relocatable && link_info.executable) + { + gld${EMULATION_NAME}_provide_bound_symbols (".preinit_array", + "__preinit_array_start", + "__preinit_array_end"); + gld${EMULATION_NAME}_provide_bound_symbols (".init_array", + "__init_array_start", + "__init_array_end"); + gld${EMULATION_NAME}_provide_bound_symbols (".fini_array", + "__fini_array_start", + "__fini_array_end"); + } +} + /* This is called after the sections have been attached to output sections, but before any sizes or addresses have been set. */ @@ -1057,6 +1097,8 @@ gld${EMULATION_NAME}_before_allocation (void) referred to by dynamic objects. */ lang_for_each_statement (gld${EMULATION_NAME}_find_statement_assignment); + gld${EMULATION_NAME}_provide_init_fini_syms (); + /* Let the ELF backend work out the sizes of any sections required by dynamic linking. */ rpath = command_line.rpath; @@ -1448,49 +1490,6 @@ if test x"$LDEMUL_FINISH" != xgld"$EMULATION_NAME"_finish; then cat >>e${EMULATION_NAME}.c <<EOF static void -gld${EMULATION_NAME}_provide_bound_symbols (const char *sec, - const char *start, - const char *end) -{ - asection *s = bfd_get_section_by_name (output_bfd, sec); - if (s && bfd_section_removed_from_list (output_bfd, s)) - s = NULL; - _bfd_elf_provide_section_bound_symbols (&link_info, s, start, end); -} - -/* If not building a shared library, provide - - __preinit_array_start - __preinit_array_end - __init_array_start - __init_array_end - __fini_array_start - __fini_array_end - - They are set here rather than via PROVIDE in the linker - script, because using PROVIDE inside an output section - statement results in unnecessary output sections. Using - PROVIDE outside an output section statement runs the risk of - section alignment affecting where the section starts. */ - -static void -gld${EMULATION_NAME}_provide_init_fini_syms (void) -{ - if (!link_info.relocatable && link_info.executable) - { - gld${EMULATION_NAME}_provide_bound_symbols (".preinit_array", - "__preinit_array_start", - "__preinit_array_end"); - gld${EMULATION_NAME}_provide_bound_symbols (".init_array", - "__init_array_start", - "__init_array_end"); - gld${EMULATION_NAME}_provide_bound_symbols (".fini_array", - "__fini_array_start", - "__fini_array_end"); - } -} - -static void gld${EMULATION_NAME}_layout_sections_again (void) { lang_reset_memory_regions (); @@ -1511,7 +1510,7 @@ gld${EMULATION_NAME}_finish (void) if (bfd_elf_discard_info (output_bfd, &link_info)) gld${EMULATION_NAME}_layout_sections_again (); - gld${EMULATION_NAME}_provide_init_fini_syms (); + _bfd_elf_fix_excluded_sec_syms (output_bfd, &link_info); } EOF fi diff --git a/ld/emultempl/hppaelf.em b/ld/emultempl/hppaelf.em index 96a98ed..4303274 100644 --- a/ld/emultempl/hppaelf.em +++ b/ld/emultempl/hppaelf.em @@ -305,7 +305,7 @@ hppaelf_finish (void) } } - gld${EMULATION_NAME}_provide_init_fini_syms (); + _bfd_elf_fix_excluded_sec_syms (output_bfd, &link_info); } diff --git a/ld/emultempl/ppc64elf.em b/ld/emultempl/ppc64elf.em index 483d381..a9ced5f 100644 --- a/ld/emultempl/ppc64elf.em +++ b/ld/emultempl/ppc64elf.em @@ -379,7 +379,7 @@ ppc_finish (void) } ppc64_elf_restore_symbols (&link_info); - gld${EMULATION_NAME}_provide_init_fini_syms (); + _bfd_elf_fix_excluded_sec_syms (output_bfd, &link_info); } diff --git a/ld/ldlang.c b/ld/ldlang.c index ce178f1..35c5075 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -3049,7 +3049,6 @@ void strip_excluded_output_sections (void) { lang_output_section_statement_type *os; - unsigned int gc_sections; /* Run lang_size_sections (if not already done) to ensure that all symbols defined in the linker script are put in the bfd hash @@ -3062,13 +3061,6 @@ strip_excluded_output_sections (void) lang_reset_memory_regions (); } - /* Now call into bfd_gc_sections to mark all sections defining global - symbols with SEC_KEEP. */ - gc_sections = link_info.gc_sections; - link_info.gc_sections = 0; - bfd_gc_sections (output_bfd, &link_info); - link_info.gc_sections = gc_sections; - for (os = &lang_output_section_statement.head->output_section_statement; os != NULL; os = os->next) |