• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// REQUIRES: arm
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
9
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
14
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
18 .syntax unified
19
20 .section .TEST1, "ax",%progbits
21 .globl _start
22 .align 2
23 .type  _start,%function
24_start:
25 .fnstart
26 .save   {r11, lr}
27 push    {r11, lr}
28 .setfp  r11, sp
29 mov     r11, sp
30 pop     {r11, lr}
31 mov     pc, lr
32 .fnend
33
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
39 .align 2
40 .type __aeabi_unwind_cpp_pr0,%function
41__aeabi_unwind_cpp_pr0:
42 .fnstart
43 bx lr
44 .fnend
45
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
51// set vsp = r11
52// pop r11, r14
53// Word5 Sentinel +18 EXIDX_CANTUNWIND
54
55// CHECK:  Name: .prel.test
56// CHECK:  SectionData (
57// CHECK:     0000: FCFFFF7F B0B0B080 10000000 80849B80
58// CHECK:     0010: 18000000 01000000
59// CHECK:  )
60