2 // RUN
: llvm-mc
%s
-triple
=armv7-unknown-linux-gnueabi
-filetype
=obj
--arm-add-build-attributes
-o
%t.o
3 // RUN
: echo
"SECTIONS { \
4 // RUN: .text : { *(.text) } \
5 // RUN: .prel.test : { *(.ARM.exidx) } \
6 // RUN: .TEST1 : { *(.TEST1) } } " > %t.script
7 // RUN
: ld.lld
--script
%t.script
%t.o
-o
%t
8 // RUN
: llvm-readobj
-S
--section-data
%t | FileCheck
--check-prefix
=CHECK
%s
10 // The R_ARM_PREL31 relocation is used in by the
.ARM.exidx exception tables
11 // bit31 of the place denotes whether the field is an inline table entry
12 // (bit31
=1) or relocation
(bit31
=0)
13 // The linker must preserve the value of bit31
15 // This test case is adapted from llvm
/test
/MC
/ARM
/eh-compact-pr0.s
16 // We use
a linker script to place the
.ARM.exidx sections in between
17 // the code sections so that we can test positive
and negative offsets
20 .section .TEST1, "ax",%progbits
23 .type _start,%function
34 .section .text, "ax",%progbits
35 // The generated
.ARM.exidx section will refer to the personality
36 // routine __aeabi_unwind_cpp_pr0. Provide
a dummy implementation
37 // to stop an undefined symbol error
38 .globl __aeabi_unwind_cpp_pr0
40 .type __aeabi_unwind_cpp_pr0,%function
41 __aeabi_unwind_cpp_pr0
:
46 // The expected value of the exception table is
47 // Word0
0 in bit
31, -4 encoded in
31-bit signed offset
48 // Word1 Inline table entry EHT Inline Personality Routine
#0
49 // Word3
0 in bit
31, +10 encoded in
31-bit signed offset
50 // Word4 Inline table entry EHT Inline Personality Routine
#0
53 // Word5 Sentinel
+18 EXIDX_CANTUNWIND
55 // CHECK
: Name
: .prel.test
56 // CHECK
: SectionData
(
57 // CHECK
: 0000: FCFFFF7F B0B0B080
10000000 80849B80
58 // CHECK
: 0010: 18000000 01000000