[PATCH] D97993: [Driver] Suppress GCC detection under -B for non-Android
Fangrui Song via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Mar 6 21:31:22 PST 2021
MaskRay updated this revision to Diff 328836.
MaskRay added a comment.
Add release note
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D97993/new/
https://reviews.llvm.org/D97993
Files:
clang/docs/ReleaseNotes.rst
clang/lib/Driver/ToolChains/Gnu.cpp
clang/test/Driver/gcc-toolchain.cpp
Index: clang/test/Driver/gcc-toolchain.cpp
===================================================================
--- clang/test/Driver/gcc-toolchain.cpp
+++ clang/test/Driver/gcc-toolchain.cpp
@@ -29,3 +29,14 @@
// CHECK: "{{[^"]*}}/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5{{/|\\\\}}crtbegin.o"
// CHECK: "-L[[TOOLCHAIN]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5"
// CHECK: "-L[[TOOLCHAIN]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../.."
+
+/// Test we don't detect GCC installation under -B.
+// RUN: %clangxx -no-canonical-prefixes %s -### -o %t 2>&1 \
+// RUN: --target=aarch64-suse-linux --gcc-toolchain=%S/Inputs/opensuse_42.2_aarch64_tree/usr | \
+// RUN: FileCheck %s --check-prefix=AARCH64
+// RUN: %clangxx -no-canonical-prefixes %s -### -o %t 2>&1 \
+// RUN: --target=aarch64-suse-linux -B%S/Inputs/opensuse_42.2_aarch64_tree/usr | \
+// RUN: FileCheck %s --check-prefix=NO_AARCH64
+
+// AARCH64: Inputs{{[^"]+}}aarch64-suse-linux/{{[^"]+}}crt1.o"
+// NO_AARCH64-NOT: Inputs{{[^"]+}}aarch64-suse-linux/{{[^"]+}}crt1.o"
Index: clang/lib/Driver/ToolChains/Gnu.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -1907,8 +1907,9 @@
CandidateBiarchTripleAliases);
// Compute the set of prefixes for our search.
- SmallVector<std::string, 8> Prefixes(D.PrefixDirs.begin(),
- D.PrefixDirs.end());
+ SmallVector<std::string, 8> Prefixes;
+ if (TargetTriple.isAndroid())
+ Prefixes.assign(D.PrefixDirs.begin(), D.PrefixDirs.end());
StringRef GCCToolchainDir = getGCCToolchainDir(Args, D.SysRoot);
if (GCCToolchainDir != "") {
Index: clang/docs/ReleaseNotes.rst
===================================================================
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -72,6 +72,10 @@
-----------------------
- -Wshadow now also checks for shadowed structured bindings
+- ``-B <prefix>`` (when ``<prefix>>`` is a directory) used to detect GCC
+ installations under ``<prefix>``. This behavior is incompatible with GCC,
+ causes interop issues with ``--gcc-toolchain``, and is thus dropped. Specify
+ ``--gcc-toolchain=<prefix>`` instead.
Removed Compiler Flags
-------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97993.328836.patch
Type: text/x-patch
Size: 2354 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210307/237f71e4/attachment.bin>
More information about the cfe-commits
mailing list