File: arm-target2.s

package info (click to toggle)
llvm-toolchain-9 1%3A9.0.1-16
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 882,436 kB
  • sloc: cpp: 4,167,636; ansic: 714,256; asm: 457,610; python: 155,927; objc: 65,094; sh: 42,856; lisp: 26,908; perl: 7,786; pascal: 7,722; makefile: 6,881; ml: 5,581; awk: 3,648; cs: 2,027; xml: 888; javascript: 381; ruby: 156
file content (60 lines) | stat: -rw-r--r-- 1,924 bytes parent folder | download | duplicates (5)
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
60
// REQUIRES: arm
// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t.o
// RUN: ld.lld %t.o -o %t 2>&1
// RUN: llvm-objdump -s -triple=armv7a-none-linux-gnueabi %t | FileCheck %s
// RUN: ld.lld %t.o --target2=got-rel -o %t2 2>&1
// RUN: llvm-objdump -s -triple=armv7a-none-linux-gnueabi %t2 | FileCheck %s
// RUN: ld.lld %t.o --target2=abs -o %t3 2>&1
// RUN: llvm-objdump -s -triple=armv7a-none-linux-gnueabi %t3 | FileCheck -check-prefix=CHECK-ABS %s
// RUN: ld.lld %t.o --target2=rel -o %t4 2>&1
// RUN: llvm-objdump -s -triple=armv7a-none-linux-gnueabi %t4 | FileCheck -check-prefix=CHECK-REL %s

// The R_ARM_TARGET2 is present in .ARM.extab sections. It can be handled as
// either R_ARM_ABS32, R_ARM_REL32 or R_ARM_GOT_PREL. For ARM linux the default
// is R_ARM_GOT_PREL. The other two options are primarily used for bare-metal,
// they can be selected with the --target2=abs or --target2=rel option.
 .syntax unified
 .text
 .globl _start
 .align 2
_start:
 .type function, %function
 .fnstart
 bx lr
 .personality   __gxx_personality_v0
 .handlerdata
 .word  _ZTIi(TARGET2)
 .text
 .fnend
 .global __gxx_personality_v0
 .type function, %function
__gxx_personality_v0:
 bx lr

 .rodata
_ZTIi:  .word 0

// CHECK: Contents of section .ARM.extab:
// 0x1012c + 0x1ed4 = 0x12000 = .got
// CHECK-NEXT:  10124 e00e0000 b0b0b000 d41e0000

// CHECK-ABS: Contents of section .ARM.extab:
// 0x100f0 = .rodata
// CHECK-ABS-NEXT: 100e4 200f0000 b0b0b000 f0000100

// CHECK-REL: Contents of section .ARM.extab:
// 0x100ec + 4 = 0x100f0 = .rodata
// CHECK-REL-NEXT: 100e4 200f0000 b0b0b000 04000000

// CHECK: Contents of section .rodata:
// CHECK-NEXT: 10130 00000000

// CHECK-ABS: Contents of section .rodata:
// CHECK-ABS-NEXT: 100f0 00000000

// CHECK-REL: Contents of section .rodata:
// CHECK-REL-NEXT: 100f0 00000000

// CHECK: Contents of section .got:
// 10130 = _ZTIi
// CHECK-NEXT: 12000 30010100