1# RUN: mkdir -p %t.dir
2# RUN: yaml2obj %s -o %t.dir/foo.obj
3
4# RUN: rm -f %t.dir/foo.sys
5# RUN: cd %t.dir; lld-link /driver foo.obj
6# RUN: llvm-readobj --file-headers %t.dir/foo.sys | FileCheck -check-prefix=DRIVER %s
7
8# DRIVER-NOT: IMAGE_FILE_UP_SYSTEM_ONLY
9# DRIVER-NOT: IMAGE_DLL_CHARACTERISTICS_WDM_DRIVER
10# DRIVER: AddressOfEntryPoint: 0x1000
11
12# RUN: rm -f %t.dir/foo.sys
13# RUN: cd %t.dir; lld-link /driver:uponly foo.obj
14# RUN: llvm-readobj --file-headers %t.dir/foo.sys | FileCheck -check-prefix=UPONLY %s
15
16# UPONLY: IMAGE_FILE_UP_SYSTEM_ONLY
17# UPONLY: AddressOfEntryPoint: 0x1000
18
19# RUN: rm -f %t.dir/foo.sys
20# RUN: cd %t.dir; lld-link /driver:wdm foo.obj
21# RUN: llvm-readobj --file-headers %t.dir/foo.sys | FileCheck -check-prefix=WDM %s
22
23# WDM: AddressOfEntryPoint: 0x1004
24# WDM: IMAGE_DLL_CHARACTERISTICS_WDM_DRIVER
25
26# RUN: rm -f %t.dir/foo.sys
27# RUN: cd %t.dir; lld-link /driver:wdm,uponly foo.obj
28# RUN: llvm-readobj --file-headers %t.dir/foo.sys | FileCheck -check-prefix=BOTH %s
29
30# RUN: rm -f %t.dir/foo.sys
31# RUN: cd %t.dir; lld-link /driver:uponly,wdm foo.obj
32# RUN: llvm-readobj --file-headers %t.dir/foo.sys | FileCheck -check-prefix=BOTH %s
33
34# BOTH: IMAGE_FILE_UP_SYSTEM_ONLY
35# BOTH: AddressOfEntryPoint: 0x1004
36# BOTH: IMAGE_DLL_CHARACTERISTICS_WDM_DRIVER
37
38# RUN: rm -f %t.dir/foo.sys
39# RUN: cd %t.dir; lld-link /driver foo.obj
40# RUN: llvm-readobj --file-headers %t.dir/foo.sys | FileCheck -check-prefix=FIXED1 %s
41
42# RUN: rm -f %t.dir/foo.sys
43# RUN: cd %t.dir; lld-link /driver foo.obj /fixed:no
44# RUN: llvm-readobj --file-headers %t.dir/foo.sys | FileCheck -check-prefix=FIXED1 %s
45
46# FIXED1: IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE
47
48# RUN: rm -f %t.dir/foo.sys
49# RUN: cd %t.dir; lld-link /driver foo.obj /fixed
50# RUN: llvm-readobj --file-headers %t.dir/foo.sys | FileCheck -check-prefix=FIXED2 %s
51
52# FIXED2-NOT: IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE
53
54--- !COFF
55header:
56  Machine:         IMAGE_FILE_MACHINE_AMD64
57  Characteristics: []
58sections:
59  - Name:            .text
60    Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
61    Alignment:       4096
62    SectionData:     0000000000000000
63    Relocations:
64      - VirtualAddress:  0
65        SymbolName:      __ImageBase
66        Type:            IMAGE_REL_AMD64_ADDR64
67symbols:
68  - Name:            .text
69    Value:           0
70    SectionNumber:   1
71    SimpleType:      IMAGE_SYM_TYPE_NULL
72    ComplexType:     IMAGE_SYM_DTYPE_NULL
73    StorageClass:    IMAGE_SYM_CLASS_STATIC
74    SectionDefinition:
75      Length:          8
76      NumberOfRelocations: 1
77      NumberOfLinenumbers: 0
78      CheckSum:        0
79      Number:          0
80  - Name:            main
81    Value:           0
82    SectionNumber:   1
83    SimpleType:      IMAGE_SYM_TYPE_NULL
84    ComplexType:     IMAGE_SYM_DTYPE_NULL
85    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
86  - Name:            mainCRTStartup
87    Value:           0
88    SectionNumber:   1
89    SimpleType:      IMAGE_SYM_TYPE_NULL
90    ComplexType:     IMAGE_SYM_DTYPE_NULL
91    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
92  - Name:            _NtProcessStartup
93    Value:           4
94    SectionNumber:   1
95    SimpleType:      IMAGE_SYM_TYPE_NULL
96    ComplexType:     IMAGE_SYM_DTYPE_NULL
97    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
98...
99