Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / ELF / arm-exidx-emit-relocs.s
blobd3b609fa75073161cc8d2cccb4197d7e1ad8d8ca
1 // REQUIRES: arm
2 // RUN: llvm-mc -filetype=obj --arm-add-build-attributes -triple=armv7a-none-linux-gnueabi %s -o %t
3 // RUN: ld.lld --emit-relocs %t -o %t2
4 // RUN: llvm-objdump -s --triple=armv7a-none-linux-gnueabi %t2 | FileCheck %s
5 // RUN: llvm-readelf --relocs %t2 | FileCheck -check-prefix=CHECK-RELOCS %s
7 // RUN: llvm-mc -filetype=obj --arm-add-build-attributes -triple=armv7aeb-none-linux-gnueabi -mcpu=cortex-a8 %s -o %t
8 // RUN: ld.lld --emit-relocs %t -o %t2
9 // RUN: llvm-objdump -s --triple=armv7aeb-none-linux-gnueabi %t2 | FileCheck -check-prefix=CHECK-EB %s
10 // RUN: llvm-readelf --relocs %t2 | FileCheck -check-prefix=CHECK-RELOCS %s
12 // RUN: ld.lld --be8 --emit-relocs %t -o %t2
13 // RUN: llvm-objdump -s --triple=armv7aeb-none-linux-gnueabi %t2 | FileCheck -check-prefix=CHECK-EB %s
14 // RUN: llvm-readelf --relocs %t2 | FileCheck -check-prefix=CHECK-RELOCS %s
16 /// LLD does not support --emit-relocs for .ARM.exidx sections as the relocations
17 /// from synthetic table entries won't be represented. Given the known use cases
18 /// of --emit-relocs, relocating kernels, and binary analysis, the former doesn't
19 /// use exceptions and the latter can derive the relocations from the table if
20 /// they need them.
21 .syntax unified
22 /// Will produce an ARM.exidx entry with inline unwinding instructions
23 .section .text.func1, "ax",%progbits
24 .global func1
25 func1:
26 .fnstart
27 bx lr
28 .save {r7, lr}
29 .setfp r7, sp, #0
30 .fnend
32 .syntax unified
33 .section .text.func2, "ax",%progbits
34 /// A function with the same inline unwinding instructions, expect merge.
35 .global func2
36 func2:
37 .fnstart
38 bx lr
39 .save {r7, lr}
40 .setfp r7, sp, #0
41 .fnend
43 .section .text.25, "ax", %progbits
44 .global func25
45 func25:
46 .fnstart
47 bx lr
48 .cantunwind
49 .fnend
51 .section .text.26, "ax", %progbits
52 .global func26
53 func26:
54 .fnstart
55 bx lr
56 .cantunwind
57 .fnend
59 .syntax unified
60 .section .text.func3, "ax",%progbits
61 /// A function with the same inline unwinding instructions, expect merge.
62 .global func3
63 func3:
64 .fnstart
65 bx lr
66 .save {r7, lr}
67 .setfp r7, sp, #0
68 .fnend
70 .section .text.__aeabi_unwind_cpp_pr0, "ax", %progbits
71 .global __aeabi_unwind_cpp_pr0
72 __aeabi_unwind_cpp_pr0:
73 bx lr
75 // CHECK: Contents of section .ARM.exidx:
76 // CHECK-NEXT: 100d4 28000100 08849780 28000100 01000000
77 // CHECK-NEXT: 100e4 28000100 08849780 24000100 01000000
78 // CHECK-NEXT: 100f4 20000100 01000000
80 // CHECK-RELOCS-NOT: Relocation section '.rel.ARM.exidx'
82 // CHECK-EB: Contents of section .ARM.exidx:
83 // CHECK-EB-NEXT: 100d4 00010028 80978408 00010028 00000001
84 // CHECK-EB-NEXT: 100e4 00010028 80978408 00010024 00000001
85 // CHECK-EB-NEXT: 100f4 00010020 00000001