Skip to content

Commit 7a835d1

Browse files
Merge pull request #2117 from swiftwasm/katei/use-static-resource-dir-default-wasm
Make -use-static-resource-dir to be default flag for wasm target
2 parents b359823 + 75afaa9 commit 7a835d1

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

lib/Driver/Driver.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -2249,7 +2249,8 @@ bool Driver::handleImmediateArgs(const ArgList &Args, const ToolChain &TC) {
22492249
if (Args.hasFlag(options::OPT_static_executable,
22502250
options::OPT_no_static_executable, false) ||
22512251
Args.hasFlag(options::OPT_static_stdlib, options::OPT_no_static_stdlib,
2252-
false)) {
2252+
false) ||
2253+
TC.getTriple().isOSBinFormatWasm()) {
22532254
commandLine.push_back("-use-static-resource-dir");
22542255
}
22552256

lib/Driver/ToolChains.cpp

+12-2
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,8 @@ ToolChain::constructInvocation(const CompileJobAction &job,
528528
if (context.Args.hasFlag(options::OPT_static_executable,
529529
options::OPT_no_static_executable, false) ||
530530
context.Args.hasFlag(options::OPT_static_stdlib,
531-
options::OPT_no_static_stdlib, false)) {
531+
options::OPT_no_static_stdlib, false) ||
532+
getTriple().isOSBinFormatWasm()) {
532533
Arguments.push_back("-use-static-resource-dir");
533534
}
534535

@@ -1023,7 +1024,8 @@ ToolChain::constructInvocation(const MergeModuleJobAction &job,
10231024
if (context.Args.hasFlag(options::OPT_static_executable,
10241025
options::OPT_no_static_executable, false) ||
10251026
context.Args.hasFlag(options::OPT_static_stdlib,
1026-
options::OPT_no_static_stdlib, false)) {
1027+
options::OPT_no_static_stdlib, false) ||
1028+
getTriple().isOSBinFormatWasm()) {
10271029
Arguments.push_back("-use-static-resource-dir");
10281030
}
10291031

@@ -1191,6 +1193,14 @@ ToolChain::constructInvocation(const GeneratePCHJobAction &job,
11911193
addInputsOfType(Arguments, context.InputActions, file_types::TY_ObjCHeader);
11921194
context.Args.AddLastArg(Arguments, options::OPT_index_store_path);
11931195

1196+
if (context.Args.hasFlag(options::OPT_static_executable,
1197+
options::OPT_no_static_executable, false) ||
1198+
context.Args.hasFlag(options::OPT_static_stdlib, options::OPT_no_static_stdlib,
1199+
false) ||
1200+
getTriple().isOSBinFormatWasm()) {
1201+
Arguments.push_back("-use-static-resource-dir");
1202+
}
1203+
11941204
if (job.isPersistentPCH()) {
11951205
Arguments.push_back("-emit-pch");
11961206
Arguments.push_back("-pch-output-dir");

0 commit comments

Comments
 (0)