Skip to contentSkip to conversation

clang: consolidate sysroot compiler-rt search path patches

PATCH New [email protected] 1 participant 1 message Apr 14

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clang: consolidate sysroot compiler-rt search path patches

From: "mark.yang" <[email protected]>

Replace patches 0008 and 0033 with a single consolidated patch (0041) that fixes native build breakage.

The original patches unconditionally changed the runtime library search base from ResourceDir to SysRoot, which breaks native/standalone builds where SysRoot is empty (e.g., PGO bootstrap fails to find libclang_rt.profile.a). The new patch uses SysRoot-based paths only during cross-compilation and falls back to the upstream default ResourceDir for native builds.

---
 ...e-the-target-sysroot-for-compiler-ru.patch |  41 -------
 ...t-relative-paths-for-getArchSpecific.patch |  48 --------
 ...fix-sysroot-based-compiler-rt-search.patch | 105 ++++++++++++++++++
 meta/recipes-devtools/clang/common.inc        |   3 +-
 4 files changed, 106 insertions(+), 91 deletions(-)
 delete mode 100644 meta/recipes-devtools/clang/clang/0008-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch
 delete mode 100644 meta/recipes-devtools/clang/clang/0033-clang-Use-sysroot-relative-paths-for-getArchSpecific.patch
 create mode 100644 meta/recipes-devtools/clang/clang/0041-Consolidate-and-fix-sysroot-based-compiler-rt-search.patch
meta/recipes-devtools/clang/clang/0008-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch deleted +0 -41
deleted file mode 100644
index 5a0cea90d2..0000000000
@@ -1,41 +0,0 @@
-From d972eb4a51d911e33ad75f8b3ebedafc08efefac Mon Sep 17 00:00:00 2001
-From: Khem Raj <[email protected]>
-Date: Thu, 16 Mar 2017 19:06:26 -0700
-Subject: [PATCH] clang: Look inside the target sysroot for compiler runtime
-
-In OE compiler-rt and libc++ are built and staged into target
-sysroot and not into resourcedir which is relative to clang
-driver installation where the libraries are not instlled
-
-Specific to cross compiling the way yocto/OE works
-
-Upstream-Status: Pending
-Signed-off-by: Khem Raj <[email protected]>
----
- clang/lib/Driver/ToolChain.cpp | 6 +++++-
- 1 file changed, 5 insertions(+), 1 deletion(-)
-
-diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
-index 77a2c73f0d44..f39de1409c3c 100644
---- a/clang/lib/Driver/ToolChain.cpp
-+++ b/clang/lib/Driver/ToolChain.cpp
-@@ -15,6 +15,7 @@
- #include "ToolChains/InterfaceStubs.h"
- #include "clang/Basic/ObjCRuntime.h"
- #include "clang/Basic/Sanitizers.h"
-+#include "clang/Basic/Version.h"
- #include "clang/Config/config.h"
- #include "clang/Driver/Action.h"
- #include "clang/Driver/CommonArgs.h"
-@@ -723,7 +724,10 @@ StringRef ToolChain::getOSLibName() const {
- }
- 
- std::string ToolChain::getCompilerRTPath() const {
--  SmallString<128> Path(getDriver().ResourceDir);
-+  SmallString<128> Path(getDriver().SysRoot);
-+  StringRef ClangLibdirBasename(CLANG_INSTALL_LIBDIR_BASENAME);
-+  llvm::sys::path::append(Path, "/usr/", ClangLibdirBasename, "clang",
-+                            CLANG_VERSION_STRING);
-   if (isBareMetal()) {
-     llvm::sys::path::append(Path, "lib", getOSLibName());
-     if (!SelectedMultilibs.empty()) {
meta/recipes-devtools/clang/clang/0033-clang-Use-sysroot-relative-paths-for-getArchSpecific.patch deleted +0 -48

48 lines not on this page · raw message

meta/recipes-devtools/clang/clang/0041-Consolidate-and-fix-sysroot-based-compiler-rt-search.patch new file +105 -0

105 lines not on this page · raw message

meta/recipes-devtools/clang/common.inc +1 -2
index fecc98d70a..9d45898c68 100644
@@ -28,7 +28,6 @@ SRC_URI = "\
     file://0005-clang-driver-Check-sysroot-for-ldso-path.patch \
     file://0006-clang-Driver-tools.cpp-Add-lssp_nonshared-on-musl.patch \
     file://0007-clang-Prepend-trailing-to-sysroot.patch \
-    file://0008-clang-Look-inside-the-target-sysroot-for-compiler-ru.patch \
     file://0009-clang-Define-releative-gcc-installation-dir.patch \
     file://0010-clang-Add-lpthread-and-ldl-along-with-lunwind-for-st.patch \
     file://0011-Check-for-atomic-double-intrinsics.patch \
@@ -53,7 +52,6 @@ SRC_URI = "\
     file://0030-llvm-config-remove-LLVM_LDFLAGS-from-ldflags-output.patch \
     file://0031-compiler-rt-Exclude-sync_fetch_and_-for-any-pre-ARMv.patch \
     file://0032-compiler-rt-Hardcode-uptr-sptr-typedefs-on-Mips-Linu.patch \
-    file://0033-clang-Use-sysroot-relative-paths-for-getArchSpecific.patch \
     file://0034-Revert-libc-Remap-headers-in-the-debug-info-when-bui.patch \
     file://0035-Prevent-revisiting-block-when-searching-for-noreturn.patch \
     file://0036-Don-t-expose-LLVM_HAVE_OPT_VIEWER_MODULES-externally.patch \
@@ -61,6 +59,7 @@ SRC_URI = "\
     file://0038-llvm-libgcc-Fix-symlink-path-for-libcc-when-LLVM_ENA.patch \
     file://0039-Rename-UNUSED-and-UNKNOWN-elements-of-OffloadArch-enum.patch \
     file://0040-libcxxabi-declare-__gnu_unwind_frame-in-cxa_personal.patch \
+    file://0041-Consolidate-and-fix-sysroot-based-compiler-rt-search.patch \
 "
 # Fallback to no-PIE if not set
 GCCPIE ??= ""