X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=ld%2Femultempl%2Farmelf.em;h=6074824f72d6f607449000702e7c5945bfe412ef;hb=de341542a60f7d3a80cc339db7d341b615cfa52f;hp=2e431720842bb473d0df8f0777c1d83f7fe297a3;hpb=6f2750feaf2827ef8a1a0a5b2f90c1e9a6cabbd1;p=deliverable%2Fbinutils-gdb.git diff --git a/ld/emultempl/armelf.em b/ld/emultempl/armelf.em index 2e43172084..6074824f72 100644 --- a/ld/emultempl/armelf.em +++ b/ld/emultempl/armelf.em @@ -83,6 +83,10 @@ arm_elf_before_allocation (void) /* Auto-select Cortex-A8 erratum fix if it wasn't explicitly specified. */ bfd_elf32_arm_set_cortex_a8_fix (link_info.output_bfd, &link_info); + /* Ensure the output sections of veneers needing a dedicated one is not + removed. */ + bfd_elf32_arm_keep_private_stub_output_sections (&link_info); + /* We should be able to set the size of the interworking stub section. We can't do it until later if we have dynamic sections, though. */ if (elf_hash_table (&link_info)->dynobj == NULL) @@ -203,12 +207,12 @@ hook_in_stub (struct hook_stub_info *info, lang_statement_union_type **lp) static asection * elf32_arm_add_stub_section (const char * stub_sec_name, - asection * input_section, + asection * output_section, + asection * after_input_section, unsigned int alignment_power) { asection *stub_sec; flagword flags; - asection *output_section; lang_output_section_statement_type *os; struct hook_stub_info info; @@ -221,18 +225,34 @@ elf32_arm_add_stub_section (const char * stub_sec_name, bfd_set_section_alignment (stub_file->the_bfd, stub_sec, alignment_power); - output_section = input_section->output_section; os = lang_output_section_get (output_section); - info.input_section = input_section; + info.input_section = after_input_section; lang_list_init (&info.add); lang_add_section (&info.add, stub_sec, NULL, os); if (info.add.head == NULL) goto err_ret; - if (hook_in_stub (&info, &os->children.head)) - return stub_sec; + if (after_input_section == NULL) + { + lang_statement_union_type **lp = &os->children.head; + lang_statement_union_type *l, *lprev = NULL; + + for (; (l = *lp) != NULL; lp = &l->header.next, lprev = l); + + if (lprev) + lprev->header.next = info.add.head; + else + os->children.head = info.add.head; + + return stub_sec; + } + else + { + if (hook_in_stub (&info, &os->children.head)) + return stub_sec; + } err_ret: einfo ("%X%P: can not make stub section: %E\n"); @@ -431,7 +451,8 @@ gld${EMULATION_NAME}_finish (void) h = bfd_link_hash_lookup (link_info.hash, entry_symbol.name, FALSE, FALSE, TRUE); eh = (struct elf_link_hash_entry *)h; - if (!h || eh->target_internal != ST_BRANCH_TO_THUMB) + if (!h || ARM_GET_SYM_BRANCH_TYPE (eh->target_internal) + != ST_BRANCH_TO_THUMB) return; }