[clang] f6ba645 - Revert "[Clang] Ignore CLANG_DEFAULT_LINKER for custom-linker toolchains"
Simon Moll via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 6 07:45:56 PST 2021
Author: Simon Moll
Date: 2021-12-06T16:44:36+01:00
New Revision: f6ba6450396ce58212f247c72d84a54efd748b38
URL: https://github.com/llvm/llvm-project/commit/f6ba6450396ce58212f247c72d84a54efd748b38
DIFF: https://github.com/llvm/llvm-project/commit/f6ba6450396ce58212f247c72d84a54efd748b38.diff
LOG: Revert "[Clang] Ignore CLANG_DEFAULT_LINKER for custom-linker toolchains"
Reverted until all Toolchains are fixed for the new behavior.
This reverts commit 34a43f2115af79f896c889433c57f3b400e9f2c6.
Added:
Modified:
clang/include/clang/Driver/ToolChain.h
clang/lib/Driver/ToolChain.cpp
clang/test/Driver/ve-toolchain.c
clang/test/Driver/ve-toolchain.cpp
Removed:
################################################################################
diff --git a/clang/include/clang/Driver/ToolChain.h b/clang/include/clang/Driver/ToolChain.h
index e55f8219feb08..e7b13eec3fc14 100644
--- a/clang/include/clang/Driver/ToolChain.h
+++ b/clang/include/clang/Driver/ToolChain.h
@@ -420,7 +420,7 @@ class ToolChain {
}
/// GetDefaultLinker - Get the default linker to use.
- virtual const char *getDefaultLinker() const;
+ virtual const char *getDefaultLinker() const { return "ld"; }
/// GetDefaultRuntimeLibType - Get the default runtime library variant to use.
virtual RuntimeLibType GetDefaultRuntimeLibType() const {
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index d92cbe21960ee..ac033dd427c2d 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -541,12 +541,6 @@ std::string ToolChain::GetProgramPath(const char *Name) const {
return D.GetProgramPath(Name, *this);
}
-const char *ToolChain::getDefaultLinker() const {
- if (CLANG_DEFAULT_LINKER[0] == '\0')
- return "ld";
- return CLANG_DEFAULT_LINKER;
-}
-
std::string ToolChain::GetLinkerPath(bool *LinkerIsLLD) const {
if (LinkerIsLLD)
*LinkerIsLLD = false;
@@ -554,7 +548,7 @@ std::string ToolChain::GetLinkerPath(bool *LinkerIsLLD) const {
// Get -fuse-ld= first to prevent -Wunused-command-line-argument. -fuse-ld= is
// considered as the linker flavor, e.g. "bfd", "gold", or "lld".
const Arg* A = Args.getLastArg(options::OPT_fuse_ld_EQ);
- StringRef UseLinker = A ? A->getValue() : "";
+ StringRef UseLinker = A ? A->getValue() : CLANG_DEFAULT_LINKER;
// --ld-path= takes precedence over -fuse-ld= and specifies the executable
// name. -B, COMPILER_PATH and PATH and consulted if the value does not
diff --git a/clang/test/Driver/ve-toolchain.c b/clang/test/Driver/ve-toolchain.c
index 2c8f211d143f6..8878bd8f83cc0 100644
--- a/clang/test/Driver/ve-toolchain.c
+++ b/clang/test/Driver/ve-toolchain.c
@@ -61,10 +61,10 @@
/// Checking -fintegrated-as
// RUN: %clang -### -target ve \
-// RUN: -x assembler %s 2>&1 | \
+// RUN: -x assembler -fuse-ld=ld %s 2>&1 | \
// RUN: FileCheck -check-prefix=AS %s
// RUN: %clang -### -target ve \
-// RUN: -fno-integrated-as -x assembler %s 2>&1 | \
+// RUN: -fno-integrated-as -fuse-ld=ld -x assembler %s 2>&1 | \
// RUN: FileCheck -check-prefix=NAS %s
// AS: clang{{.*}} "-cc1as"
@@ -83,6 +83,7 @@
// RUN: %clang -### -target ve-unknown-linux-gnu \
// RUN: --sysroot %S/Inputs/basic_ve_tree \
// RUN: -resource-dir=%S/Inputs/basic_ve_tree/resource_dir \
+// RUN: -fuse-ld=ld \
// RUN: %s 2>&1 | FileCheck -check-prefix=DEF %s
// DEF: clang{{.*}}" "-cc1"
diff --git a/clang/test/Driver/ve-toolchain.cpp b/clang/test/Driver/ve-toolchain.cpp
index 2519a5f97dff9..7666cfbfe8b27 100644
--- a/clang/test/Driver/ve-toolchain.cpp
+++ b/clang/test/Driver/ve-toolchain.cpp
@@ -110,10 +110,10 @@
/// Checking -fintegrated-as
// RUN: %clangxx -### -target ve-unknown-linux-gnu \
-// RUN: -x assembler %s 2>&1 | \
+// RUN: -x assembler -fuse-ld=ld %s 2>&1 | \
// RUN: FileCheck -check-prefix=AS %s
// RUN: %clangxx -### -target ve-unknown-linux-gnu \
-// RUN: -fno-integrated-as -x assembler %s 2>&1 | \
+// RUN: -fno-integrated-as -x assembler -fuse-ld=ld %s 2>&1 | \
// RUN: FileCheck -check-prefix=NAS %s
// AS: clang{{.*}} "-cc1as"
@@ -131,6 +131,7 @@
// RUN: %clangxx -### -target ve-unknown-linux-gnu \
// RUN: --sysroot %S/Inputs/basic_ve_tree \
+// RUN: -fuse-ld=ld \
// RUN: -resource-dir=%S/Inputs/basic_ve_tree/resource_dir \
// RUN: --stdlib=c++ %s 2>&1 | FileCheck -check-prefix=DEF %s
More information about the cfe-commits
mailing list