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 %t --no-merge-exidx-entries -o %t2 4// RUN: llvm-objdump -s %t2 | FileCheck --check-prefix CHECK-DUPS %s 5// RUN: ld.lld %t -o %t3 6// RUN: llvm-objdump -s %t3 | FileCheck %s 7 8/// Test that lld can at least remove duplicate .ARM.exidx sections. A more 9/// fine grained implementation will be able to remove duplicate entries within 10/// a .ARM.exidx section. 11 12/// With duplicate entries 13// CHECK-DUPS: Contents of section .ARM.exidx: 14// CHECK-DUPS-NEXT: 100d4 78000100 01000000 74000100 01000000 15// CHECK-DUPS-NEXT: 100e4 70000100 01000000 6c000100 01000000 16// CHECK-DUPS-NEXT: 100f4 68000100 08849780 64000100 08849780 17// CHECK-DUPS-NEXT: 10104 60000100 08849780 5c000100 24000000 18// CHECK-DUPS-NEXT: 10114 58000100 28000000 54000100 01000000 19// CHECK-DUPS-NEXT: 10124 50000100 01000000 4c000100 01000000 20// CHECK-DUPS-NEXT: Contents of section .ARM.extab: 21 22/// After duplicate entry removal 23// CHECK: Contents of section .ARM.exidx: 24// CHECK-NEXT: 100d4 48000100 01000000 50000100 08849780 25// CHECK-NEXT: 100e4 54000100 1c000000 50000100 20000000 26// CHECK-NEXT: 100f4 4c000100 01000000 4c000100 01000000 27// CHECK-NEXT: Contents of section .ARM.extab: 28 .syntax unified 29 30 /// Expect 1 EXIDX_CANTUNWIND entry. 31 .section .text.00, "ax", %progbits 32 .globl _start 33_start: 34 .fnstart 35 bx lr 36 .cantunwind 37 .fnend 38 39 /// Expect .ARM.exidx.text.01 to be identical to .ARM.exidx.text.00 40 .section .text.01, "ax", %progbits 41 .globl f1 42f1: 43 .fnstart 44 bx lr 45 .cantunwind 46 .fnend 47 48 /// Expect 2 EXIDX_CANTUNWIND entries, these can be duplicated into 49 /// .ARM.exid.text.00 50 .section .text.02, "ax", %progbits 51 .globl f2 52f2: 53 .fnstart 54 bx lr 55 .cantunwind 56 .fnend 57 58 .globl f3 59f3: 60 .fnstart 61 bx lr 62 .cantunwind 63 .fnend 64 65 /// Expect inline unwind instructions, not a duplicate of previous entry. 66 .section .text.03, "ax", %progbits 67 .global f4 68f4: 69 .fnstart 70 bx lr 71 .save {r7, lr} 72 .setfp r7, sp, #0 73 .fnend 74 75 /// Expect 2 inline unwind entries that are a duplicate of 76 /// .ARM.exidx.text.03 77 .section .text.04, "ax", %progbits 78 .global f5 79f5: 80 .fnstart 81 bx lr 82 .save {r7, lr} 83 .setfp r7, sp, #0 84 .fnend 85 86 .global f6 87f6: 88 .fnstart 89 bx lr 90 .save {r7, lr} 91 .setfp r7, sp, #0 92 .fnend 93 94 /// Expect a section with a reference to an .ARM.extab. Not a duplicate 95 /// of previous inline table entry. 96 .section .text.05, "ax",%progbits 97 .global f7 98f7: 99 .fnstart 100 bx lr 101 .personality __gxx_personality_v0 102 .handlerdata 103 .long 0 104 .fnend 105 106 /// Expect a reference to an identical .ARM.extab. We do not try to 107 /// deduplicate references to .ARM.extab sections. 108 .section .text.06, "ax",%progbits 109 .global f8 110f8: 111 .fnstart 112 bx lr 113 .personality __gxx_personality_v0 114 .handlerdata 115 .long 0 116 .fnend 117 118/// Dummy implementation of personality routines to satisfy reference from 119/// exception tables 120/// Expect Linker generated EXIDX_CANTUNWIND tables 121 .section .text.__gcc_personality_v0, "ax", %progbits 122 .global __gxx_personality_v0 123__gxx_personality_v0: 124 bx lr 125 126 .section .text.__aeabi_unwind_cpp_pr0, "ax", %progbits 127 .global __aeabi_unwind_cpp_pr0 128__aeabi_unwind_cpp_pr0: 129 bx lr 130