1# REQUIRES: x86
2# RUN: yaml2obj < %p/Inputs/hello32.yaml > %t.obj
3# RUN: lld-link -safeseh:no %t.obj %p/Inputs/std32.lib /subsystem:console \
4# RUN:   /entry:main@0 /alternatename:___delayLoadHelper2@8=_main@0 \
5# RUN:   /delayload:std32.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
10IMPORT:      Format: COFF-i386
11IMPORT-NEXT: Arch: i386
12IMPORT-NEXT: AddressSize: 32bit
13IMPORT-NEXT: DelayImport {
14IMPORT-NEXT:   Name: std32.dll
15IMPORT-NEXT:   Attributes: 0x1
16IMPORT-NEXT:   ModuleHandle: 0x3018
17IMPORT-NEXT:   ImportAddressTable: 0x3020
18IMPORT-NEXT:   ImportNameTable: 0x2040
19IMPORT-NEXT:   BoundDelayImportTable: 0x0
20IMPORT-NEXT:   UnloadDelayImportTable: 0x0
21IMPORT-NEXT:   Import {
22IMPORT-NEXT:     Symbol: ExitProcess (0)
23IMPORT-NEXT:     Address: 0x401029
24IMPORT-NEXT:   }
25IMPORT-NEXT:   Import {
26IMPORT-NEXT:     Symbol: MessageBoxA (0)
27IMPORT-NEXT:     Address: 0x401033
28IMPORT-NEXT:   }
29IMPORT-NEXT: }
30
31BASEREL:      BaseReloc [
32BASEREL-NEXT:   Entry {
33BASEREL-NEXT:     Type: HIGHLOW
34BASEREL-NEXT:     Address: 0x1005
35BASEREL-NEXT:   }
36BASEREL-NEXT:   Entry {
37BASEREL-NEXT:     Type: HIGHLOW
38BASEREL-NEXT:     Address: 0x100C
39BASEREL-NEXT:   }
40BASEREL-NEXT:   Entry {
41BASEREL-NEXT:     Type: HIGHLOW
42BASEREL-NEXT:     Address: 0x101F
43BASEREL-NEXT:   }
44BASEREL-NEXT:   Entry {
45BASEREL-NEXT:     Type: HIGHLOW
46BASEREL-NEXT:     Address: 0x1025
47BASEREL-NEXT:   }
48BASEREL-NEXT:   Entry {
49BASEREL-NEXT:     Type: HIGHLOW
50BASEREL-NEXT:     Address: 0x102A
51BASEREL-NEXT:   }
52BASEREL-NEXT:   Entry {
53BASEREL-NEXT:     Type: HIGHLOW
54BASEREL-NEXT:     Address: 0x1034
55BASEREL-NEXT:   }
56BASEREL-NEXT:   Entry {
57BASEREL-NEXT:     Type: HIGHLOW
58BASEREL-NEXT:     Address: 0x1041
59BASEREL-NEXT:   }
60BASEREL-NEXT:   Entry {
61BASEREL-NEXT:     Type: ABSOLUTE
62BASEREL-NEXT:     Address: 0x1000
63BASEREL-NEXT:   }
64BASEREL-NEXT:   Entry {
65BASEREL-NEXT:     Type: HIGHLOW
66BASEREL-NEXT:     Address: 0x3020
67BASEREL-NEXT:   }
68BASEREL-NEXT:   Entry {
69BASEREL-NEXT:     Type: HIGHLOW
70BASEREL-NEXT:     Address: 0x3024
71BASEREL-NEXT:   }
72BASEREL-NEXT: ]
73
74DISASM:      1029:      b8 20 30 40 00  movl    $4206624, %eax
75DISASM-NEXT: 102e:      e9 0a 00 00 00  jmp     0x40103d <.text+0x3d>
76DISASM-NEXT: 1033:      b8 24 30 40 00  movl    $4206628, %eax
77DISASM-NEXT: 1038:      e9 00 00 00 00  jmp     0x40103d <.text+0x3d>
78DISASM-NEXT: 103d:      51      pushl   %ecx
79DISASM-NEXT: 103e:      52      pushl   %edx
80DISASM-NEXT: 103f:      50      pushl   %eax
81DISASM-NEXT: 1040:      68 00 20 40 00  pushl   $4202496
82DISASM-NEXT: 1045:      e8 b6 ff ff ff  calll   0x401000 <.text>
83DISASM-NEXT: 104a:      5a      popl    %edx
84DISASM-NEXT: 104b:      59      popl    %ecx
85DISASM-NEXT: 104c:      ff e0   jmpl    *%eax
86