diff options
author | Yury Usishchev <y.usishchev@samsung.com> | 2015-12-22 15:50:13 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2015-12-22 15:50:13 +0000 |
commit | 491d01d3da18fb61fa6c7c61c091b4cb8c5773f7 (patch) | |
tree | 4f325fdc33925c18aa4db39125a2f91ef8d39e7c /ld/testsuite/ld-arm | |
parent | 4abd5ed2221c826bcb843794286777452de5c50b (diff) | |
download | gdb-491d01d3da18fb61fa6c7c61c091b4cb8c5773f7.zip gdb-491d01d3da18fb61fa6c7c61c091b4cb8c5773f7.tar.gz gdb-491d01d3da18fb61fa6c7c61c091b4cb8c5773f7.tar.bz2 |
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.
Diffstat (limited to 'ld/testsuite/ld-arm')
-rw-r--r-- | ld/testsuite/ld-arm/arm-elf.exp | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-arm/unwind-rel.d | 31 | ||||
-rw-r--r-- | ld/testsuite/ld-arm/unwind-rel1.s | 9 | ||||
-rw-r--r-- | ld/testsuite/ld-arm/unwind-rel2.s | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-arm/unwind-rel3.s | 9 |
5 files changed, 61 insertions, 0 deletions
diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp index a970dba..ac2abf1 100644 --- a/ld/testsuite/ld-arm/arm-elf.exp +++ b/ld/testsuite/ld-arm/arm-elf.exp @@ -941,3 +941,9 @@ run_dump_test "gc-hidden-1" run_dump_test "protected-data" run_dump_test "stm32l4xx-cannot-fix-it-block" run_dump_test "stm32l4xx-cannot-fix-far-ldm" +set arm_unwind_tests { + {"unwind-rel" "-r -Tarm.ld" "" "" {unwind-rel1.s unwind-rel2.s unwind-rel3.s} + {{readelf -ur unwind-rel.d}} + "unwind-rel"} +} +run_ld_link_tests $arm_unwind_tests diff --git a/ld/testsuite/ld-arm/unwind-rel.d b/ld/testsuite/ld-arm/unwind-rel.d new file mode 100644 index 0000000..b2aa6e2 --- /dev/null +++ b/ld/testsuite/ld-arm/unwind-rel.d @@ -0,0 +1,31 @@ + +Relocation section '\.rel\.text' at offset .* contains 3 entries: + Offset Info Type Sym\.Value Sym\. Name +00000000 00000028 R_ARM_V4BX +00000004 00000028 R_ARM_V4BX +00000008 00000028 R_ARM_V4BX + +Relocation section '\.rel\.ARM\.exidx' at offset .* contains 5 entries: + Offset Info Type Sym\.Value Sym\. Name +00000000 0000012a R_ARM_PREL31 00000000 \.text +00000000 00000e00 R_ARM_NONE 00000000 __aeabi_unwind_cpp_pr0 +00000008 0000012a R_ARM_PREL31 00000000 \.text +00000010 0000012a R_ARM_PREL31 00000000 \.text +00000010 00000e00 R_ARM_NONE 00000000 __aeabi_unwind_cpp_pr0 + +Unwind table index '\.ARM\.exidx' at offset .* contains 3 entries: + +0x0: 0x80a8b0b0 + Compact model index: 0 + 0xa8 pop {r4, r14} + 0xb0 finish + 0xb0 finish + +0x4 <test>: 0x1 \[cantunwind\] + +0x8 <end>: 0x80a8b0b0 + Compact model index: 0 + 0xa8 pop {r4, r14} + 0xb0 finish + 0xb0 finish + diff --git a/ld/testsuite/ld-arm/unwind-rel1.s b/ld/testsuite/ld-arm/unwind-rel1.s new file mode 100644 index 0000000..9efb78b --- /dev/null +++ b/ld/testsuite/ld-arm/unwind-rel1.s @@ -0,0 +1,9 @@ + .syntax unified + .text + .global _start + .type _start, %function +_start: + .fnstart + .save {r4, lr} + bx lr + .fnend diff --git a/ld/testsuite/ld-arm/unwind-rel2.s b/ld/testsuite/ld-arm/unwind-rel2.s new file mode 100644 index 0000000..1001743 --- /dev/null +++ b/ld/testsuite/ld-arm/unwind-rel2.s @@ -0,0 +1,6 @@ + .syntax unified + .text + .global test + .type test, %function +test: + bx lr diff --git a/ld/testsuite/ld-arm/unwind-rel3.s b/ld/testsuite/ld-arm/unwind-rel3.s new file mode 100644 index 0000000..8511339 --- /dev/null +++ b/ld/testsuite/ld-arm/unwind-rel3.s @@ -0,0 +1,9 @@ + .syntax unified + .text + .global end + .type end, %function +end: + .fnstart + .save {r4, lr} + bx lr + .fnend |