Skip to content

Commit e05edb1

Browse files
committed
[Driver] Unsupport --print-multiarch
* If GCC is configured with `--disable-multi-arch`, `--print-multiarch` output is an empty line. * If GCC is configured with `--enable-multi-arch`, `--print-multiarch` output may be a normalized triple or (on Debian, 'vendor' is omitted) `x86_64-linux-gnu`. The Clang support D101400 just prints the Debian multiarch style triple unconditionally, but the string is not really expected for non-Debian systems. AIUI many Linux distributions and non-Linux OSes don't configure GCC with `--enable-multi-arch`. Instead of getting us in the trouble of supporting all kinds of variants, drop the support as before D101400. Close #51469 Reviewed By: phosek Differential Revision: https://reviews.llvm.org/D133170
1 parent 5856576 commit e05edb1

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4069,8 +4069,9 @@ def print_target_triple : Flag<["-", "--"], "print-target-triple">,
40694069
HelpText<"Print the normalized target triple">, Flags<[FlangOption]>;
40704070
def print_effective_triple : Flag<["-", "--"], "print-effective-triple">,
40714071
HelpText<"Print the effective target triple">, Flags<[FlangOption]>;
4072-
def print_multiarch : Flag<["-", "--"], "print-multiarch">,
4073-
HelpText<"Print the multiarch target triple">;
4072+
// GCC --disable-multiarch, GCC --enable-multiarch (upstream and Debian
4073+
// specific) have different behaviors. We choose not to support the option.
4074+
def : Flag<["-", "--"], "print-multiarch">, Flags<[Unsupported]>;
40744075
def print_prog_name_EQ : Joined<["-", "--"], "print-prog-name=">,
40754076
HelpText<"Print the full program path of <name>">, MetaVarName<"<name>">;
40764077
def print_resource_dir : Flag<["-", "--"], "print-resource-dir">,

clang/lib/Driver/Driver.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2152,12 +2152,6 @@ bool Driver::HandleImmediateArgs(const Compilation &C) {
21522152
return false;
21532153
}
21542154

2155-
if (C.getArgs().hasArg(options::OPT_print_multiarch)) {
2156-
llvm::outs() << TC.getMultiarchTriple(*this, TC.getTriple(), SysRoot)
2157-
<< "\n";
2158-
return false;
2159-
}
2160-
21612155
if (C.getArgs().hasArg(options::OPT_print_targets)) {
21622156
llvm::TargetRegistry::printRegisteredTargetsForVersion(llvm::outs());
21632157
return false;
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// Check the output of -print-multiarch.
1+
/// GCC --disable-multiarch, GCC --enable-multiarch (upstream and Debian specific) have different behaviors.
2+
/// We choose not to support the option.
23

3-
// RUN: %clang -print-multiarch --target=x86_64-unknown-linux-gnu \
4-
// RUN: -resource-dir=%S/Inputs/resource_dir \
5-
// RUN: | FileCheck --check-prefix=PRINT-MULTIARCH %s
6-
// PRINT-MULTIARCH: {{^}}x86_64-linux-gnu{{$}}
4+
// RUN: not %clang -print-multiarch --target=x86_64-unknown-linux-gnu 2>&1 | FileCheck %s
5+
6+
// CHECK: error: unsupported option '-print-multiarch'

0 commit comments

Comments
 (0)