1// REQUIRES: arm 2// RUN: llvm-mc --triple=armv7a-none-eabi --arm-add-build-attributes -filetype=obj -o %t.o %s 3// RUN: echo "SECTIONS { \ 4// RUN: .text.0 0x10000000 : AT(0x10000000) { *(.text.0) } \ 5// RUN: .text.1 0x80000000 : AT(0x80000000) { *(.text.1) } \ 6// RUN: .text.2 0xf0000010 : AT(0xf0000010) { *(.text.2) } \ 7// RUN: } " > %t.script 8// RUN: ld.lld --script %t.script %t.o -o %t 9// RUN: llvm-objdump -d --no-show-raw-insn --triple=armv7a-none-eabi %t | FileCheck %s 10 11/// Test the long range encoding of R_ARM_ALU_PC_G0. We can encode an 8-bit 12/// immediate rotated right by an even 4-bit field. 13 .section .text.0, "ax", %progbits 14dat1: 15 .word 0 16 17 .section .text.1, "ax", %progbits 18 .global _start 19 .type _start, %function 20_start: 21/// adr.w r0, dat1 22 .inst 0xe24f0008 23 .reloc 0, R_ARM_ALU_PC_G0, dat1 24/// adr.w r1, dat2 25 .inst 0xe24f1008 26 .reloc 4, R_ARM_ALU_PC_G0, dat2 27 28 .section .text.2, "ax", %progbits 29dat2: 30 .word 0 31 32// CHECK: 10000000 <dat1>: 33// CHECK-NEXT: 10000000: andeq r0, r0, r0 34 35// CHECK: 80000000 <_start>: 36/// 0x80000000 + 0x8 - 0x70000008 = 0x10000000 37// CHECK-NEXT: 80000000: sub r0, pc, #1879048200 38/// 0x80000004 + 0x8 + 0x70000004 = 0xf0000010 39// CHECK-NEXT: 80000004: add r1, pc, #1879048196 40 41// CHECK: f0000010 <dat2>: 42// CHECK-NEXT: f0000010: andeq r0, r0, r0 43