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 -d --triple=armv7a-none-linux-gnueabi %t | FileCheck %s 5 6// Test the R_ARM_SBREL32 relocation which calculates the offset of the Symbol 7// from the static base. We define the static base to be the address of the 8// segment containing the symbol 9 .text 10 .syntax unified 11 12 .globl _start 13 .p2align 2 14 .type _start,%function 15_start: 16 .fnstart 17 bx lr 18 19 .long foo(sbrel) 20 .long foo2(sbrel) 21 .long foo3(sbrel) 22 .long foo4(sbrel) 23// RW segment starts here 24 .data 25 .p2align 4 26foo: .word 10 27foo2: .word 20 28 29 .bss 30foo3: .space 4 31foo4: .space 4 32 33// CHECK: Disassembly of section .text: 34// CHECK-EMPTY: 35// CHECK-NEXT: <_start>: 36// CHECK-NEXT: 200d4: 1e ff 2f e1 bx lr 37// CHECK: 200d8: 00 00 00 00 .word 0x00000000 38// CHECK-NEXT: 200dc: 04 00 00 00 .word 0x00000004 39// CHECK-NEXT: 200e0: 08 00 00 00 .word 0x00000008 40// CHECK-NEXT: 200e4: 0c 00 00 00 .word 0x0000000c 41