Skip to content

Commit 292e6a9

Browse files
Janosch Hildebrandjrose-apple
authored andcommitted
[Driver] Pass target triple to -modulewrap invocations (#5922)
-modulewrap invocations create an object file. The target should be passed along so that the object file is created for the same target as any other outputs.
1 parent 82a3aa3 commit 292e6a9

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lib/Driver/ToolChains.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,9 @@ ToolChain::constructInvocation(const ModuleWrapJobAction &job,
636636
assert(context.Output.getPrimaryOutputType() == types::TY_Object &&
637637
"The -modulewrap mode only produces object files");
638638

639+
Arguments.push_back("-target");
640+
Arguments.push_back(context.Args.MakeArgString(getTriple().str()));
641+
639642
Arguments.push_back("-o");
640643
Arguments.push_back(
641644
context.Args.MakeArgString(context.Output.getPrimaryOutputFilename()));

test/Driver/modulewrap.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
// CHECK: bin/swift -frontend{{.*}}-emit-module-path [[MOD:.*\.swiftmodule]]
44
// CHECK: bin/swift {{.*}}-emit-module [[MOD]]
55
// CHECK-SAME: -o [[MERGED:.*\.swiftmodule]]
6-
// CHECK: bin/swift -modulewrap [[MERGED]] -o [[OBJ:.*\.o]]
6+
// CHECK: bin/swift -modulewrap [[MERGED]] -target x86_64-unknown-linux-gnu -o [[OBJ:.*\.o]]
77
// CHECK: bin/clang++{{.*}} [[OBJ]]

0 commit comments

Comments
 (0)