1# REQUIRES: arm
2# RUN: yaml2obj < %s > %t.obj
3# RUN: lld-link %t.obj %p/Inputs/library.lib /subsystem:console \
4# RUN:   /entry:mainCRTStartup /alternatename:__delayLoadHelper2=mainCRTStartup \
5# RUN:   /delayload:library.dll /out:%t.exe
6# RUN: llvm-readobj --coff-imports %t.exe | FileCheck -check-prefix=IMPORT %s
7# RUN: llvm-readobj --coff-basereloc %t.exe | FileCheck -check-prefix=BASEREL %s
8# RUN: llvm-objdump -d %t.exe | FileCheck --check-prefix=DISASM %s
9
10# IMPORT:      Format: COFF-ARM
11# IMPORT-NEXT: Arch: thumb
12# IMPORT-NEXT: AddressSize: 32bit
13# IMPORT-NEXT: DelayImport {
14# IMPORT-NEXT:   Name: library.dll
15# IMPORT-NEXT:   Attributes: 0x1
16# IMPORT-NEXT:   ModuleHandle: 0x3000
17# IMPORT-NEXT:   ImportAddressTable: 0x3008
18# IMPORT-NEXT:   ImportNameTable: 0x2040
19# IMPORT-NEXT:   BoundDelayImportTable: 0x0
20# IMPORT-NEXT:   UnloadDelayImportTable: 0x0
21# IMPORT-NEXT:   Import {
22# IMPORT-NEXT:     Symbol: function (0)
23# IMPORT-NEXT:     Address: 0x40100D
24# IMPORT-NEXT:   }
25# IMPORT-NEXT: }
26#
27# BASEREL:      BaseReloc [
28# BASEREL-NEXT:   Entry {
29# BASEREL-NEXT:     Type: ARM_MOV32(T)
30# BASEREL-NEXT:     Address: 0x1000
31# BASEREL-NEXT:   }
32# BASEREL-NEXT:   Entry {
33# BASEREL-NEXT:     Type: ARM_MOV32(T)
34# BASEREL-NEXT:     Address: 0x100C
35# BASEREL-NEXT:   }
36# BASEREL-NEXT:   Entry {
37# BASEREL-NEXT:     Type: ARM_MOV32(T)
38# BASEREL-NEXT:     Address: 0x1026
39# BASEREL-NEXT:   }
40# BASEREL-NEXT:   Entry {
41# BASEREL-NEXT:     Type: ABSOLUTE
42# BASEREL-NEXT:     Address: 0x1000
43# BASEREL-NEXT:   }
44# BASEREL-NEXT:   Entry {
45# BASEREL-NEXT:     Type: HIGHLOW
46# BASEREL-NEXT:     Address: 0x3008
47# BASEREL-NEXT:   }
48# BASEREL-NEXT:   Entry {
49# BASEREL-NEXT:     Type: ABSOLUTE
50# BASEREL-NEXT:     Address: 0x3000
51# BASEREL-NEXT:   }
52# BASEREL-NEXT: ]
53#
54# DISASM:      40100c:       43 f2 08 0c     movw r12, #12296
55# DISASM-NEXT:               c0 f2 40 0c     movt    r12, #64
56# DISASM-NEXT:               00 f0 00 b8     b.w     #0
57# DISASM-NEXT:               2d e9 0f 48     push.w  {r0, r1, r2, r3, r11, lr}
58# DISASM-NEXT:               0d f2 10 0b     addw    r11, sp, #16
59# DISASM-NEXT:               2d ed 10 0b     vpush   {d0, d1, d2, d3, d4, d5, d6, d7}
60# DISASM-NEXT:               61 46           mov     r1, r12
61# DISASM-NEXT:               42 f2 00 00     movw r0, #8192
62# DISASM-NEXT:               c0 f2 40 00     movt    r0, #64
63# DISASM-NEXT:               ff f7 e7 ff     bl      #-50
64# DISASM-NEXT:               84 46           mov     r12, r0
65# DISASM-NEXT:               bd ec 10 0b     vpop    {d0, d1, d2, d3, d4, d5, d6, d7}
66# DISASM-NEXT:               bd e8 0f 48     pop.w   {r0, r1, r2, r3, r11, lr}
67# DISASM-NEXT:               60 47           bx      r12
68
69--- !COFF
70header:
71  Machine:         IMAGE_FILE_MACHINE_ARMNT
72  Characteristics: [  ]
73sections:
74  - Name:            .text
75    Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_PURGEABLE, IMAGE_SCN_MEM_16BIT, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
76    Alignment:       4
77    SectionData:     40F20000C0F2000000680047
78    Relocations:
79      - VirtualAddress:  0
80        SymbolName:      __imp_function
81        Type:            IMAGE_REL_ARM_MOV32T
82symbols:
83  - Name:            .text
84    Value:           0
85    SectionNumber:   1
86    SimpleType:      IMAGE_SYM_TYPE_NULL
87    ComplexType:     IMAGE_SYM_DTYPE_NULL
88    StorageClass:    IMAGE_SYM_CLASS_STATIC
89    SectionDefinition:
90      Length:          12
91      NumberOfRelocations: 1
92      NumberOfLinenumbers: 0
93      CheckSum:        0
94      Number:          1
95  - Name:            mainCRTStartup
96    Value:           0
97    SectionNumber:   1
98    SimpleType:      IMAGE_SYM_TYPE_NULL
99    ComplexType:     IMAGE_SYM_DTYPE_FUNCTION
100    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
101  - Name:            __imp_function
102    Value:           0
103    SectionNumber:   0
104    SimpleType:      IMAGE_SYM_TYPE_NULL
105    ComplexType:     IMAGE_SYM_DTYPE_NULL
106    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
107...
108