Skip to content

Commit a9f8c7f

Browse files
Merge pull request #2129 from swiftwasm/katei/use-static-resource-dir-default-wasm-main
Make -use-static-resource-dir default flag for wasm target for main branch
2 parents c881315 + 5b661df commit a9f8c7f

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

lib/Driver/Driver.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2350,7 +2350,8 @@ bool Driver::handleImmediateArgs(const ArgList &Args, const ToolChain &TC) {
23502350
if (Args.hasFlag(options::OPT_static_executable,
23512351
options::OPT_no_static_executable, false) ||
23522352
Args.hasFlag(options::OPT_static_stdlib, options::OPT_no_static_stdlib,
2353-
false)) {
2353+
false) ||
2354+
TC.getTriple().isOSBinFormatWasm()) {
23542355
commandLine.push_back("-use-static-resource-dir");
23552356
}
23562357

lib/Driver/ToolChains.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,8 @@ ToolChain::constructInvocation(const CompileJobAction &job,
547547
if (context.Args.hasFlag(options::OPT_static_executable,
548548
options::OPT_no_static_executable, false) ||
549549
context.Args.hasFlag(options::OPT_static_stdlib,
550-
options::OPT_no_static_stdlib, false)) {
550+
options::OPT_no_static_stdlib, false) ||
551+
getTriple().isOSBinFormatWasm()) {
551552
Arguments.push_back("-use-static-resource-dir");
552553
}
553554

@@ -1050,7 +1051,8 @@ ToolChain::constructInvocation(const MergeModuleJobAction &job,
10501051
if (context.Args.hasFlag(options::OPT_static_executable,
10511052
options::OPT_no_static_executable, false) ||
10521053
context.Args.hasFlag(options::OPT_static_stdlib,
1053-
options::OPT_no_static_stdlib, false)) {
1054+
options::OPT_no_static_stdlib, false) ||
1055+
getTriple().isOSBinFormatWasm()) {
10541056
Arguments.push_back("-use-static-resource-dir");
10551057
}
10561058
Arguments.push_back("-module-name");
@@ -1252,6 +1254,14 @@ ToolChain::constructInvocation(const GeneratePCHJobAction &job,
12521254
addInputsOfType(Arguments, context.InputActions, file_types::TY_ObjCHeader);
12531255
context.Args.AddLastArg(Arguments, options::OPT_index_store_path);
12541256

1257+
if (context.Args.hasFlag(options::OPT_static_executable,
1258+
options::OPT_no_static_executable, false) ||
1259+
context.Args.hasFlag(options::OPT_static_stdlib, options::OPT_no_static_stdlib,
1260+
false) ||
1261+
getTriple().isOSBinFormatWasm()) {
1262+
Arguments.push_back("-use-static-resource-dir");
1263+
}
1264+
12551265
if (job.isPersistentPCH()) {
12561266
Arguments.push_back("-emit-pch");
12571267
Arguments.push_back("-pch-output-dir");

0 commit comments

Comments
 (0)