2019-03-28 19:10:20 +08:00
|
|
|
// REQUIRES: arm
|
|
|
|
// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi --arm-add-build-attributes %s -o %t
|
2019-03-29 06:14:46 +08:00
|
|
|
// RUN: ld.lld %t --no-merge-exidx-entries -o %t2
|
2019-03-28 19:10:20 +08:00
|
|
|
// RUN: llvm-objdump -s %t2 | FileCheck %s
|
2019-03-29 06:14:46 +08:00
|
|
|
// RUN: ld.lld %t -o %t3
|
2020-03-16 08:47:44 +08:00
|
|
|
// RUN: llvm-objdump -s %t3 | FileCheck %s --check-prefix=CHECK-MERGE
|
2019-03-28 19:10:20 +08:00
|
|
|
|
2020-04-18 23:06:37 +08:00
|
|
|
/// The ARM.exidx section is a table of 8-byte entries of the form:
|
|
|
|
/// | PREL31 Relocation to start of function | Unwinding information |
|
|
|
|
/// The range of addresses covered by the table entry is terminated by the
|
|
|
|
/// next table entry. This means that an executable section without a .ARM.exidx
|
|
|
|
/// section does not terminate the range of addresses. To fix this the linker
|
|
|
|
/// synthesises an EXIDX_CANTUNWIND entry for each section without a .ARM.exidx
|
|
|
|
/// section.
|
2019-03-28 19:10:20 +08:00
|
|
|
|
|
|
|
.syntax unified
|
|
|
|
|
2020-04-18 23:06:37 +08:00
|
|
|
/// Expect inline unwind instructions
|
2019-03-28 19:10:20 +08:00
|
|
|
.section .text.01, "ax", %progbits
|
|
|
|
.global f1
|
|
|
|
f1:
|
|
|
|
.fnstart
|
|
|
|
bx lr
|
|
|
|
.save {r7, lr}
|
|
|
|
.setfp r7, sp, #0
|
|
|
|
.fnend
|
|
|
|
|
2020-04-18 23:06:37 +08:00
|
|
|
/// Expect no unwind information from assembler. The linker must
|
|
|
|
/// synthesise an EXIDX_CANTUNWIND entry to prevent an exception
|
|
|
|
/// thrown through f2 from matching against the unwind instructions
|
|
|
|
/// for f1.
|
2019-03-28 19:10:20 +08:00
|
|
|
.section .text.02, "ax", %progbits
|
|
|
|
.global f2
|
|
|
|
f2:
|
|
|
|
bx lr
|
|
|
|
|
|
|
|
|
2020-04-18 23:06:37 +08:00
|
|
|
/// Expect 1 EXIDX_CANTUNWIND entry that can be merged into the linker
|
|
|
|
/// generated EXIDX_CANTUNWIND as if the assembler had generated it.
|
2019-03-28 19:10:20 +08:00
|
|
|
.section .text.03, "ax",%progbits
|
|
|
|
.global f3
|
|
|
|
f3:
|
|
|
|
.fnstart
|
|
|
|
bx lr
|
|
|
|
.cantunwind
|
|
|
|
.fnend
|
|
|
|
|
2020-04-18 23:06:37 +08:00
|
|
|
/// Dummy implementation of personality routines to satisfy reference
|
|
|
|
/// from exception tables, linker will generate EXIDX_CANTUNWIND.
|
2019-03-28 19:10:20 +08:00
|
|
|
.section .text.__aeabi_unwind_cpp_pr0, "ax", %progbits
|
|
|
|
.global __aeabi_unwind_cpp_pr0
|
|
|
|
__aeabi_unwind_cpp_pr0:
|
|
|
|
bx lr
|
|
|
|
|
2020-04-18 23:06:37 +08:00
|
|
|
/// f1, f2
|
|
|
|
// CHECK: 100d4 28000100 08849780 24000100 01000000
|
|
|
|
/// f3, __aeabi_unwind_cpp_pr0
|
|
|
|
// CHECK-NEXT: 100e4 20000100 01000000 1c000100 01000000
|
|
|
|
/// sentinel
|
|
|
|
// CHECK-NEXT: 100f4 18000100 01000000
|
2019-03-28 19:10:20 +08:00
|
|
|
|
2020-04-18 23:06:37 +08:00
|
|
|
/// f1, (f2, f3, __aeabi_unwind_cpp_pr0)
|
|
|
|
// CHECK-MERGE: 100d4 18000100 08849780 14000100 01000000
|
|
|
|
/// sentinel
|
|
|
|
// CHECK-MERGE-NEXT: 100e4 18000100 01000000
|
2019-03-28 19:10:20 +08:00
|
|
|
|