]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/ELF/arm-target2.s
Vendor import of lld trunk r290819:
[FreeBSD/FreeBSD.git] / test / ELF / arm-target2.s
1 // RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t.o
2 // RUN: ld.lld %t.o -o %t 2>&1
3 // RUN: llvm-objdump -s -triple=armv7a-none-linux-gnueabi %t | FileCheck %s
4 // RUN: ld.lld %t.o --target2=got-rel -o %t2 2>&1
5 // RUN: llvm-objdump -s -triple=armv7a-none-linux-gnueabi %t2 | FileCheck %s
6 // RUN: ld.lld %t.o --target2=abs -o %t3 2>&1
7 // RUN: llvm-objdump -s -triple=armv7a-none-linux-gnueabi %t3 | FileCheck -check-prefix=CHECK-ABS %s
8 // RUN: ld.lld %t.o --target2=rel -o %t4 2>&1
9 // RUN: llvm-objdump -s -triple=armv7a-none-linux-gnueabi %t4 | FileCheck -check-prefix=CHECK-REL %s
10 // REQUIRES: arm
11
12 // The R_ARM_TARGET2 is present in .ARM.extab sections. It can be handled as
13 // either R_ARM_ABS32, R_ARM_REL32 or R_ARM_GOT_PREL. For ARM linux the default
14 // is R_ARM_GOT_PREL. The other two options are primarily used for bare-metal,
15 // they can be selected with the --target2=abs or --target2=rel option.
16  .syntax unified
17  .text
18  .globl _start
19  .align 2
20 _start:
21  .type function, %function
22  .fnstart
23  bx lr
24  .personality   __gxx_personality_v0
25  .handlerdata
26  .word  _ZTIi(TARGET2)
27  .text
28  .fnend
29  .global __gxx_personality_v0
30  .type function, %function
31 __gxx_personality_v0:
32  bx lr
33
34  .rodata
35 _ZTIi:  .word 0
36
37 // CHECK: Contents of section .ARM.extab:
38 // 1011c + 1ee4 = 12000 = .got
39 // CHECK-NEXT:  10114 f00e0000 b0b0b000 e41e0000
40
41 // CHECK-ABS: Contents of section .ARM.extab:
42 // 100f0 = .rodata
43 // CHECK-ABS-NEXT: 100d4 300f0000 b0b0b000 f0000100
44
45 // CHECK-REL: Contents of section .ARM.extab:
46 // 100dc + c = 100e8 = .rodata
47 // CHECK-REL-NEXT: 100d4 300f0000 b0b0b000 14000000
48
49 // CHECK: Contents of section .rodata:
50 // CHECK-NEXT: 10130 00000000
51
52 // CHECK-ABS: Contents of section .rodata:
53 // CHECK-ABS-NEXT: 100f0 00000000
54
55 // CHECK-REL: Contents of section .rodata:
56 // CHECK-REL-NEXT: 100f0 00000000
57
58 // CHECK: Contents of section .got:
59 // 10130 = _ZTIi
60 // CHECK-NEXT: 12000 30010100