1// REQUIRES: arm
2// RUN: llvm-mc --arm-add-build-attributes --triple=armv7a-linux-gnueabihf -filetype=obj %s -o %t.o
3// RUN: echo "SECTIONS { \
4// RUN:         /DISCARD/ : { *(.ARM.exidx.exit.text) *(.ARM.extab.exit.text)} \
5// RUN:         . = 0x90000000; \
6// RUN:         .ARM.exidx : { *(.ARM.exidx) } \
7// RUN:         .text : { *(.text) } \
8// RUN:         .exit.text : { *(.exit.text) } \
9// RUN:         .rodata : { *(.rodata) } \
10// RUN: } " > %t.script
11// RUN: ld.lld --script %t.script %t.o -o %t
12// RUN: llvm-readelf -x .ARM.exidx %t | FileCheck %s
13
14/// The linker script /DISCARDS/ the .ARM.exidx and .ARM.extab for the
15/// .exit.text . If we do not discard both sections we will end up with
16/// a dangling reference. We expect no linker error for an out of range
17/// relocation/dangling reference and just a single .ARM.exidx entry
18/// for _start and an entry for the terminating sentinel.
19
20// CHECK: Hex dump of section '.ARM.exidx':
21// CHECK-NEXT: 0x90000000 10000000 01000000 10000000 01000000
22// CHECK-NOT:  0x90000010
23 .text
24 .global _start
25 .type _start, %function
26_start:
27 .fnstart
28 bx lr
29 .cantunwind
30 .fnend
31
32 .section .exit.text, "ax", %progbits
33 .global exit_text
34 .type exit_text, %function
35exit_text:
36  .fnstart
37  bx lr
38 .personality __gxx_personality_v0
39 .handlerdata
40 .long 0
41 .fnend
42
43/// Dummy definition for a reference from the personality routine created by
44/// the assembler, use .data to avoid generating a cantunwind table.
45 .section .rodata
46 .global __aeabi_unwind_cpp_pr0
47__aeabi_unwind_cpp_pr0:
48 .word 0
49