1# REQUIRES: arm
2# RUN: yaml2obj %s -o %t.o
3# RUN: ld.lld %t.o -o %t
4# RUN: llvm-objdump --triple=thumbv7a-linux-gnueabi -d %t | FileCheck %s
5
6# CHECK: Disassembly of section .text:
7# CHECK-EMPTY:
8# CHECK-NEXT: <_start>:
9# CHECK-NEXT:    ff e7   b       0x200b6 <_start+0x2> @ imm = #-2
10
11# Test the R_ARM_THM_JUMP11 relocation (102) to an undefined weak reference
12# It should resolve to the next instruction, which is an offset of -2 which
13# when added to the Thumb PC-bias of 4 is +2. We can't use llvm-mc to construct
14# the object as it relaxes b.n to b.w (R_ARM_JUMP24).
15
16!ELF
17FileHeader:
18  Class:           ELFCLASS32
19  Data:            ELFDATA2LSB
20  Type:            ET_REL
21  Machine:         EM_ARM
22Sections:
23  - Type:            SHT_PROGBITS
24    Name:            .text
25    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
26    Content:         "fee7"
27  - Type:            SHT_REL
28    Name:            .rel.text
29    Link:            .symtab
30    Info:            .text
31    Relocations:
32      - Symbol:          undefined_weak
33        Type:            R_ARM_THM_JUMP11
34
35Symbols:
36  - Type:             STT_NOTYPE
37    Name:             "$t"
38    Section:          .text
39    Value:            0
40  - Type:             STT_FUNC
41    Name:             _start
42    Value:            1
43    Section:          .text
44    Binding:          STB_GLOBAL
45  - Type:             STT_NOTYPE
46    Name:             undefined_weak
47    Value:            0
48    Binding:          STB_WEAK
49