2018-06-27 06:20:04 +08:00
|
|
|
// REQUIRES: arm
|
2016-10-18 02:12:24 +08:00
|
|
|
// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t.o
|
2019-07-22 19:37:03 +08:00
|
|
|
// RUN: ld.lld %t.o -o %t
|
2016-10-18 02:12:24 +08:00
|
|
|
// RUN: llvm-objdump -s -triple=armv7a-none-linux-gnueabi %t | FileCheck %s
|
2019-07-22 19:37:03 +08:00
|
|
|
// RUN: ld.lld %t.o --target2=got-rel -o %t2
|
2016-10-18 02:12:24 +08:00
|
|
|
// RUN: llvm-objdump -s -triple=armv7a-none-linux-gnueabi %t2 | FileCheck %s
|
2019-07-22 19:37:03 +08:00
|
|
|
// RUN: ld.lld %t.o --target2=abs -o %t3
|
2016-10-18 02:12:24 +08:00
|
|
|
// RUN: llvm-objdump -s -triple=armv7a-none-linux-gnueabi %t3 | FileCheck -check-prefix=CHECK-ABS %s
|
2019-07-22 19:37:03 +08:00
|
|
|
// RUN: ld.lld %t.o --target2=rel -o %t4
|
2016-10-18 02:12:24 +08:00
|
|
|
// 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:
|
2019-08-27 19:52:36 +08:00
|
|
|
// 0x1012c + 0x2010 = 0x1213c = .got
|
|
|
|
// CHECK-NEXT: 10124 14100000 b0b0b000 10200000
|
2016-10-18 02:12:24 +08:00
|
|
|
|
|
|
|
// CHECK-ABS: Contents of section .ARM.extab:
|
2018-06-27 06:13:32 +08:00
|
|
|
// 0x100f0 = .rodata
|
2019-08-27 19:52:36 +08:00
|
|
|
// CHECK-ABS-NEXT: 100e4 14100000 b0b0b000 f0000100
|
2016-10-18 02:12:24 +08:00
|
|
|
|
|
|
|
// CHECK-REL: Contents of section .ARM.extab:
|
2018-06-27 06:13:32 +08:00
|
|
|
// 0x100ec + 4 = 0x100f0 = .rodata
|
2019-08-27 19:52:36 +08:00
|
|
|
// CHECK-REL-NEXT: 100e4 14100000 b0b0b000 04000000
|
2016-10-18 02:12:24 +08:00
|
|
|
|
|
|
|
// CHECK: Contents of section .rodata:
|
2016-11-24 19:43:55 +08:00
|
|
|
// CHECK-NEXT: 10130 00000000
|
2016-10-18 02:12:24 +08:00
|
|
|
|
|
|
|
// CHECK-ABS: Contents of section .rodata:
|
2016-11-24 19:43:55 +08:00
|
|
|
// CHECK-ABS-NEXT: 100f0 00000000
|
2016-10-18 02:12:24 +08:00
|
|
|
|
|
|
|
// CHECK-REL: Contents of section .rodata:
|
2016-11-24 19:43:55 +08:00
|
|
|
// CHECK-REL-NEXT: 100f0 00000000
|
2016-10-18 02:12:24 +08:00
|
|
|
|
|
|
|
// CHECK: Contents of section .got:
|
2016-11-24 19:43:55 +08:00
|
|
|
// 10130 = _ZTIi
|
2019-08-27 19:52:36 +08:00
|
|
|
// CHECK-NEXT: 1213c 30010100
|