diff options
author | Michael Olbrich <m.olbrich@pengutronix.de> | 2020-08-25 15:29:54 +0200 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2020-08-27 14:30:25 +0200 |
commit | 155c3a52ade77f0e9ec93ea1e5c335038c655042 (patch) | |
tree | 0471f5ab7997df265221b90f53dddeb7f0340217 | |
parent | c227df241506722fcdb46b2deda91ba9a2d15a1a (diff) | |
download | OSELAS.Toolchain-155c3a52ade77f0e9ec93ea1e5c335038c655042.tar.gz OSELAS.Toolchain-155c3a52ade77f0e9ec93ea1e5c335038c655042.tar.xz |
cross-clang: make sure the correct path for the dynamic linker is used
This is basically the same as the gcc patch
0200-gcc-i386-use-pure64-CLFS-patch.patch.
It has some extra magic not use /lib64 if host-tools are built.
The patch is only applied if the target architecture is x86_64. This way,
clang works as a host compiler without the special handling with all other
toolchains.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rw-r--r-- | patches/clang-10.0.1/0001-Use-lib-for-the-dynamic-linker-on-x86_64-by-default.patch | 27 | ||||
-rw-r--r-- | patches/clang-10.0.1/series | 4 | ||||
-rw-r--r-- | rules/cross-clang.make | 4 |
3 files changed, 35 insertions, 0 deletions
diff --git a/patches/clang-10.0.1/0001-Use-lib-for-the-dynamic-linker-on-x86_64-by-default.patch b/patches/clang-10.0.1/0001-Use-lib-for-the-dynamic-linker-on-x86_64-by-default.patch new file mode 100644 index 0000000..2f57691 --- /dev/null +++ b/patches/clang-10.0.1/0001-Use-lib-for-the-dynamic-linker-on-x86_64-by-default.patch @@ -0,0 +1,27 @@ +From: Michael Olbrich <m.olbrich@pengutronix.de> +Date: Tue, 25 Aug 2020 15:17:15 +0200 +Subject: [PATCH] Use /lib for the dynamic linker on x86_64 by default + +However, if '-gcc-toolchain /usr' is used, then assume that clang is +actually used as a host compiler and use the default /lib64 instead. + +Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de> +--- + lib/Driver/ToolChains/Linux.cpp | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp +index 6532c899492a..30026aea938a 100644 +--- a/lib/Driver/ToolChains/Linux.cpp ++++ b/lib/Driver/ToolChains/Linux.cpp +@@ -633,8 +633,9 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { + break; + case llvm::Triple::x86_64: { + bool X32 = Triple.getEnvironment() == llvm::Triple::GNUX32; ++ const Arg *A = Args.getLastArg(clang::driver::options::OPT_gcc_toolchain); + +- LibDir = X32 ? "libx32" : "lib64"; ++ LibDir = X32 ? "libx32" : (A && A->getValue() == std::string("/usr")) ? "lib64" : "lib"; + Loader = X32 ? "ld-linux-x32.so.2" : "ld-linux-x86-64.so.2"; + break; + } diff --git a/patches/clang-10.0.1/series b/patches/clang-10.0.1/series new file mode 100644 index 0000000..89c2922 --- /dev/null +++ b/patches/clang-10.0.1/series @@ -0,0 +1,4 @@ +# generated by git-ptx-patches +#tag:base --start-number 1 +0001-Use-lib-for-the-dynamic-linker-on-x86_64-by-default.patch +# 4ca7b1d842ffc195879cb75fc26eaed3 - git-ptx-patches magic diff --git a/rules/cross-clang.make b/rules/cross-clang.make index 61dee9c..f1eafc7 100644 --- a/rules/cross-clang.make +++ b/rules/cross-clang.make @@ -26,6 +26,10 @@ CROSS_CLANG_DIR := $(CROSS_BUILDDIR)/$(CROSS_CLANG) CROSS_CLANG_LICENSE := $(call remove_quotes,$(PTXCONF_CROSS_CLANG_LICENSE)) CROSS_CLANG_LICENSE_FILES := $(call remove_quotes,$(PTXCONF_CROSS_CLANG_LICENSE_FILES)) +ifndef PTXCONF_ARCH_X86_64 +CROSS_CLANG_PATCHES := none +endif + # ---------------------------------------------------------------------------- # Prepare # ---------------------------------------------------------------------------- |