From 3e6b10420efe916a2461d1f336697a5c049ea921 Mon Sep 17 00:00:00 2001 From: Daniel Jacobowitz Date: Tue, 21 Apr 2009 22:05:04 +0000 Subject: bfd/ * elf32-arm.c (INTERWORK_FLAG): Check BFD_LINKER_CREATED. (elf32_arm_write_section): Declare early. (elf32_arm_size_stubs): Skip non-stub sections in the stub BFD. (arm_allocate_glue_section_space): Exclude empty sections. (ARM_GLUE_SECTION_FLAGS): Add SEC_LINKER_CREATED. (bfd_elf32_arm_add_glue_sections_to_bfd): Do not skip the stub BFD. (elf32_arm_output_glue_section, elf32_arm_final_link): New. (elf32_arm_merge_eabi_attributes): Skip the stub BFD. (elf32_arm_size_dynamic_sections): Allocate interworking sections here. (bfd_elf32_bfd_final_link): Define. ld/ * emultempl/armelf.em (bfd_for_interwork, arm_elf_after_open) (arm_elf_set_bfd_for_interworking): Delete. (arm_elf_before_allocation): Do not set the interworking BFD. Move allocation inside not-dynamic block. (arm_elf_create_output_section_statements): Create glue sections and set the interworking BFD here. (LDEMUL_AFTER_OPEN): Delete. ld/testsuite/ * ld-arm/farcall-mix.d, ld-arm/farcall-mix2.d, ld-arm/farcall-group-size2.d, ld-arm/farcall-group.d, ld-arm/farcall-mixed-lib.d: Update for linker changes. --- ld/emultempl/armelf.em | 67 ++++++-------------------------------------------- 1 file changed, 8 insertions(+), 59 deletions(-) (limited to 'ld/emultempl/armelf.em') diff --git a/ld/emultempl/armelf.em b/ld/emultempl/armelf.em index 31ad3e8..2f0c3af 100644 --- a/ld/emultempl/armelf.em +++ b/ld/emultempl/armelf.em @@ -31,7 +31,6 @@ fragment <the_bfd, & link_info); - } - } - - /* Call the standard elf routine. */ - gld${EMULATION_NAME}_after_open (); -} - -static void -arm_elf_set_bfd_for_interworking (lang_statement_union_type *statement) -{ - if (statement->header.type == lang_input_section_enum) - { - asection *i = statement->input_section.section; - - if (!((lang_input_statement_type *) i->owner->usrdata)->just_syms_flag - && (i->flags & SEC_EXCLUDE) == 0) - { - asection *output_section = i->output_section; - - ASSERT (output_section->owner == link_info.output_bfd); - - /* Don't attach the interworking stubs to a dynamic object, to - an empty section, etc. */ - if ((output_section->flags & SEC_HAS_CONTENTS) != 0 - && (i->flags & SEC_NEVER_LOAD) == 0 - && ! (i->owner->flags & DYNAMIC)) - bfd_for_interwork = i->owner; - } - } -} - -static void arm_elf_before_allocation (void) { - if (link_info.input_bfds != NULL) - { - /* The interworking bfd must be the last one in the link. */ - bfd_for_interwork = NULL; - - lang_for_each_statement (arm_elf_set_bfd_for_interworking); - - /* If bfd_for_interwork is NULL, then there are no loadable sections - with real contents to be linked, so we are not going to have to - create any interworking stubs, so it is OK not to call - bfd_elf32_arm_get_bfd_for_interworking. */ - if (bfd_for_interwork != NULL) - bfd_elf32_arm_get_bfd_for_interworking (bfd_for_interwork, &link_info); - } - bfd_elf32_arm_set_byteswap_code (&link_info, byteswap_code); /* Choose type of VFP11 erratum fix, or warn if specified fix is unnecessary @@ -130,13 +76,13 @@ arm_elf_before_allocation (void) /* xgettext:c-format */ einfo (_("Errors encountered processing file %s"), is->filename); } + + /* We have seen it all. Allocate it, and carry on. */ + bfd_elf32_arm_allocate_interworking_sections (& link_info); } /* Call the standard elf routine. */ gld${EMULATION_NAME}_before_allocation (); - - /* We have seen it all. Allocate it, and carry on. */ - bfd_elf32_arm_allocate_interworking_sections (& link_info); } static void @@ -461,6 +407,10 @@ arm_elf_create_output_section_statements (void) stub_file->the_bfd->flags |= BFD_LINKER_CREATED; ldlang_add_file (stub_file); + + /* Also use the stub file for stubs placed in a single output section. */ + bfd_elf32_arm_add_glue_sections_to_bfd (stub_file->the_bfd, &link_info); + bfd_elf32_arm_get_bfd_for_interworking (stub_file->the_bfd, &link_info); } /* Avoid processing the fake stub_file in vercheck, stat_needed and @@ -620,9 +570,8 @@ PARSE_AND_LIST_ARGS_CASES=' break; ' -# We have our own after_open and before_allocation functions, but they call +# We have our own before_allocation etc. functions, but they call # the standard routines, so give them a different name. -LDEMUL_AFTER_OPEN=arm_elf_after_open LDEMUL_BEFORE_ALLOCATION=arm_elf_before_allocation LDEMUL_AFTER_ALLOCATION=arm_elf_after_allocation LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS=arm_elf_create_output_section_statements -- cgit v1.1