brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.7 KiB · 5c172b1 Raw
127 lines · plain
1// REQUIRES: arm2// RUN: llvm-mc -filetype=obj --arm-add-build-attributes -triple=armv7a-none-linux-gnueabi %s -o %t3// RUN: ld.lld %t --no-merge-exidx-entries -o %t2 --gc-sections4// RUN: llvm-objdump -d --triple=armv7a-none-linux-gnueabi --no-show-raw-insn %t2 | FileCheck %s5// RUN: llvm-objdump -s --triple=armv7a-none-linux-gnueabi %t2 | FileCheck --check-prefix=CHECK-EXIDX %s6 7/// Test the behavior of .ARM.exidx sections under garbage collection8/// A .ARM.exidx section is live if it has a relocation to a live executable9/// section.10/// A .ARM.exidx section may have a relocation to a .ARM.extab section, if the11/// .ARM.exidx is live then the .ARM.extab section is live12 13 .syntax unified14 .section .text.func1, "ax",%progbits15 .global func116func1:17 .fnstart18 bx lr19 .save {r7, lr}20 .setfp r7, sp, #021 .fnend22 23 .section .text.unusedfunc1, "ax",%progbits24 .global unusedfunc125unusedfunc1:26 .fnstart27 bx lr28 .cantunwind29 .fnend30 31 /// Unwinding instructions for .text2 too large for an inline entry ARM.exidx32 /// entry. A separate .ARM.extab section is created to hold the unwind entries33 /// The .ARM.exidx table entry has a reference to the .ARM.extab section.34 .section .text.func2, "ax",%progbits35 .global func236func2:37 .fnstart38 bx lr39 .personality __gxx_personality_v040 .handlerdata41 .section .text.func242 .fnend43 44 /// An unused function with a reference to a .ARM.extab section. Both should45 /// be removed by gc.46 .section .text.unusedfunc2, "ax",%progbits47 .global unusedfunc248unusedfunc2:49 .fnstart50 bx lr51 .personality __gxx_personality_v152 .handlerdata53 .section .text.unusedfunc254 .fnend55 56 /// Dummy implementation of personality routines to satisfy reference from57 /// exception tables58 .section .text.__gcc_personality_v0, "ax", %progbits59 .global __gxx_personality_v060__gxx_personality_v0:61 .fnstart62 bx lr63 .cantunwind64 .fnend65 66 .section .text.__gcc_personality_v1, "ax", %progbits67 .global __gxx_personality_v168__gxx_personality_v1:69 .fnstart70 bx lr71 .cantunwind72 .fnend73 74 .section .text.__aeabi_unwind_cpp_pr0, "ax", %progbits75 .global __aeabi_unwind_cpp_pr076__aeabi_unwind_cpp_pr0:77 .fnstart78 bx lr79 .cantunwind80 .fnend81 82// Entry point for GC83 .text84 .global _start85_start:86 bl func187 bl func288 bx lr89 90/// GC should have only removed unusedfunc1 and unusedfunc2 the personality91/// routines are kept alive by references from live .ARM.exidx and .ARM.extab92/// sections93// CHECK: Disassembly of section .text:94// CHECK-EMPTY:95// CHECK-NEXT: <_start>:96// CHECK-NEXT:   2010c:       bl      0x20118 <func1>97// CHECK-NEXT:   20110:       bl      0x2011c <func2>98// CHECK-NEXT:   20114:       bx      lr99// CHECK: <func1>:100// CHECK-NEXT:   20118:       bx      lr101// CHECK: <func2>:102// CHECK-NEXT:   2011c:       bx      lr103// CHECK: <__gxx_personality_v0>:104// CHECK-NEXT:   20120:       bx      lr105// CHECK: <__aeabi_unwind_cpp_pr0>:106// CHECK-NEXT:   20124:       bx      lr107 108/// GC should have removed table entries for unusedfunc1, unusedfunc2109/// and __gxx_personality_v1110// CHECK-NOT: unusedfunc1111// CHECK-NOT: unusedfunc2112// CHECK-NOT: __gxx_personality_v1113 114/// CHECK-EXIDX: Contents of section .ARM.exidx:115/// 100d4 + 1038 = 1110c = _start116/// 100dc + 103c = 11118 = func1117// CHECK-EXIDX-NEXT: 100d4 38000100 01000000 3c000100 08849780118/// 100e4 + 1038 = 1111c = func2 (100e8 + 1c = 10104 = .ARM.extab)119/// 100ec + 1034 = 11120 = __gxx_personality_v0120// CHECK-EXIDX-NEXT: 100e4 38000100 1c000000 34000100 01000000121/// 100f4 + 1030 = 11018 = __aeabi_unwind_cpp_pr0122/// 100fc + 102c = 1101c = __aeabi_unwind_cpp_pr0 + sizeof(__aeabi_unwind_cpp_pr0)123// CHECK-EXIDX-NEXT: 100f4 30000100 01000000 2c000100 01000000124// CHECK-EXIDX-NEXT: Contents of section .ARM.extab:125/// 10104 + 101c = 11120 = __gxx_personality_v0126// CHECK-EXIDX-NEXT: 10104 1c000100 b0b0b000127