Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.5][clang][Driver] Make multiarch output file basenames reproducible #3483

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion clang/lib/Driver/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4826,7 +4826,13 @@ const char *Driver::GetNamedOutputPath(Compilation &C, const JobAction &JA,
return "";
}
} else {
TmpName = GetTemporaryPath(Split.first, Suffix);
if (MultipleArchs && !BoundArch.empty()) {
TmpName = GetTemporaryDirectory(Split.first);
llvm::sys::path::append(TmpName,
Split.first + "-" + BoundArch + "." + Suffix);
} else {
TmpName = GetTemporaryPath(Split.first, Suffix);
}
}
return C.addTempFile(C.getArgs().MakeArgString(TmpName));
}
Expand Down
10 changes: 10 additions & 0 deletions clang/test/Driver/darwin-dsymutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@
// CHECK-OUTPUT-NAME: "x86_64-apple-darwin10" - "darwin::Linker", inputs: [{{.*}}], output: "[[outfile]]"
// CHECK-OUTPUT-NAME: "x86_64-apple-darwin10" - "darwin::Dsymutil", inputs: ["[[outfile]]"], output: "[[dsymfile]]"

// Check output name derivation for multiple -arch options.
//
// RUN: %clang -target x86_64-apple-darwin10 \
// RUN: -arch x86_64 -arch arm64 -ccc-print-bindings %s 2> %t
// RUN: FileCheck --check-prefix=CHECK-MULTIARCH-OUTPUT-NAME < %t %s
//
// CHECK-MULTIARCH-OUTPUT-NAME: "x86_64-apple-darwin10" - "darwin::Linker", inputs: ["{{.*}}{{/|\\}}darwin-dsymutil-x86_64.o"], output: "{{.*}}{{/|\\}}darwin-dsymutil-x86_64.out"
// CHECK-MULTIARCH-OUTPUT-NAME: "arm64-apple-darwin10" - "darwin::Linker", inputs: ["{{.*}}{{/|\\}}darwin-dsymutil-arm64.o"], output: "{{.*}}{{/|\\}}darwin-dsymutil-arm64.out"
// CHECK-MULTIARCH-OUTPUT-NAME: "arm64-apple-darwin10" - "darwin::Lipo", inputs: ["{{.*}}{{/|\\}}darwin-dsymutil-x86_64.out", "{{.*}}{{/|\\}}darwin-dsymutil-arm64.out"], output: "a.out"

// Check that we only use dsymutil when needed.
//
// RUN: touch %t.o
Expand Down