File: arm-exidx-add-missing.s

package info (click to toggle)
llvm-toolchain-11 1%3A11.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 995,808 kB
  • sloc: cpp: 4,767,656; ansic: 760,916; asm: 477,436; python: 170,940; objc: 69,804; lisp: 29,914; sh: 23,855; f90: 18,173; pascal: 7,551; perl: 7,471; ml: 5,603; awk: 3,489; makefile: 2,573; xml: 915; cs: 573; fortran: 503; javascript: 452
file content (66 lines) | stat: -rw-r--r-- 2,283 bytes parent folder | download | duplicates (21)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// REQUIRES: arm
// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi --arm-add-build-attributes %s -o %t
// RUN: ld.lld %t --no-merge-exidx-entries -o %t2
// RUN: llvm-objdump -s %t2 | FileCheck %s
// RUN: ld.lld %t -o %t3
// RUN: llvm-objdump -s %t3 | FileCheck %s --check-prefix=CHECK-MERGE

/// 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.

        .syntax unified

        /// Expect inline unwind instructions
        .section .text.01, "ax", %progbits
        .global f1
f1:
        .fnstart
        bx lr
        .save {r7, lr}
        .setfp r7, sp, #0
        .fnend

        /// 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.
        .section .text.02, "ax", %progbits
        .global f2
f2:
        bx lr


        /// Expect 1 EXIDX_CANTUNWIND entry that can be merged into the linker
        /// generated EXIDX_CANTUNWIND as if the assembler had generated it.
        .section .text.03, "ax",%progbits
        .global f3
f3:
        .fnstart
        bx lr
        .cantunwind
        .fnend

        /// Dummy implementation of personality routines to satisfy reference
        /// from exception tables, linker will generate EXIDX_CANTUNWIND.
        .section .text.__aeabi_unwind_cpp_pr0, "ax", %progbits
        .global __aeabi_unwind_cpp_pr0
__aeabi_unwind_cpp_pr0:
        bx lr

/// 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

/// f1, (f2, f3, __aeabi_unwind_cpp_pr0)
// CHECK-MERGE:      100d4 18000100 08849780 14000100 01000000
/// sentinel
// CHECK-MERGE-NEXT: 100e4 18000100 01000000