From eaeb0a9d5c65fd8dc19878b068e17f90a93a19c2 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 10 Aug 2009 07:50:56 +0000 Subject: PR 10474 * ldemul.c (after_allocation_default): Run lang_relax_sections. * ldlang.h (lang_relax_sections): Declare. * ldlang.c (relax_sections): Delete. (lang_relax_sections): New function. (lang_process): Don't relax directly from here. * emultempl/alphaelf.em (alpha_finish): Call finish_default. * emultempl/armelf.em (arm_elf_after_allocation): Delete. Move body.. (gld${EMULATION_NAME}_finish): ..to here. Move existing code.. (gld${EMULATION_NAME}_after_allocation): ..to here. New function. (LDEMUL_AFTER_ALLOCATION): Update. * emultempl/avrelf.em (avr_elf_finish, LDEMUL_FINISH): Delete. (avr_elf_after_allocation): New function. (LDEMUL_AFTER_ALLOCATION): Define. * emultempl/elf-generic.em (gld${EMULATION_NAME}_map_segments): Call lang_relax_sections. * emultempl/elf32.em (gld${EMULATION_NAME}_finish): Delete. Move.. (gld${EMULATION_NAME}_after_allocation): ..code to here. New function. (LDEMUL_AFTER_ALLOCATION, LDEMUL_FINISH): Update. * emultempl/genelf.em (gld${EMULATION_NAME}_finish): Delete. Move.. (gld${EMULATION_NAME}_after_allocation): ..code to here. New function. (LDEMUL_FINISH): Delete. (LDEMUL_AFTER_ALLOCATION): Define. * emultempl/hppaelf.em (gld${EMULATION_NAME}_finish): Delete. Move.. (gld${EMULATION_NAME}_after_allocation): ..to here. New function. (LDEMUL_FINISH): Delete. (LDEMUL_AFTER_ALLOCATION): Define. * emultempl/m68hc1xelf.em (m68hc11elf_finish): Delete. Move.. (m68hc11elf_after_allocation): ..to here. New function. (LDEMUL_FINISH): Delete. (LDEMUL_AFTER_ALLOCATION): Define. * emultempl/m68kelf.em (m68k_elf_after_allocation): Call gld${EMULATION_NAME}_after_allocation. * emultempl/mmix-elfnmmo.em (mmix_after_allocation): Call gld${EMULATION_NAME}_after_allocation. * emultempl/mmo.em (mmo_finish): Delete. Move body.. (gld${EMULATION_NAME}_after_allocation): ..to here. New function. (LDEMUL_FINISH): Define. * emultempl/ppc64elf.em (ppc_layout_sections_again): Set elf_gp. (gld${EMULATION_NAME}_finish): Move code sizing sections.. (gld${EMULATION_NAME}_after_allocation): ..to here. * emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_after_allocation): Call gld${EMULATION_NAME}_after_allocation. * emultempl/spuelf.em (gld${EMULATION_NAME}_finish): Delete bfd_elf_discard_info and map_segments call. --- ld/emultempl/armelf.em | 44 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 23 deletions(-) (limited to 'ld/emultempl/armelf.em') diff --git a/ld/emultempl/armelf.em b/ld/emultempl/armelf.em index 0713c72..fffffd9 100644 --- a/ld/emultempl/armelf.em +++ b/ld/emultempl/armelf.em @@ -89,22 +89,6 @@ arm_elf_before_allocation (void) gld${EMULATION_NAME}_before_allocation (); } -static void -arm_elf_after_allocation (void) -{ - /* Call the standard elf routine. */ - after_allocation_default (); - - { - LANG_FOR_EACH_INPUT_STATEMENT (is) - { - /* Figure out where VFP11 erratum veneers (and the labels returning - from same) have been placed. */ - bfd_elf32_arm_vfp11_fix_veneer_locations (is->the_bfd, &link_info); - } - } -} - /* Fake input file for stubs. */ static lang_input_statement_type *stub_file; @@ -285,17 +269,16 @@ compare_output_sec_vma (const void *a, const void *b) } static void -gld${EMULATION_NAME}_finish (void) +gld${EMULATION_NAME}_after_allocation (void) { - struct bfd_link_hash_entry * h; - unsigned int list_size = 10; - asection **sec_list = xmalloc (list_size * sizeof (asection *)); - unsigned int sec_count = 0; - if (!link_info.relocatable) { /* Build a sorted list of input text sections, then use that to process the unwind table index. */ + unsigned int list_size = 10; + asection **sec_list = xmalloc (list_size * sizeof (asection *)); + unsigned int sec_count = 0; + LANG_FOR_EACH_INPUT_STATEMENT (is) { bfd *abfd = is->the_bfd; @@ -375,6 +358,21 @@ gld${EMULATION_NAME}_finish (void) if (need_laying_out != -1) gld${EMULATION_NAME}_map_segments (need_laying_out); +} + +static void +gld${EMULATION_NAME}_finish (void) +{ + struct bfd_link_hash_entry * h; + + { + LANG_FOR_EACH_INPUT_STATEMENT (is) + { + /* Figure out where VFP11 erratum veneers (and the labels returning + from same) have been placed. */ + bfd_elf32_arm_vfp11_fix_veneer_locations (is->the_bfd, &link_info); + } + } if (! link_info.relocatable) { @@ -659,7 +657,7 @@ PARSE_AND_LIST_ARGS_CASES=' # We have our own before_allocation etc. functions, but they call # the standard routines, so give them a different name. LDEMUL_BEFORE_ALLOCATION=arm_elf_before_allocation -LDEMUL_AFTER_ALLOCATION=arm_elf_after_allocation +LDEMUL_AFTER_ALLOCATION=gld${EMULATION_NAME}_after_allocation LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS=arm_elf_create_output_section_statements # Replace the elf before_parse function with our own. -- cgit v1.1