1// REQUIRES: arm 2// RUN: split-file %s %t 3// RUN: llvm-mc --triple=armv7a-none-eabi --arm-add-build-attributes -filetype=obj -o %t.o %t/asm 4// RUN: not ld.lld --script %t/lds %t.o -o /dev/null 2>&1 | FileCheck %s 5 6//--- lds 7SECTIONS { 8 .text.0 0x0100000 : AT(0x0100000) { *(.text.0) } 9 .text.1 0x0800000 : AT(0x0800000) { *(.text.1) } 10 .text.2 0xf0f0000 : AT(0xf0f0000) { *(.text.2) } 11} 12 13//--- asm 14/// This is a variant of arm-adr-long.s with some _NC relocs changed into their 15/// checking counterparts, to verify that out-of-range references are caught. 16 17 .section .text.0, "ax", %progbits 18dat1: 19 .word 0 20 21 .section .text.1, "ax", %progbits 22 .global _start 23 .type _start, %function 24_start: 25 .inst 0xe24f0008 // sub r0, pc, #8 26 .inst 0xe2400004 // sub r0, r0, #4 27 .reloc 0, R_ARM_ALU_PC_G0, dat1 28// CHECK: {{.*}}.s.tmp.o:(.text.1+0x0): unencodeable immediate 7340040 for relocation R_ARM_ALU_PC_G0 29 .reloc 4, R_ARM_ALU_PC_G1, dat1 30 31 .inst 0xe24f1008 // sub r1, pc, #8 32 .inst 0xe2411004 // sub r1, r1, #4 33 .inst 0xe2411000 // sub r1, r1, #0 34 .reloc 8, R_ARM_ALU_PC_G0_NC, dat2 35 .reloc 12, R_ARM_ALU_PC_G1, dat2 36// CHECK: {{.*}}.s.tmp.o:(.text.1+0xc): unencodeable immediate 244252656 for relocation R_ARM_ALU_PC_G1 37 .reloc 16, R_ARM_ALU_PC_G2, dat2 38 39 .inst 0xe24f0008 // sub r0, pc, #8 40 .inst 0xe2400004 // sub r0, r0, #4 41 .inst 0xe2400000 // sub r0, r0, #0 42 .reloc 20, R_ARM_ALU_PC_G0, dat1 43// CHECK: {{.*}}.s.tmp.o:(.text.1+0x14): unencodeable immediate 7340060 for relocation R_ARM_ALU_PC_G0 44 .reloc 24, R_ARM_ALU_PC_G1, dat1 45 .reloc 28, R_ARM_ALU_PC_G2, dat1 46 47 .inst 0xe24f0008 // sub r0, pc, #8 48 .inst 0xe2400004 // sub r0, r0, #4 49 .inst 0xe1c000d0 // ldrd r0, r1, [r0, #0] 50 .reloc 32, R_ARM_ALU_PC_G0_NC, dat2 51 .reloc 36, R_ARM_ALU_PC_G1_NC, dat2 52// CHECK: {{.*}}.s.tmp.o:(.text.1+0x28): relocation R_ARM_LDRS_PC_G2 out of range: 4056 is not in [0, 255]; references 'dat2' 53 .reloc 40, R_ARM_LDRS_PC_G2, dat2 54 55 .section .text.2, "ax", %progbits 56dat2: 57 .word 0 58