1// REQUIRES: arm 2// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t.o 3// RUN: ld.lld %t.o -o %t 4// RUN: llvm-objdump -s --triple=armv7a-none-linux-gnueabi %t | FileCheck %s 5// RUN: ld.lld %t.o --target2=got-rel -o %t2 6// RUN: llvm-objdump -s --triple=armv7a-none-linux-gnueabi %t2 | FileCheck %s 7// RUN: ld.lld %t.o --target2=abs -o %t3 8// RUN: llvm-objdump -s --triple=armv7a-none-linux-gnueabi %t3 | FileCheck --check-prefix=CHECK-ABS %s 9// RUN: ld.lld %t.o --target2=rel -o %t4 10// RUN: llvm-objdump -s --triple=armv7a-none-linux-gnueabi %t4 | FileCheck --check-prefix=CHECK-REL %s 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// 0x1012c + 0x2010 = 0x1213c = .got 39// CHECK-NEXT: 10124 14000100 b0b0b000 10000200 40 41// CHECK-ABS: Contents of section .ARM.extab: 42// 0x100f0 = .rodata 43// CHECK-ABS-NEXT: 100e4 14000100 b0b0b000 f0000100 44 45// CHECK-REL: Contents of section .ARM.extab: 46// 0x100ec + 4 = 0x100f0 = .rodata 47// CHECK-REL-NEXT: 100e4 14000100 b0b0b000 04000000 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: 3013c 30010100 61