From 491d01d3da18fb61fa6c7c61c091b4cb8c5773f7 Mon Sep 17 00:00:00 2001 From: Yury Usishchev Date: Tue, 22 Dec 2015 15:50:13 +0000 Subject: ARM: Fix exidx coverage for relocatable builds. bfd * elf-bfd.h: Add callback to count additional relocations. * elf32-arm.c (_arm_elf_section_data): Add new counter. (insert_cantunwind_after): Increment relocations counter. (elf32_arm_fix_exidx_coverage): Remove exidx entries and add terminating CANTUNWIND entry only in final builds. (elf32_arm_add_relocation): New function. (elf32_arm_write_section): Add relocations in relocatable builds. (elf32_arm_count_additional_relocs): New function. (elf_backend_count_additional_relocs): New define. * bfd/elflink.c (bfd_elf_final_link): Use callback and adjust size of .rel section. * bfd/elfxx-target.h (elf_backend_count_additional_relocs): New define. ld * emultempl/armelf.em (gld${EMULATION_NAME}_after_allocation): Call elf32_arm_fix_exidx_coverage for relocatable builds. ld/testsuite * ld-arm/arm-elf.exp: New test. * ld-arm/unwind-rel.d: New file. * ld-arm/unwind-rel1.s: New file. * ld-arm/unwind-rel2.s: New file. * ld-arm/unwind-rel3.s: New file. --- bfd/elfxx-target.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'bfd/elfxx-target.h') diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h index 0acecaf..c5bd7de 100644 --- a/bfd/elfxx-target.h +++ b/bfd/elfxx-target.h @@ -538,6 +538,9 @@ #ifndef elf_backend_count_relocs #define elf_backend_count_relocs NULL #endif +#ifndef elf_backend_count_additional_relocs +#define elf_backend_count_additional_relocs NULL +#endif #ifndef elf_backend_sort_relocs_p #define elf_backend_sort_relocs_p NULL #endif @@ -755,6 +758,7 @@ static struct elf_backend_data elfNN_bed = elf_backend_ignore_undef_symbol, elf_backend_emit_relocs, elf_backend_count_relocs, + elf_backend_count_additional_relocs, elf_backend_sort_relocs_p, elf_backend_grok_prstatus, elf_backend_grok_psinfo, -- cgit v1.1