1 RUN: ld.lld -### foo.o -m i386pe 2>&1 | FileCheck -check-prefix=X86 %s
4 X86-SAME: -alternatename:__image_base__=___ImageBase
7 RUN: echo "-### foo.o -m i386pe" > %t.rsp
8 RUN: ld.lld @%t.rsp 2>&1 | FileCheck -check-prefix=X86 %s
10 RUN: ld.lld -### foo.o -m i386pep 2>&1 | FileCheck -check-prefix=X64 %s
12 X64-SAME: -machine:x64
13 X64-SAME: -alternatename:__image_base__=__ImageBase
16 RUN: ld.lld -### foo.o -m thumb2pe 2>&1 | FileCheck -check-prefix=ARM %s
18 ARM-SAME: -machine:arm
19 ARM-SAME: -alternatename:__image_base__=__ImageBase
22 RUN: ld.lld -### foo.o -m arm64pe 2>&1 | FileCheck -check-prefix=ARM64 %s
24 ARM64-SAME: -machine:arm64
25 ARM64-SAME: -alternatename:__image_base__=__ImageBase
28 RUN: ld.lld -### foo.o -m arm64ecpe 2>&1 | FileCheck -check-prefix=ARM64EC %s
30 ARM64EC-SAME: -machine:arm64ec
31 ARM64EC-SAME: -alternatename:__image_base__=__ImageBase
34 RUN: ld.lld -### foo.o -m i386pep -shared 2>&1 | FileCheck -check-prefix=SHARED %s
35 RUN: ld.lld -### foo.o -m i386pep --shared 2>&1 | FileCheck -check-prefix=SHARED %s
36 RUN: ld.lld -### foo.o -m i386pep --dll 2>&1 | FileCheck -check-prefix=SHARED %s
40 RUN: ld.lld -### foo.o -m i386pep -shared foo.def 2>&1 | FileCheck -check-prefix=DEF1 %s
43 RUN: ld.lld -### foo.o -m i386pep -shared FOO.DEF 2>&1 | FileCheck -check-prefix=DEF2 %s
46 RUN: ld.lld -### foo.o -m i386pep -obar.exe 2>&1 | FileCheck -check-prefix=OUT %s
47 RUN: ld.lld -### foo.o -m i386pep -o bar.exe 2>&1 | FileCheck -check-prefix=OUT %s
50 RUN: ld.lld -### foo.o -m i386pep --out-implib bar 2>&1 | FileCheck -check-prefix=IMPLIB %s
51 RUN: ld.lld -### foo.o -m i386pep --out-implib=bar 2>&1 | FileCheck -check-prefix=IMPLIB %s
52 RUN: ld.lld -### foo.o -m i386pep -out-implib bar 2>&1 | FileCheck -check-prefix=IMPLIB %s
53 RUN: ld.lld -### foo.o -m i386pep -out-implib=bar 2>&1 | FileCheck -check-prefix=IMPLIB %s
56 RUN: ld.lld -### foo.o -m i386pep -e bar 2>&1 | FileCheck -check-prefix=ENTRY %s
57 RUN: ld.lld -### foo.o -m i386pep -ebar 2>&1 | FileCheck -check-prefix=ENTRY %s
58 RUN: ld.lld -### foo.o -m i386pep -entry bar 2>&1 | FileCheck -check-prefix=ENTRY %s
59 RUN: ld.lld -### foo.o -m i386pep --entry bar 2>&1 | FileCheck -check-prefix=ENTRY %s
60 RUN: ld.lld -### foo.o -m i386pep -entry=bar 2>&1 | FileCheck -check-prefix=ENTRY %s
61 RUN: ld.lld -### foo.o -m i386pep --entry=bar 2>&1 | FileCheck -check-prefix=ENTRY %s
63 RUN: ld.lld -### foo.o -m i386pep -e bar -entry= 2>&1 | FileCheck -check-prefix=NOENTRY --implicit-check-not=-entry %s
66 RUN: ld.lld -### foo.o -m i386pep -mllvm bar -mllvm baz 2>&1 | FileCheck -check-prefix=MLLVM %s
67 MLLVM: -mllvm:bar -mllvm:baz
69 RUN: ld.lld -### foo.o -m i386pep -subsystem console 2>&1 | FileCheck -check-prefix=SUBSYSTEM %s
70 RUN: ld.lld -### foo.o -m i386pep --subsystem console 2>&1 | FileCheck -check-prefix=SUBSYSTEM %s
71 RUN: ld.lld -### foo.o -m i386pep -subsystem=console 2>&1 | FileCheck -check-prefix=SUBSYSTEM %s
72 RUN: ld.lld -### foo.o -m i386pep --subsystem=console 2>&1 | FileCheck -check-prefix=SUBSYSTEM %s
73 SUBSYSTEM: -subsystem:console
75 RUN: ld.lld -### foo.o -m i386pep --major-os-version 7 --minor-os-version 8 2>&1 | FileCheck -check-prefix=OS_VERSION %s
76 RUN: ld.lld -### foo.o -m i386pep --major-os-version=7 --minor-os-version=8 2>&1 | FileCheck -check-prefix=OS_VERSION %s
77 OS_VERSION: -osversion:7.8 -subsystem:default,6.0
79 RUN: ld.lld -### foo.o -m i386pep --major-subsystem-version 7 --minor-subsystem-version 8 2>&1 | FileCheck -check-prefix=SUBSYSTEM_VERSION %s
80 RUN: ld.lld -### foo.o -m i386pep --major-subsystem-version=7 --minor-subsystem-version=8 2>&1 | FileCheck -check-prefix=SUBSYSTEM_VERSION %s
81 SUBSYSTEM_VERSION: -osversion:6.0 -subsystem:default,7.8
83 RUN: ld.lld -### foo.o -m i386pep --minor-subsystem-version 8 2>&1 | FileCheck -check-prefix=SUBSYSTEM_DEFAULT_MAJOR %s
84 SUBSYSTEM_DEFAULT_MAJOR: -subsystem:default,6.8
86 RUN: ld.lld -### foo.o -m i386pep --major-subsystem-version 7 2>&1 | FileCheck -check-prefix=SUBSYSTEM_DEFAULT_MINOR %s
87 SUBSYSTEM_DEFAULT_MINOR: -subsystem:default,7.0
89 RUN: ld.lld -### foo.o -m i386pep --subsystem windows --major-subsystem-version 7 --minor-subsystem-version 8 2>&1 | FileCheck -check-prefix=SUBSYSTEM_WINDOWS %s
90 RUN: ld.lld -### foo.o -m i386pep --major-subsystem-version 7 --minor-subsystem-version 8 --subsystem windows 2>&1 | FileCheck -check-prefix=SUBSYSTEM_WINDOWS %s
91 RUN: ld.lld -### foo.o -m i386pep --subsystem windows:7.8 2>&1 | FileCheck -check-prefix=SUBSYSTEM_WINDOWS %s
92 RUN: ld.lld -### foo.o -m i386pep --subsystem windows:2.3 --major-subsystem-version 7 --minor-subsystem-version 8 2>&1 | FileCheck -check-prefix=SUBSYSTEM_WINDOWS %s
93 RUN: ld.lld -### foo.o -m i386pep --subsystem windows:7.8 2>&1 | FileCheck -check-prefix=SUBSYSTEM_WINDOWS %s
94 RUN: ld.lld -### foo.o -m i386pep --major-subsystem-version 2 --minor-subsystem-version 3 --subsystem windows:7.8 2>&1 | FileCheck -check-prefix=SUBSYSTEM_WINDOWS %s
95 RUN: ld.lld -### foo.o -m i386pep --major-subsystem-version 2 --minor-subsystem-version 8 --subsystem windows:7 2>&1 | FileCheck -check-prefix=SUBSYSTEM_WINDOWS %s
96 SUBSYSTEM_WINDOWS: -subsystem:windows,7.8
98 RUN: ld.lld -### foo.o -m i386pep -stack 4194304,8192 2>&1 | FileCheck -check-prefix=STACK %s
99 RUN: ld.lld -### foo.o -m i386pep --stack 4194304,8192 2>&1 | FileCheck -check-prefix=STACK %s
100 RUN: ld.lld -### foo.o -m i386pep --stack=4194304,8192 2>&1 | FileCheck -check-prefix=STACK %s
101 STACK: -stack:4194304,8192
103 RUN: ld.lld -### foo.o -m i386pep -verbose 2>&1 | FileCheck -check-prefix=VERBOSE %s
104 RUN: ld.lld -### foo.o -m i386pep --verbose 2>&1 | FileCheck -check-prefix=VERBOSE %s
107 RUN: ld.lld -### -shared -m i386pe -e _DllMainCRTStartup@12 foo.o 2>&1 | FileCheck -check-prefix I386-ENTRY %s
108 I386-ENTRY: -entry:DllMainCRTStartup@12
110 RUN: ld.lld -### -m i386pep foo.o --whole-archive bar.a --no-whole-archive baz.a 2>&1 | FileCheck -check-prefix WHOLE-ARCHIVE %s
111 RUN: ld.lld -### -m i386pep foo.o -whole-archive bar.a -no-whole-archive baz.a 2>&1 | FileCheck -check-prefix WHOLE-ARCHIVE %s
112 WHOLE-ARCHIVE: foo.o -wholearchive:bar.a baz.a
114 RUN: ld.lld -### -m i386pep foo.o 2>&1 | FileCheck -check-prefix MINGW-FLAG %s
115 MINGW-FLAG: lld-link -lldmingw
117 RUN: ld.lld -### -m i386pep foo.o --exclude-all-symbols 2>&1 | FileCheck -check-prefix EXCLUDE-ALL %s
118 RUN: ld.lld -### -m i386pep foo.o -exclude-all-symbols 2>&1 | FileCheck -check-prefix EXCLUDE-ALL %s
119 EXCLUDE-ALL: -exclude-all-symbols
121 RUN: ld.lld -### -m i386pep foo.o --export-all-symbols 2>&1 | FileCheck -check-prefix EXPORT-ALL %s
122 RUN: ld.lld -### -m i386pep foo.o -export-all-symbols 2>&1 | FileCheck -check-prefix EXPORT-ALL %s
123 EXPORT-ALL: -export-all-symbols
125 RUN: ld.lld -### -m i386pep foo.o --output-def out.def 2>&1 | FileCheck -check-prefix OUTPUT-DEF %s
126 RUN: ld.lld -### -m i386pep foo.o --output-def=out.def 2>&1 | FileCheck -check-prefix OUTPUT-DEF %s
127 RUN: ld.lld -### -m i386pep foo.o -output-def out.def 2>&1 | FileCheck -check-prefix OUTPUT-DEF %s
128 RUN: ld.lld -### -m i386pep foo.o -output-def=out.def 2>&1 | FileCheck -check-prefix OUTPUT-DEF %s
129 OUTPUT-DEF: -output-def:out.def
131 RUN: ld.lld -### -m i386pep foo.o -Xlink=-lldmap 2>&1 | FileCheck -check-prefix XLINK %s
134 RUN: ld.lld -### -m i386pep foo.o 2>&1 | FileCheck -check-prefix DEBUG %s
137 RUN: ld.lld -### -m i386pep foo.o -s 2>&1 | FileCheck -check-prefix STRIP %s
138 RUN: ld.lld -### -m i386pep foo.o --strip-all 2>&1 | FileCheck -check-prefix STRIP %s
139 STRIP-NOT: -debug:dwarf
141 RUN: ld.lld -### -m i386pep foo.o -S 2>&1 | FileCheck -check-prefix STRIP-DEBUG %s
142 RUN: ld.lld -### -m i386pep foo.o --strip-debug 2>&1 | FileCheck -check-prefix STRIP-DEBUG %s
143 STRIP-DEBUG: -debug:symtab
144 STRIP-DEBUG-NOT: -debug:dwarf
146 RUN: ld.lld -### -m i386pep foo.o -pdb out.pdb 2>&1 | FileCheck -check-prefix PDB %s
147 RUN: ld.lld -### -m i386pep foo.o -pdb=out.pdb 2>&1 | FileCheck -check-prefix PDB %s
148 PDB: -debug -pdb:out.pdb
151 RUN: ld.lld -### -m i386pep foo.o -pdb= 2>&1 | FileCheck -check-prefix PDB-DEFAULT %s
153 PDB-DEFAULT-NOT: -pdb:{{.*}}
154 PDB-DEFAULT-NOT: -debug:
156 RUN: ld.lld -### -m i386pep foo.o -pdb= -S 2>&1 | FileCheck -check-prefix PDB-NODWARF %s
157 PDB-NODWARF: -debug -debug:nodwarf,symtab
159 RUN: ld.lld -### -m i386pep foo.o -pdb= -s 2>&1 | FileCheck -check-prefix PDB-NODWARF-NOSYMTAB %s
160 PDB-NODWARF-NOSYMTAB: -debug -debug:nodwarf,nosymtab
162 RUN: ld.lld -### -m i386pep foo.o --large-address-aware 2>&1 | FileCheck -check-prefix LARGE-ADDRESS-AWARE %s
163 LARGE-ADDRESS-AWARE: -largeaddressaware
165 RUN: ld.lld -### -m i386pe foo.o --dynamicbase --no-dynamicbase 2>&1 | FileCheck -check-prefix DISABLE-DYNAMICBASE %s
166 RUN: ld.lld -### -m i386pe foo.o --dynamicbase --disable-dynamicbase 2>&1 | FileCheck -check-prefix DISABLE-DYNAMICBASE %s
167 DISABLE-DYNAMICBASE: -dynamicbase:no
168 RUN: ld.lld -### -m i386pe --disable-dynamicbase --dynamicbase foo.o 2>&1 | FileCheck -check-prefix NO-DISABLE-DYNAMICBASE %s
169 RUN: ld.lld -### -m i386pep -dynamicbase foo.o 2>&1 | FileCheck -check-prefix NO-DISABLE-DYNAMICBASE %s
170 RUN: ld.lld -### -m i386pe foo.o 2>&1 | FileCheck -check-prefix NO-DISABLE-DYNAMICBASE %s
171 RUN: ld.lld -### -m i386pep foo.o 2>&1 | FileCheck -check-prefix NO-DISABLE-DYNAMICBASE %s
172 RUN: ld.lld -### -m thumb2pe foo.o 2>&1 | FileCheck -check-prefix NO-DISABLE-DYNAMICBASE %s
173 RUN: ld.lld -### -m arm64pe foo.o 2>&1 | FileCheck -check-prefix NO-DISABLE-DYNAMICBASE %s
174 # On arm, dynamicbase can't be disabled, so --no-dynamicbase is ignored
175 RUN: ld.lld -### -m thumb2pe foo.o --no-dynamicbase 2>&1 | FileCheck -check-prefix NO-DISABLE-DYNAMICBASE %s
176 RUN: ld.lld -### -m arm64pe foo.o --no-dynamicbase 2>&1 | FileCheck -check-prefix NO-DISABLE-DYNAMICBASE %s
177 NO-DISABLE-DYNAMICBASE-NOT: -dynamicbase:no
179 RUN: ld.lld -### -m i386pe foo.o -high-entropy-va -disable-high-entropy-va 2>&1 | FileCheck -check-prefix DISABLE-HIGH-ENTROPY-VA %s
180 RUN: ld.lld -### -m i386pe foo.o --high-entropy-va --disable-high-entropy-va 2>&1 | FileCheck -check-prefix DISABLE-HIGH-ENTROPY-VA %s
181 DISABLE-HIGH-ENTROPY-VA: -highentropyva:no
182 RUN: ld.lld -### -m i386pe foo.o -disable-high-entropy-va -high-entropy-va 2>&1 | FileCheck -check-prefix NO-DISABLE-HIGH-ENTROPY-VA %s
183 RUN: ld.lld -### -m i386pe foo.o --disable-high-entropy-va --high-entropy-va 2>&1 | FileCheck -check-prefix NO-DISABLE-HIGH-ENTROPY-VA %s
184 NO-DISABLE-HIGH-ENTROPY-VA-NOT: -highentropyva:no
186 RUN: ld.lld -### -m i386pe foo.o -nxcompat -disable-nxcompat 2>&1 | FileCheck -check-prefix DISABLE-NXCOMPAT %s
187 RUN: ld.lld -### -m i386pe foo.o --nxcompat --disable-nxcompat 2>&1 | FileCheck -check-prefix DISABLE-NXCOMPAT %s
188 DISABLE-NXCOMPAT: -nxcompat:no
189 RUN: ld.lld -### -m i386pe foo.o -disable-nxcompat -nxcompat 2>&1 | FileCheck -check-prefix NO-DISABLE-NXCOMPAT %s
190 RUN: ld.lld -### -m i386pe foo.o --disable-nxcompat --nxcompat 2>&1 | FileCheck -check-prefix NO-DISABLE-NXCOMPAT %s
191 NO-DISABLE-NXCOMPAT-NOT: -nxcompat:no
193 RUN: ld.lld -### -m i386pe foo.o -tsaware -disable-tsaware 2>&1 | FileCheck -check-prefix DISABLE-TSAWARE %s
194 RUN: ld.lld -### -m i386pe foo.o --tsaware --disable-tsaware 2>&1 | FileCheck -check-prefix DISABLE-TSAWARE %s
195 DISABLE-TSAWARE: -tsaware:no
196 RUN: ld.lld -### -m i386pe foo.o -disable-tsaware -tsaware 2>&1 | FileCheck -check-prefix NO-DISABLE-TSAWARE %s
197 RUN: ld.lld -### -m i386pe foo.o --disable-tsaware --tsaware 2>&1 | FileCheck -check-prefix NO-DISABLE-TSAWARE %s
198 NO-DISABLE-TSAWARE-NOT: -tsaware:no
200 RUN: ld.lld -### -m i386pe foo.o -enable-reloc-section -disable-reloc-section 2>&1 | FileCheck -check-prefix DISABLE-RELOC-SECTION %s
201 RUN: ld.lld -### -m i386pe foo.o --enable-reloc-section --disable-reloc-section 2>&1 | FileCheck -check-prefix DISABLE-RELOC-SECTION %s
202 DISABLE-RELOC-SECTION: -fixed{{ }}
203 RUN: ld.lld -### -m i386pe foo.o -disable-reloc-section -enable-reloc-section 2>&1 | FileCheck -check-prefix NO-DISABLE-RELOC-SECTION %s
204 RUN: ld.lld -### -m i386pe foo.o --disable-reloc-section --enable-reloc-section 2>&1 | FileCheck -check-prefix NO-DISABLE-RELOC-SECTION %s
205 NO-DISABLE-RELOC-SECTION-NOT: -fixed
207 RUN: ld.lld -### -m i386pep foo.o --image-base 0x1230000 2>&1 | FileCheck -check-prefix IMAGE-BASE %s
208 RUN: ld.lld -### -m i386pep foo.o -image-base 0x1230000 2>&1 | FileCheck -check-prefix IMAGE-BASE %s
209 RUN: ld.lld -### -m i386pep foo.o --image-base=0x1230000 2>&1 | FileCheck -check-prefix IMAGE-BASE %s
210 IMAGE-BASE: -base:0x1230000
212 RUN: ld.lld -### -m i386pep foo.o 2>&1 | FileCheck -check-prefix NO-GC-SECTIONS %s
213 RUN: ld.lld -### -m i386pep foo.o --gc-sections --no-gc-sections 2>&1 | FileCheck -check-prefix NO-GC-SECTIONS %s
214 NO-GC-SECTIONS: -opt:noref
216 RUN: ld.lld -### -m i386pep foo.o --gc-sections 2>&1 | FileCheck -check-prefix GC-SECTIONS %s
217 RUN: ld.lld -### -m i386pep foo.o -gc-sections 2>&1 | FileCheck -check-prefix GC-SECTIONS %s
218 GC-SECTIONS: -opt:ref
220 RUN: ld.lld -### -m i386pep foo.o 2>&1 | FileCheck -check-prefix ICF-NONE %s
221 RUN: ld.lld -### -m i386pep foo.o --icf=none 2>&1 | FileCheck -check-prefix ICF-NONE %s
222 RUN: ld.lld -### -m i386pep foo.o -icf=none 2>&1 | FileCheck -check-prefix ICF-NONE %s
225 RUN: ld.lld -### -m i386pep foo.o --icf=safe 2>&1 | FileCheck -check-prefix ICF-SAFE %s
226 RUN: ld.lld -### -m i386pep foo.o -icf=safe 2>&1 | FileCheck -check-prefix ICF-SAFE %s
227 ICF-SAFE: -opt:safeicf
229 RUN: ld.lld -### -m i386pep foo.o --icf=all 2>&1 | FileCheck -check-prefix ICF %s
230 RUN: ld.lld -### -m i386pep foo.o -icf=all 2>&1 | FileCheck -check-prefix ICF %s
231 RUN: ld.lld -### -m i386pep foo.o --icf all 2>&1 | FileCheck -check-prefix ICF %s
234 RUN: ld.lld -### -m i386pep --start-group foo.o --end-group 2> /dev/null
236 RUN: ld.lld -### foo.o -m i386pe -shared --kill-at 2>&1 | FileCheck -check-prefix=KILL-AT %s
237 RUN: ld.lld -### foo.o -m i386pe -shared -kill-at 2>&1 | FileCheck -check-prefix=KILL-AT %s
240 RUN: ld.lld -### foo.o -m i386pep -Map bar.map 2>&1 | FileCheck -check-prefix=MAP %s
241 RUN: ld.lld -### foo.o -m i386pep --Map bar.map 2>&1 | FileCheck -check-prefix=MAP %s
242 RUN: ld.lld -### foo.o -m i386pep -Map=bar.map 2>&1 | FileCheck -check-prefix=MAP %s
243 RUN: ld.lld -### foo.o -m i386pep --Map=bar.map 2>&1 | FileCheck -check-prefix=MAP %s
246 RUN: ld.lld -### foo.o -m i386pe -require-defined _foo --require-defined _bar -require-defined=_baz --require-defined=_foo2 2>&1 | FileCheck -check-prefix=REQUIRE-DEFINED %s
247 REQUIRE-DEFINED: -include:_foo -include:_bar -include:_baz -include:_foo2
249 RUN: ld.lld -### foo.o -m i386pe -u _foo --undefined _bar -undefined=_baz --undefined=_foo2 -u_foo3 2>&1 | FileCheck -check-prefix=UNDEFINED %s
250 UNDEFINED: -includeoptional:_foo -includeoptional:_bar -includeoptional:_baz -includeoptional:_foo2 -includeoptional:_foo3
252 RUN: ld.lld -### foo.o -m i386pe --undefined-glob="_foo*" 2>&1 | FileCheck -check-prefix=UNDEFINED-GLOB %s
253 UNDEFINED-GLOB: -includeglob:_foo*
255 RUN: ld.lld -### -m i386pep foo.o -Llibpath 2>&1 | FileCheck -check-prefix LIBPATH %s
256 LIBPATH: -libpath:libpath
258 RUN: ld.lld -### -m i386pep foo.o --reproduce=foo.tar 2>&1 | FileCheck -check-prefix REPRO %s
259 REPRO: -reproduce:foo.tar
261 RUN: ld.lld -### -m i386pep foo.o --no-insert-timestamp 2>&1 | FileCheck -check-prefix NOTIMESTAMP %s
262 RUN: ld.lld -### -m i386pep foo.o --insert-timestamp --no-insert-timestamp 2>&1 | FileCheck -check-prefix NOTIMESTAMP %s
263 NOTIMESTAMP: -timestamp:0
264 RUN: ld.lld -### -m i386pep foo.o --no-insert-timestamp --insert-timestamp 2>&1 | FileCheck -check-prefix TIMESTAMP %s
265 TIMESTAMP-NOT: -timestamp:0
267 RUN: ld.lld -### -m i386pep foo.o -appcontainer 2>&1 | FileCheck -check-prefix APPCONTAINER %s
268 RUN: ld.lld -### -m i386pep foo.o --appcontainer 2>&1 | FileCheck -check-prefix APPCONTAINER %s
269 APPCONTAINER: -appcontainer
271 RUN: ld.lld -m i386pep --version 2>&1 | FileCheck -check-prefix=VERSION %s
272 RUN: ld.lld -m i386pep -v 2>&1 | FileCheck -check-prefix=VERSION %s
273 RUN: not ld.lld -m i386pep -v xyz 2>&1 | FileCheck -check-prefix=VERSION %s
274 # This literal string is required for compatibility with older Meson versions,
275 # see https://github.com/mesonbuild/meson/pull/13383.
276 VERSION: LLD {{.*}} (compatible with GNU linkers)
278 RUN: ld.lld -m i386pep --help 2>&1 | FileCheck -check-prefix=HELP %s
280 HELP: --enable-auto-import
282 RUN: ld.lld -### -m i386pep foo.o -delayload user32.dll --delayload shell32.dll 2>&1 | FileCheck -check-prefix DELAYLOAD %s
283 RUN: ld.lld -### -m i386pep foo.o -delayload=user32.dll --delayload=shell32.dll 2>&1 | FileCheck -check-prefix DELAYLOAD %s
284 DELAYLOAD: -delayload:user32.dll -delayload:shell32.dll
286 RUN: not ld.lld -m i386pep -entry 2>&1 | FileCheck -check-prefix MISSING_ARG %s
287 MISSING_ARG: error: -entry: missing argument
289 RUN: not ld.lld -m i386pep --foo 2>&1 | FileCheck -check-prefix UNKNOWN_ARG %s
290 UNKNOWN_ARG: error: unknown argument: --foo
292 RUN: not ld.lld -m i386pep 2>&1 | FileCheck -check-prefix NO_INPUT_FILES %s
293 NO_INPUT_FILES: error: no input files
295 RUN: ld.lld -### -m i386pep foo.o 2>&1 | FileCheck -check-prefix ENABLE_AUTO_IMPORT %s
296 RUN: ld.lld -### -m i386pep foo.o --disable-auto-import --enable-auto-import 2>&1 | FileCheck -check-prefix ENABLE_AUTO_IMPORT %s
297 RUN: ld.lld -### -m i386pep foo.o -enable-auto-import 2>&1 | FileCheck -check-prefix ENABLE_AUTO_IMPORT %s
298 ENABLE_AUTO_IMPORT: -auto-import{{ }}
300 RUN: ld.lld -### -m i386pep foo.o --disable-auto-import 2>&1 | FileCheck -check-prefix DISABLE_AUTO_IMPORT %s
301 RUN: ld.lld -### -m i386pep foo.o -disable-auto-import 2>&1 | FileCheck -check-prefix DISABLE_AUTO_IMPORT %s
302 DISABLE_AUTO_IMPORT: -auto-import:no
304 RUN: ld.lld -### -m i386pep foo.o 2>&1 | FileCheck -check-prefix ENABLE_RUNTIME_PSEUDO_RELOC %s
305 RUN: ld.lld -### -m i386pep foo.o --disable-runtime-pseudo-reloc --enable-runtime-pseudo-reloc 2>&1 | FileCheck -check-prefix ENABLE_RUNTIME_PSEUDO_RELOC %s
306 RUN: ld.lld -### -m i386pep foo.o -enable-runtime-pseudo-reloc 2>&1 | FileCheck -check-prefix ENABLE_RUNTIME_PSEUDO_RELOC %s
307 ENABLE_RUNTIME_PSEUDO_RELOC: -runtime-pseudo-reloc{{ }}
309 RUN: ld.lld -### -m i386pep foo.o --disable-runtime-pseudo-reloc 2>&1 | FileCheck -check-prefix DISABLE_RUNTIME_PSEUDO_RELOC %s
310 RUN: ld.lld -### -m i386pep foo.o -disable-runtime-pseudo-reloc 2>&1 | FileCheck -check-prefix DISABLE_RUNTIME_PSEUDO_RELOC %s
311 DISABLE_RUNTIME_PSEUDO_RELOC: -runtime-pseudo-reloc:no
313 RUN: ld.lld -### -m i386pep foo.o --file-alignment 0x1000 2>&1 | FileCheck -check-prefix FILEALIGN %s
314 RUN: ld.lld -### -m i386pep foo.o -file-alignment 0x1000 2>&1 | FileCheck -check-prefix FILEALIGN %s
315 RUN: ld.lld -### -m i386pep foo.o --file-alignment=0x1000 2>&1 | FileCheck -check-prefix FILEALIGN %s
316 RUN: ld.lld -### -m i386pep foo.o -file-alignment=0x1000 2>&1 | FileCheck -check-prefix FILEALIGN %s
317 FILEALIGN: -filealign:0x1000
319 RUN: ld.lld -### -m i386pep foo.o --section-alignment 0x2000 2>&1 | FileCheck -check-prefix ALIGN %s
320 RUN: ld.lld -### -m i386pep foo.o -section-alignment 0x2000 2>&1 | FileCheck -check-prefix ALIGN %s
321 RUN: ld.lld -### -m i386pep foo.o --section-alignment=0x2000 2>&1 | FileCheck -check-prefix ALIGN %s
322 RUN: ld.lld -### -m i386pep foo.o -section-alignment=0x2000 2>&1 | FileCheck -check-prefix ALIGN %s
325 RUN: ld.lld -### -m i386pe foo.o -disable-no-seh -no-seh 2>&1 | FileCheck -check-prefix NOSEH %s
326 RUN: ld.lld -### -m i386pe foo.o --disable-no-seh --no-seh 2>&1 | FileCheck -check-prefix NOSEH %s
327 RUN: ld.lld -### -m i386pe foo.o -no-seh -disable-no-seh 2>&1 | FileCheck -check-prefix DISABLE-NOSEH %s
328 RUN: ld.lld -### -m i386pe foo.o --no-seh --disable-no-seh 2>&1 | FileCheck -check-prefix DISABLE-NOSEH %s
330 DISABLE-NOSEH-NOT: -noseh
332 RUN: ld.lld -### -m i386pep foo.o --no-allow-multiple-definition --allow-multiple-definition 2>&1 | FileCheck -check-prefix ALLOW_MULTIPLE_DEFINITION %s
333 RUN: ld.lld -### -m i386pep foo.o -no-allow-multiple-definition -allow-multiple-definition 2>&1 | FileCheck -check-prefix ALLOW_MULTIPLE_DEFINITION %s
334 ALLOW_MULTIPLE_DEFINITION: -force:multiple
336 RUN: ld.lld -### -m i386pep foo.o --allow-multiple-definition --no-allow-multiple-definition 2>&1 | FileCheck -check-prefix NO_ALLOW_MULTIPLE_DEFINITION %s
337 RUN: ld.lld -### -m i386pep foo.o -allow-multiple-definition -no-allow-multiple-definition 2>&1 | FileCheck -check-prefix NO_ALLOW_MULTIPLE_DEFINITION %s
338 NO_ALLOW_MULTIPLE_DEFINITION-NOT: -force:multiple
340 RUN: ld.lld -### -m i386pep foo.o -wrap foo1 --wrap foo2 2>&1 | FileCheck -check-prefix WRAP %s
341 RUN: ld.lld -### -m i386pep foo.o -wrap=foo1 --wrap=foo2 2>&1 | FileCheck -check-prefix WRAP %s
342 WRAP: -wrap:foo1 -wrap:foo2
344 RUN: ld.lld -### -m i386pep foo.o -exclude-symbols sym1,sym2 --exclude-symbols sym3 2>&1 | FileCheck -check-prefix EXCLUDE_SYMBOLS %s
345 RUN: ld.lld -### -m i386pep foo.o -exclude-symbols=sym1,sym2 --exclude-symbols=sym3 2>&1 | FileCheck -check-prefix EXCLUDE_SYMBOLS %s
346 EXCLUDE_SYMBOLS: -exclude-symbols:sym1,sym2 -exclude-symbols:sym3
348 RUN: ld.lld -### -m i386pep foo.o 2>&1 | FileCheck -check-prefix DEMANGLE %s
349 RUN: ld.lld -### -m i386pep foo.o -demangle 2>&1 | FileCheck -check-prefix DEMANGLE %s
350 RUN: ld.lld -### -m i386pep foo.o --demangle 2>&1 | FileCheck -check-prefix DEMANGLE %s
351 DEMANGLE: -demangle{{ }}
353 RUN: ld.lld -### -m i386pep foo.o -no-demangle 2>&1 | FileCheck -check-prefix NO-DEMANGLE %s
354 RUN: ld.lld -### -m i386pep foo.o --no-demangle 2>&1 | FileCheck -check-prefix NO-DEMANGLE %s
355 NO-DEMANGLE: -demangle:no
357 RUN: ld.lld -### -m i386pep foo.o -fatal-warnings 2>&1 | FileCheck -check-prefix FATAL_WARNINGS %s
358 RUN: ld.lld -### -m i386pep foo.o --fatal-warnings 2>&1 | FileCheck -check-prefix FATAL_WARNINGS %s
359 FATAL_WARNINGS: -WX{{ }}
361 RUN: ld.lld -### -m i386pep foo.o 2>&1 | FileCheck -check-prefix NO-FATAL_WARNINGS %s
362 RUN: ld.lld -### -m i386pep foo.o -no-fatal-warnings 2>&1 | FileCheck -check-prefix NO-FATAL_WARNINGS %s
363 RUN: ld.lld -### -m i386pep foo.o --no-fatal-warnings 2>&1 | FileCheck -check-prefix NO-FATAL_WARNINGS %s
364 NO-FATAL_WARNINGS: -WX:no
366 RUN: ld.lld -### -m i386pep foo.o 2>&1 | FileCheck -check-prefix NO-FIXUP %s
367 NO-FIXUP-NOT: -stdcall-fixup
369 RUN: ld.lld -### -m i386pep foo.o --enable-stdcall-fixup --disable-stdcall-fixup 2>&1 | FileCheck -check-prefix DISABLE-FIXUP %s
370 DISABLE-FIXUP: -stdcall-fixup:no
372 RUN: ld.lld -### -m i386pep foo.o --disable-stdcall-fixup --enable-stdcall-fixup 2>&1 | FileCheck -check-prefix ENABLE-FIXUP %s
373 ENABLE-FIXUP: -stdcall-fixup{{ }}
375 RUN: ld.lld -### foo.o -m i386pep -heap 8388608,16384 2>&1 | FileCheck -check-prefix=HEAP %s
376 RUN: ld.lld -### foo.o -m i386pep --heap 8388608,16384 2>&1 | FileCheck -check-prefix=HEAP %s
377 RUN: ld.lld -### foo.o -m i386pep --heap=8388608,16384 2>&1 | FileCheck -check-prefix=HEAP %s
378 HEAP: -heap:8388608,16384
380 RUN: ld.lld -### foo.o -m i386pep --no-guard-cf 2>&1 | FileCheck -check-prefix=NO_GUARD_CF %s
381 RUN: ld.lld -### foo.o -m i386pep --no-guard-cf --no-guard-longjmp 2>&1 | FileCheck -check-prefix=NO_GUARD_CF %s
382 NO_GUARD_CF-NOT: -guard:
384 RUN: ld.lld -### foo.o -m i386pep --guard-cf 2>&1 | FileCheck -check-prefix=GUARD_CF %s
385 RUN: ld.lld -### foo.o -m i386pep --guard-cf --guard-longjmp 2>&1 | FileCheck -check-prefix=GUARD_CF %s
386 GUARD_CF: -guard:cf,longjmp
388 RUN: ld.lld -### foo.o -m i386pep --guard-cf --no-guard-longjmp 2>&1 | FileCheck -check-prefix=GUARD_CF_NOLONGJMP %s
389 GUARD_CF_NOLONGJMP: -guard:cf,nolongjmp
391 RUN: ld.lld -### foo.o -m i386pep --guard-longjmp 2>&1 | FileCheck -check-prefix=GUARD_LONGJMP_NO_CF %s
392 RUN: ld.lld -### foo.o -m i386pep --no-guard-cf --guard-longjmp 2>&1 | FileCheck -check-prefix=GUARD_LONGJMP_NO_CF %s
393 GUARD_LONGJMP_NO_CF: warning: parameter --guard-longjmp only takes effect when used with --guard-cf
395 RUN: ld.lld -### foo.o -m i386pe --thinlto-cache-dir=_foo 2>&1 | FileCheck -check-prefix=THINLTO_CACHEDIR %s
396 THINLTO_CACHEDIR: -lldltocache:_foo
398 RUN: ld.lld -### foo.o -m i386pe --thinlto-cache-policy=_foo 2>&1 | FileCheck -check-prefix=THINLTO_CACHE_POLICY %s
399 THINLTO_CACHE_POLICY: -lldltocachepolicy:_foo
401 RUN: ld.lld -### foo.o -m i386pe --thinlto-emit-imports-files 2>&1 | FileCheck -check-prefix=THINLTO_EMIT_IMPORTS_FILES %s
402 THINLTO_EMIT_IMPORTS_FILES: -thinlto-emit-imports-files
404 RUN: ld.lld -### foo.o -m i386pe --thinlto-index-only 2>&1 | FileCheck -check-prefix=THINLTO_INDEX_ONLY %s
405 THINLTO_INDEX_ONLY: -thinlto-index-only{{ }}
406 RUN: ld.lld -### foo.o -m i386pe --thinlto-index-only=_foo 2>&1 | FileCheck -check-prefix=THINLTO_INDEX_ONLY_EQ %s
407 THINLTO_INDEX_ONLY_EQ: -thinlto-index-only:_foo
409 RUN: ld.lld -### foo.o -m i386pep --threads 3 --thinlto-jobs=4 2>&1 | FileCheck -check-prefix=THREADS %s
410 RUN: ld.lld -### foo.o -m i386pep --threads 3 -plugin-opt=jobs=4 2>&1 | FileCheck -check-prefix=THREADS %s
411 THREADS: -threads:3 {{.*}} -opt:lldltojobs=4
413 RUN: ld.lld -### foo.o -m i386pe --thinlto-object-suffix-replace=_foo 2>&1 | FileCheck -check-prefix=THINLTO_OBJECT_SUFFIX_REPLACE %s
414 THINLTO_OBJECT_SUFFIX_REPLACE: -thinlto-object-suffix-replace:_foo
416 RUN: ld.lld -### foo.o -m i386pe --thinlto-prefix-replace=_foo 2>&1 | FileCheck -check-prefix=THINLTO_PREFIX_REPLACE %s
417 THINLTO_PREFIX_REPLACE: -thinlto-prefix-replace:_foo
419 RUN: ld.lld -### foo.o -m i386pep -plugin-opt=mcpu=x86-64 -plugin-opt=-emulated-tls -plugin-opt=thinlto -plugin-opt=O2 -plugin-opt=dwo_dir=foo -plugin-opt=cs-profile-generate -plugin-opt=cs-profile-path=bar 2>&1 | FileCheck -check-prefix=LTO_OPTS %s
420 LTO_OPTS: -mllvm:-mcpu=x86-64 -opt:lldlto=2 -dwodir:foo -lto-cs-profile-generate -lto-cs-profile-file:bar -mllvm:-emulated-tls
422 RUN: ld.lld -### foo.o -m i386pep --lto-O2 --lto-CGO1 --lto-cs-profile-generate --lto-cs-profile-file=foo 2>&1 | FileCheck -check-prefix=LTO_OPTS2 %s
423 LTO_OPTS2:-opt:lldlto=2 -opt:lldltocgo=1 -lto-cs-profile-generate -lto-cs-profile-file:foo
425 RUN: ld.lld -### foo.o -m i386pe -plugin-opt=emit-asm 2>&1 | FileCheck -check-prefix=LTO_EMIT_ASM %s
426 RUN: ld.lld -### foo.o -m i386pe --lto-emit-asm 2>&1 | FileCheck -check-prefix=LTO_EMIT_ASM %s
427 LTO_EMIT_ASM: -lldemit:asm
429 RUN: ld.lld -### foo.o -m i386pe -plugin-opt=emit-llvm 2>&1 | FileCheck -check-prefix=LTO_EMIT_LLVM %s
430 LTO_EMIT_LLVM: -lldemit:llvm
432 RUN: ld.lld -### foo.o -m i386pep --lto-sample-profile=foo 2>&1 | FileCheck -check-prefix=LTO_SAMPLE_PROFILE %s
433 LTO_SAMPLE_PROFILE: -lto-sample-profile:foo
435 Test GCC specific LTO options that GCC passes unconditionally, that we ignore.
437 RUN: ld.lld -### foo.o -m i386pep -plugin /usr/lib/gcc/x86_64-w64-mingw32/10-posix/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-w64-mingw32/10-posix/lto-wrapper -plugin-opt=-fresolution=/tmp/ccM9d4fP.res -plugin-opt=-pass-through=-lmingw32 2> /dev/null
438 RUN: ld.lld -### foo.o -m i386pep -plugin C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/liblto_plugin.dll -plugin-opt=C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/lto-wrapper.exe -plugin-opt=-fresolution=C:/msys64/tmp/cckbC7wB.res -plugin-opt=-pass-through=-lmingw32 2> /dev/null
440 RUN: ld.lld -### foo.o -m i386pep 2>&1 | FileCheck -check-prefix=BUILD_ID %s
441 RUN: ld.lld -### foo.o -m i386pep --build-id 2>&1 | FileCheck -check-prefix=BUILD_ID %s
442 BUILD_ID: -build-id{{ }}
444 RUN: ld.lld -### foo.o -m i386pep --build-id=fast 2>&1 | FileCheck -check-prefix=BUILD_ID_WARN %s
445 BUILD_ID_WARN: unsupported build id hashing: fast, using default hashing.
446 BUILD_ID_WARN: -build-id{{ }}
448 RUN: ld.lld -### foo.o -m i386pep --functionpadmin= 2>&1 | FileCheck -check-prefix=FUNCTIONPADMIN %s
449 RUN: ld.lld -### foo.o -m i386pep --functionpadmin 2>&1 | FileCheck -check-prefix=FUNCTIONPADMIN %s
450 FUNCTIONPADMIN: -functionpadmin{{ }}
452 RUN: ld.lld -### foo.o -m i386pep --functionpadmin=2 2>&1 | FileCheck -check-prefix=FUNCTIONPADMIN2 %s
453 FUNCTIONPADMIN2: -functionpadmin:2{{ }}
455 RUN: ld.lld -### foo.o -m i386pep --build-id=none 2>&1 | FileCheck -check-prefix=NO_BUILD_ID %s
456 RUN: ld.lld -### foo.o -m i386pep -s 2>&1 | FileCheck -check-prefix=NO_BUILD_ID %s
457 RUN: ld.lld -### foo.o -m i386pep -S 2>&1 | FileCheck -check-prefix=NO_BUILD_ID %s
458 NO_BUILD_ID: -build-id:no
460 RUN: ld.lld -### foo.o -m i386pep -rpath foo 2>&1 | FileCheck -check-prefix=WARN_RPATH %s
461 RUN: ld.lld -### foo.o -m i386pep --rpath foo 2>&1 | FileCheck -check-prefix=WARN_RPATH %s
462 RUN: ld.lld -### foo.o -m i386pep -rpath=foo 2>&1 | FileCheck -check-prefix=WARN_RPATH %s
463 RUN: ld.lld -### foo.o -m i386pep --rpath=foo 2>&1 | FileCheck -check-prefix=WARN_RPATH %s
464 WARN_RPATH: warning: parameter -{{-?}}rpath has no effect on PE/COFF targets
466 RUN: ld.lld -### foo.o -m i386pe --dependent-load-flag=0x800 2>&1 | FileCheck -check-prefix=DEPENDENT_LOAD_FLAG %s
467 DEPENDENT_LOAD_FLAG: -dependentloadflag:0x800