1# RUN: yaml2obj %p/Inputs/delayimporttables-dll1.yaml > %t1.obj
2# RUN: yaml2obj %p/Inputs/delayimporttables-dll2.yaml > %t2.obj
3# RUN: yaml2obj %s > %t.obj
4# RUN: lld-link /nodefaultlib /entry:DllMain /out:%T/delayimporttables-dll1.dll /dll /implib:%t-dll1.lib %t1.obj
5# RUN: lld-link /nodefaultlib /entry:DllMain /out:%T/delayimporttables-dll2.dll /dll /implib:%t-dll2.lib %t2.obj
6# RUN: lld-link /nodefaultlib /entry:main /out:%t.exe /delayload:delayimporttables-dll1.dll /delayload:delayimporttables-dll2.dll %t.obj %t-dll1.lib %t-dll2.lib
7# RUN: llvm-readobj --coff-imports %t.exe |FileCheck %s
8
9#      CHECK: Format: COFF-x86-64
10# CHECK-NEXT: Arch: x86_64
11# CHECK-NEXT: AddressSize: 64bit
12# CHECK-NEXT: DelayImport {
13# CHECK-NEXT:   Name: delayimporttables-dll1.dll
14# CHECK-NEXT:   Attributes: 0x1
15# CHECK-NEXT:   ModuleHandle: 0x3000
16# CHECK-NEXT:   ImportAddressTable: 0x3010
17# CHECK-NEXT:   ImportNameTable: 0x2060
18# CHECK-NEXT:   BoundDelayImportTable: 0x0
19# CHECK-NEXT:   UnloadDelayImportTable: 0x0
20# CHECK-NEXT:   Import {
21# CHECK-NEXT:     Symbol: one (0)
22# CHECK-NEXT:     Address: 0x14000104D
23# CHECK-NEXT:   }
24# CHECK-NEXT:   Import {
25# CHECK-NEXT:     Symbol: two (0)
26# CHECK-NEXT:     Address: 0x140001059
27# CHECK-NEXT:   }
28# CHECK-NEXT: }
29# CHECK-NEXT: DelayImport {
30# CHECK-NEXT:   Name: delayimporttables-dll2.dll
31# CHECK-NEXT:   Attributes: 0x1
32# CHECK-NEXT:   ModuleHandle: 0x3008
33# CHECK-NEXT:   ImportAddressTable: 0x3028
34# CHECK-NEXT:   ImportNameTable: 0x2078
35# CHECK-NEXT:   BoundDelayImportTable: 0x0
36# CHECK-NEXT:   UnloadDelayImportTable: 0x0
37# CHECK-NEXT:   Import {
38# CHECK-NEXT:     Symbol: left (0)
39# CHECK-NEXT:     Address: 0x1400010B8
40# CHECK-NEXT:   }
41# CHECK-NEXT:   Import {
42# CHECK-NEXT:     Symbol: right (0)
43# CHECK-NEXT:     Address: 0x1400010C4
44# CHECK-NEXT:   }
45# CHECK-NEXT: }
46
47--- !COFF
48header:
49  Machine:         IMAGE_FILE_MACHINE_AMD64
50  Characteristics: [  ]
51sections:
52  - Name:            .drectve
53    Characteristics: [ IMAGE_SCN_LNK_INFO, IMAGE_SCN_LNK_REMOVE ]
54    Alignment:       1
55    SectionData:     2020202F44454641554C544C49423A224C4942434D5422202F44454641554C544C49423A224F4C444E414D45532220
56  - Name:            '.text$mn'
57    Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
58    Alignment:       16
59    SectionData:     4889542410894C24084883EC28FF1500000000FF1500000000FF1500000000FF150000000033C04883C428C3CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC488954241048894C240833C0C3
60    Relocations:
61      - VirtualAddress:  15
62        SymbolName:      __imp_one
63        Type:            IMAGE_REL_AMD64_REL32
64      - VirtualAddress:  21
65        SymbolName:      __imp_two
66        Type:            IMAGE_REL_AMD64_REL32
67      - VirtualAddress:  27
68        SymbolName:      __imp_left
69        Type:            IMAGE_REL_AMD64_REL32
70      - VirtualAddress:  33
71        SymbolName:      __imp_right
72        Type:            IMAGE_REL_AMD64_REL32
73symbols:
74  - Name:            .drectve
75    Value:           0
76    SectionNumber:   1
77    SimpleType:      IMAGE_SYM_TYPE_NULL
78    ComplexType:     IMAGE_SYM_DTYPE_NULL
79    StorageClass:    IMAGE_SYM_CLASS_STATIC
80    SectionDefinition:
81      Length:          47
82      NumberOfRelocations: 0
83      NumberOfLinenumbers: 0
84      CheckSum:        0
85      Number:          0
86  - Name:            __imp_one
87    Value:           0
88    SectionNumber:   0
89    SimpleType:      IMAGE_SYM_TYPE_NULL
90    ComplexType:     IMAGE_SYM_DTYPE_NULL
91    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
92  - Name:            __imp_two
93    Value:           0
94    SectionNumber:   0
95    SimpleType:      IMAGE_SYM_TYPE_NULL
96    ComplexType:     IMAGE_SYM_DTYPE_NULL
97    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
98  - Name:            __imp_left
99    Value:           0
100    SectionNumber:   0
101    SimpleType:      IMAGE_SYM_TYPE_NULL
102    ComplexType:     IMAGE_SYM_DTYPE_NULL
103    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
104  - Name:            __imp_right
105    Value:           0
106    SectionNumber:   0
107    SimpleType:      IMAGE_SYM_TYPE_NULL
108    ComplexType:     IMAGE_SYM_DTYPE_NULL
109    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
110  - Name:            main
111    Value:           0
112    SectionNumber:   2
113    SimpleType:      IMAGE_SYM_TYPE_NULL
114    ComplexType:     IMAGE_SYM_DTYPE_FUNCTION
115    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
116  - Name:            __delayLoadHelper2
117    Value:           64
118    SectionNumber:   2
119    SimpleType:      IMAGE_SYM_TYPE_NULL
120    ComplexType:     IMAGE_SYM_DTYPE_FUNCTION
121    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
122...
123