Skip to content

Commit 3e44187

Browse files
author
git apple-llvm automerger
committed
Merge commit 'a08506e374f5' from llvm.org/main into next
2 parents a7d9f4d + a08506e commit 3e44187

File tree

3 files changed

+46
-9
lines changed

3 files changed

+46
-9
lines changed

lld/MinGW/Driver.cpp

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,6 @@ bool link(ArrayRef<const char *> argsArr, llvm::raw_ostream &stdoutOS,
270270
add("-lldmap:" + StringRef(a->getValue()));
271271
if (auto *a = args.getLastArg(OPT_reproduce))
272272
add("-reproduce:" + StringRef(a->getValue()));
273-
if (auto *a = args.getLastArg(OPT_thinlto_cache_dir))
274-
add("-lldltocache:" + StringRef(a->getValue()));
275273
if (auto *a = args.getLastArg(OPT_file_alignment))
276274
add("-filealign:" + StringRef(a->getValue()));
277275
if (auto *a = args.getLastArg(OPT_section_alignment))
@@ -440,8 +438,6 @@ bool link(ArrayRef<const char *> argsArr, llvm::raw_ostream &stdoutOS,
440438

441439
if (auto *arg = args.getLastArg(OPT_plugin_opt_mcpu_eq))
442440
add("-mllvm:-mcpu=" + StringRef(arg->getValue()));
443-
if (auto *arg = args.getLastArg(OPT_thinlto_jobs_eq))
444-
add("-opt:lldltojobs=" + StringRef(arg->getValue()));
445441
if (auto *arg = args.getLastArg(OPT_lto_O))
446442
add("-opt:lldlto=" + StringRef(arg->getValue()));
447443
if (auto *arg = args.getLastArg(OPT_lto_CGO))
@@ -453,6 +449,23 @@ bool link(ArrayRef<const char *> argsArr, llvm::raw_ostream &stdoutOS,
453449
if (auto *arg = args.getLastArg(OPT_lto_cs_profile_file))
454450
add("-lto-cs-profile-file:" + StringRef(arg->getValue()));
455451

452+
if (auto *a = args.getLastArg(OPT_thinlto_cache_dir))
453+
add("-lldltocache:" + StringRef(a->getValue()));
454+
if (auto *a = args.getLastArg(OPT_thinlto_cache_policy))
455+
add("-lldltocachepolicy:" + StringRef(a->getValue()));
456+
if (args.hasArg(OPT_thinlto_emit_imports_files))
457+
add("-thinlto-emit-imports-files");
458+
if (args.hasArg(OPT_thinlto_index_only))
459+
add("-thinlto-index-only");
460+
if (auto *arg = args.getLastArg(OPT_thinlto_index_only_eq))
461+
add("-thinlto-index-only:" + StringRef(arg->getValue()));
462+
if (auto *arg = args.getLastArg(OPT_thinlto_jobs_eq))
463+
add("-opt:lldltojobs=" + StringRef(arg->getValue()));
464+
if (auto *arg = args.getLastArg(OPT_thinlto_object_suffix_replace_eq))
465+
add("-thinlto-object-suffix-replace:" + StringRef(arg->getValue()));
466+
if (auto *arg = args.getLastArg(OPT_thinlto_prefix_replace_eq))
467+
add("-thinlto-prefix-replace:" + StringRef(arg->getValue()));
468+
456469
for (auto *a : args.filtered(OPT_plugin_opt_eq_minus))
457470
add("-mllvm:-" + StringRef(a->getValue()));
458471

lld/MinGW/Options.td

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ defm wrap: Eq<"wrap", "Use wrapper functions for symbol">,
149149
MetaVarName<"<symbol>">;
150150

151151

152+
// LLD specific options, for LTO, shared with the ELF backend
152153
def lto_O: JJ<"lto-O">, MetaVarName<"<opt-level>">,
153154
HelpText<"Optimization level for LTO">;
154155
def lto_CGO: JJ<"lto-CGO">, MetaVarName<"<cgopt-level>">,
@@ -158,8 +159,16 @@ def lto_cs_profile_generate: FF<"lto-cs-profile-generate">,
158159
def lto_cs_profile_file: JJ<"lto-cs-profile-file=">,
159160
HelpText<"Context sensitive profile file path">;
160161

162+
def thinlto_cache_dir: JJ<"thinlto-cache-dir=">,
163+
HelpText<"Path to ThinLTO cached object file directory">;
164+
defm thinlto_cache_policy: EEq<"thinlto-cache-policy", "Pruning policy for the ThinLTO cache">;
165+
def thinlto_emit_imports_files: FF<"thinlto-emit-imports-files">;
166+
def thinlto_index_only: FF<"thinlto-index-only">;
167+
def thinlto_index_only_eq: JJ<"thinlto-index-only=">;
161168
def thinlto_jobs_eq: JJ<"thinlto-jobs=">,
162169
HelpText<"Number of ThinLTO jobs. Default to --threads=">;
170+
def thinlto_object_suffix_replace_eq: JJ<"thinlto-object-suffix-replace=">;
171+
def thinlto_prefix_replace_eq: JJ<"thinlto-prefix-replace=">;
163172

164173
def plugin_opt_eq_minus: J<"plugin-opt=-">,
165174
HelpText<"Specify an LLVM option for compatibility with LLVMgold.so">;
@@ -186,8 +195,6 @@ def appcontainer: F<"appcontainer">, HelpText<"Set the appcontainer flag in the
186195
defm delayload: Eq<"delayload", "DLL to load only on demand">;
187196
defm mllvm: EqNoHelp<"mllvm">;
188197
defm pdb: Eq<"pdb", "Output PDB debug info file, chosen implicitly if the argument is empty">;
189-
def thinlto_cache_dir: JJ<"thinlto-cache-dir=">,
190-
HelpText<"Path to ThinLTO cached object file directory">;
191198
defm Xlink : Eq<"Xlink", "Pass <arg> to the COFF linker">, MetaVarName<"<arg>">;
192199
defm guard_cf : B<"guard-cf", "Enable Control Flow Guard" ,
193200
"Do not enable Control Flow Guard (default)">;

lld/test/MinGW/driver.test

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,6 @@ RUN: ld.lld -### -m i386pep foo.o --disable-runtime-pseudo-reloc 2>&1 | FileChec
297297
RUN: ld.lld -### -m i386pep foo.o -disable-runtime-pseudo-reloc 2>&1 | FileCheck -check-prefix DISABLE_RUNTIME_PSEUDO_RELOC %s
298298
DISABLE_RUNTIME_PSEUDO_RELOC: -runtime-pseudo-reloc:no
299299

300-
RUN: ld.lld -### foo.o -m i386pe --thinlto-cache-dir=_foo 2>&1 | FileCheck -check-prefix=THINLTO_CACHEDIR %s
301-
THINLTO_CACHEDIR: -lldltocache:_foo
302-
303300
RUN: ld.lld -### -m i386pep foo.o --file-alignment 0x1000 2>&1 | FileCheck -check-prefix FILEALIGN %s
304301
RUN: ld.lld -### -m i386pep foo.o -file-alignment 0x1000 2>&1 | FileCheck -check-prefix FILEALIGN %s
305302
RUN: ld.lld -### -m i386pep foo.o --file-alignment=0x1000 2>&1 | FileCheck -check-prefix FILEALIGN %s
@@ -382,10 +379,30 @@ RUN: ld.lld -### foo.o -m i386pep --guard-longjmp 2>&1 | FileCheck -check-prefix
382379
RUN: ld.lld -### foo.o -m i386pep --no-guard-cf --guard-longjmp 2>&1 | FileCheck -check-prefix=GUARD_LONGJMP_NO_CF %s
383380
GUARD_LONGJMP_NO_CF: warning: parameter --guard-longjmp only takes effect when used with --guard-cf
384381

382+
RUN: ld.lld -### foo.o -m i386pe --thinlto-cache-dir=_foo 2>&1 | FileCheck -check-prefix=THINLTO_CACHEDIR %s
383+
THINLTO_CACHEDIR: -lldltocache:_foo
384+
385+
RUN: ld.lld -### foo.o -m i386pe --thinlto-cache-policy=_foo 2>&1 | FileCheck -check-prefix=THINLTO_CACHE_POLICY %s
386+
THINLTO_CACHE_POLICY: -lldltocachepolicy:_foo
387+
388+
RUN: ld.lld -### foo.o -m i386pe --thinlto-emit-imports-files 2>&1 | FileCheck -check-prefix=THINLTO_EMIT_IMPORTS_FILES %s
389+
THINLTO_EMIT_IMPORTS_FILES: -thinlto-emit-imports-files
390+
391+
RUN: ld.lld -### foo.o -m i386pe --thinlto-index-only 2>&1 | FileCheck -check-prefix=THINLTO_INDEX_ONLY %s
392+
THINLTO_INDEX_ONLY: -thinlto-index-only{{ }}
393+
RUN: ld.lld -### foo.o -m i386pe --thinlto-index-only=_foo 2>&1 | FileCheck -check-prefix=THINLTO_INDEX_ONLY_EQ %s
394+
THINLTO_INDEX_ONLY_EQ: -thinlto-index-only:_foo
395+
385396
RUN: ld.lld -### foo.o -m i386pep --threads 3 --thinlto-jobs=4 2>&1 | FileCheck -check-prefix=THREADS %s
386397
RUN: ld.lld -### foo.o -m i386pep --threads 3 -plugin-opt=jobs=4 2>&1 | FileCheck -check-prefix=THREADS %s
387398
THREADS: -threads:3 {{.*}} -opt:lldltojobs=4
388399

400+
RUN: ld.lld -### foo.o -m i386pe --thinlto-object-suffix-replace=_foo 2>&1 | FileCheck -check-prefix=THINLTO_OBJECT_SUFFIX_REPLACE %s
401+
THINLTO_OBJECT_SUFFIX_REPLACE: -thinlto-object-suffix-replace:_foo
402+
403+
RUN: ld.lld -### foo.o -m i386pe --thinlto-prefix-replace=_foo 2>&1 | FileCheck -check-prefix=THINLTO_PREFIX_REPLACE %s
404+
THINLTO_PREFIX_REPLACE: -thinlto-prefix-replace:_foo
405+
389406
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
390407
LTO_OPTS: -mllvm:-mcpu=x86-64 -opt:lldlto=2 -dwodir:foo -lto-cs-profile-generate -lto-cs-profile-file:bar -mllvm:-emulated-tls
391408

0 commit comments

Comments
 (0)