File: arm-data-prel.s

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (59 lines) | stat: -rw-r--r-- 1,949 bytes parent folder | download | duplicates (25)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// REQUIRES: arm
// RUN: llvm-mc %s -triple=armv7-unknown-linux-gnueabi -filetype=obj --arm-add-build-attributes -o %t.o
// RUN: echo "SECTIONS { \
// RUN:          .text : { *(.text) } \
// RUN:          .prel.test : { *(.ARM.exidx) } \
// RUN:          .TEST1 : { *(.TEST1) } } " > %t.script
// RUN: ld.lld --script %t.script %t.o -o %t
// RUN: llvm-readobj -S --section-data %t | FileCheck --check-prefix=CHECK %s

// The R_ARM_PREL31 relocation is used in by the .ARM.exidx exception tables
// bit31 of the place denotes whether the field is an inline table entry
// (bit31=1) or relocation (bit31=0)
// The linker must preserve the value of bit31

// This test case is adapted from llvm/test/MC/ARM/eh-compact-pr0.s
// We use a linker script to place the .ARM.exidx sections in between
// the code sections so that we can test positive and negative offsets
 .syntax unified

 .section .TEST1, "ax",%progbits
 .globl _start
 .align 2
 .type  _start,%function
_start:
 .fnstart
 .save   {r11, lr}
 push    {r11, lr}
 .setfp  r11, sp
 mov     r11, sp
 pop     {r11, lr}
 mov     pc, lr
 .fnend

 .section .text, "ax",%progbits
// The generated .ARM.exidx section will refer to the personality
// routine __aeabi_unwind_cpp_pr0. Provide a dummy implementation
// to stop an undefined symbol error
 .globl __aeabi_unwind_cpp_pr0
 .align 2
 .type __aeabi_unwind_cpp_pr0,%function
__aeabi_unwind_cpp_pr0:
 .fnstart
 bx lr
 .fnend

// The expected value of the exception table is
// Word0 0 in bit 31, -4 encoded in 31-bit signed offset
// Word1 Inline table entry EHT Inline Personality Routine #0
// Word3 0 in bit 31, +10 encoded in 31-bit signed offset
// Word4 Inline table entry EHT Inline Personality Routine #0
// set vsp = r11
// pop r11, r14
// Word5 Sentinel +18 EXIDX_CANTUNWIND

// CHECK:  Name: .prel.test
// CHECK:  SectionData (
// CHECK:     0000: FCFFFF7F B0B0B080 10000000 80849B80
// CHECK:     0010: 18000000 01000000
// CHECK:  )