MaskRay created this revision. MaskRay added reviewers: jrtc27, phosek. Herald added subscribers: StephenFan, pengfei. Herald added a project: All. MaskRay requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
- 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 <https://reviews.llvm.org/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 <https://reviews.llvm.org/D101400>. Close https://github.com/llvm/llvm-project/issues/51469 Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D133170 Files: clang/include/clang/Driver/Options.td clang/lib/Driver/Driver.cpp clang/test/Driver/print-multiarch.c Index: clang/test/Driver/print-multiarch.c =================================================================== --- clang/test/Driver/print-multiarch.c +++ clang/test/Driver/print-multiarch.c @@ -1,6 +1,6 @@ -// Check the output of -print-multiarch. +/// GCC --disable-multiarch, GCC --enable-multiarch (upstream and Debian specific) have different behaviors. +/// We choose not to support the option. -// RUN: %clang -print-multiarch --target=x86_64-unknown-linux-gnu \ -// RUN: -resource-dir=%S/Inputs/resource_dir \ -// RUN: | FileCheck --check-prefix=PRINT-MULTIARCH %s -// PRINT-MULTIARCH: {{^}}x86_64-linux-gnu{{$}} +// RUN: not %clang -print-multiarch --target=x86_64-unknown-linux-gnu 2>&1 | FileCheck %s + +// CHECK: error: unsupported option '-print-multiarch' Index: clang/lib/Driver/Driver.cpp =================================================================== --- clang/lib/Driver/Driver.cpp +++ clang/lib/Driver/Driver.cpp @@ -2152,12 +2152,6 @@ return false; } - if (C.getArgs().hasArg(options::OPT_print_multiarch)) { - llvm::outs() << TC.getMultiarchTriple(*this, TC.getTriple(), SysRoot) - << "\n"; - return false; - } - if (C.getArgs().hasArg(options::OPT_print_targets)) { llvm::TargetRegistry::printRegisteredTargetsForVersion(llvm::outs()); return false; Index: clang/include/clang/Driver/Options.td =================================================================== --- clang/include/clang/Driver/Options.td +++ clang/include/clang/Driver/Options.td @@ -4069,8 +4069,9 @@ HelpText<"Print the normalized target triple">, Flags<[FlangOption]>; def print_effective_triple : Flag<["-", "--"], "print-effective-triple">, HelpText<"Print the effective target triple">, Flags<[FlangOption]>; -def print_multiarch : Flag<["-", "--"], "print-multiarch">, - HelpText<"Print the multiarch target triple">; +// GCC --disable-multiarch, GCC --enable-multiarch (upstream and Debian +// specific) have different behaviors. We choose not to support the option. +def : Flag<["-", "--"], "print-multiarch">, Flags<[Unsupported]>; def print_prog_name_EQ : Joined<["-", "--"], "print-prog-name=">, HelpText<"Print the full program path of <name>">, MetaVarName<"<name>">; def print_resource_dir : Flag<["-", "--"], "print-resource-dir">,
Index: clang/test/Driver/print-multiarch.c =================================================================== --- clang/test/Driver/print-multiarch.c +++ clang/test/Driver/print-multiarch.c @@ -1,6 +1,6 @@ -// Check the output of -print-multiarch. +/// GCC --disable-multiarch, GCC --enable-multiarch (upstream and Debian specific) have different behaviors. +/// We choose not to support the option. -// RUN: %clang -print-multiarch --target=x86_64-unknown-linux-gnu \ -// RUN: -resource-dir=%S/Inputs/resource_dir \ -// RUN: | FileCheck --check-prefix=PRINT-MULTIARCH %s -// PRINT-MULTIARCH: {{^}}x86_64-linux-gnu{{$}} +// RUN: not %clang -print-multiarch --target=x86_64-unknown-linux-gnu 2>&1 | FileCheck %s + +// CHECK: error: unsupported option '-print-multiarch' Index: clang/lib/Driver/Driver.cpp =================================================================== --- clang/lib/Driver/Driver.cpp +++ clang/lib/Driver/Driver.cpp @@ -2152,12 +2152,6 @@ return false; } - if (C.getArgs().hasArg(options::OPT_print_multiarch)) { - llvm::outs() << TC.getMultiarchTriple(*this, TC.getTriple(), SysRoot) - << "\n"; - return false; - } - if (C.getArgs().hasArg(options::OPT_print_targets)) { llvm::TargetRegistry::printRegisteredTargetsForVersion(llvm::outs()); return false; Index: clang/include/clang/Driver/Options.td =================================================================== --- clang/include/clang/Driver/Options.td +++ clang/include/clang/Driver/Options.td @@ -4069,8 +4069,9 @@ HelpText<"Print the normalized target triple">, Flags<[FlangOption]>; def print_effective_triple : Flag<["-", "--"], "print-effective-triple">, HelpText<"Print the effective target triple">, Flags<[FlangOption]>; -def print_multiarch : Flag<["-", "--"], "print-multiarch">, - HelpText<"Print the multiarch target triple">; +// GCC --disable-multiarch, GCC --enable-multiarch (upstream and Debian +// specific) have different behaviors. We choose not to support the option. +def : Flag<["-", "--"], "print-multiarch">, Flags<[Unsupported]>; def print_prog_name_EQ : Joined<["-", "--"], "print-prog-name=">, HelpText<"Print the full program path of <name>">, MetaVarName<"<name>">; def print_resource_dir : Flag<["-", "--"], "print-resource-dir">,
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits