-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
compiler-rt: apply armv6l patches to llvm >= 15 where applicable
the patches were written for #205176 but not kept for llvm >= 15
- Loading branch information
1 parent
4f807e8
commit 7b6139f
Showing
4 changed files
with
154 additions
and
6 deletions.
There are no files selected for viewing
File renamed without changes.
65 changes: 65 additions & 0 deletions
65
pkgs/development/compilers/llvm/15/compiler-rt/armv6-scudo-libatomic.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
From a56bb19a9dc303a50ef12d83cd24c2395bf81076 Mon Sep 17 00:00:00 2001 | ||
From: Ben Wolsieffer <[email protected]> | ||
Date: Wed, 7 Dec 2022 21:25:46 -0500 | ||
Subject: [PATCH] [scudo][standalone] Use CheckAtomic to decide to link to | ||
libatomic | ||
|
||
Standalone scudo uses the atomic operation builtin functions, which require | ||
linking to libatomic on some platforms. Currently, this is done in an ad-hoc | ||
manner. MIPS platforms always link to libatomic, and the tests are always linked | ||
to it as well. libatomic is required on base ARMv6 (but not ARMv6K), but it is | ||
currently not linked, causing the build to fail. | ||
|
||
This patch replaces this ad-hoc logic with the CheckAtomic CMake module already | ||
used in other parts of LLVM. The CheckAtomic module checks whether std::atomic | ||
requires libatomic, which is not strictly the same as checking the atomic | ||
builtins, but should have the same results as far as I know. If this is | ||
problematic, a custom version of CheckAtomic could be used to specifically test | ||
the builtins. | ||
--- | ||
compiler-rt/lib/scudo/standalone/CMakeLists.txt | 7 +++++++ | ||
compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt | 4 +--- | ||
2 files changed, 8 insertions(+), 3 deletions(-) | ||
|
||
diff --git a/lib/scudo/standalone/CMakeLists.txt b/lib/scudo/standalone/CMakeLists.txt | ||
index ae5c354768c8..eb27374ca520 100644 | ||
--- a/lib/scudo/standalone/CMakeLists.txt | ||
+++ b/lib/scudo/standalone/CMakeLists.txt | ||
@@ -1,5 +1,8 @@ | ||
add_compiler_rt_component(scudo_standalone) | ||
|
||
+include(DetermineGCCCompatible) | ||
+include(CheckAtomic) | ||
+ | ||
include_directories(../.. include) | ||
|
||
set(SCUDO_CFLAGS) | ||
@@ -34,6 +37,10 @@ list(APPEND SCUDO_LINK_FLAGS -Wl,-z,defs,-z,now,-z,relro) | ||
|
||
list(APPEND SCUDO_LINK_FLAGS -ffunction-sections -fdata-sections -Wl,--gc-sections) | ||
|
||
+if(HAVE_CXX_ATOMICS_WITH_LIB OR HAVE_CXX_ATOMICS64_WITH_LIB) | ||
+ list(APPEND SCUDO_LINK_FLAGS -latomic) | ||
+endif() | ||
+ | ||
# We don't use the C++ standard library, so avoid including it by mistake. | ||
append_list_if(COMPILER_RT_HAS_NOSTDLIBXX_FLAG -nostdlib++ SCUDO_LINK_FLAGS) | ||
append_list_if(CXX_SUPPORTS_UNWINDLIB_NONE_FLAG --unwindlib=none SCUDO_LINK_FLAGS) | ||
diff --git a/lib/scudo/standalone/tests/CMakeLists.txt b/lib/scudo/standalone/tests/CMakeLists.txt | ||
index 8200cd2588b3..73b3e9403c35 100644 | ||
--- a/lib/scudo/standalone/tests/CMakeLists.txt | ||
+++ b/lib/scudo/standalone/tests/CMakeLists.txt | ||
@@ -39,9 +39,7 @@ set(SCUDO_UNITTEST_LINK_FLAGS | ||
${COMPILER_RT_UNWINDER_LINK_LIBS} | ||
${SANITIZER_TEST_CXX_LIBRARIES}) | ||
list(APPEND SCUDO_UNITTEST_LINK_FLAGS -pthread -no-pie) | ||
-# Linking against libatomic is required with some compilers | ||
-check_library_exists(atomic __atomic_load_8 "" COMPILER_RT_HAS_LIBATOMIC) | ||
-if (COMPILER_RT_HAS_LIBATOMIC) | ||
+if (HAVE_CXX_ATOMICS_WITH_LIB OR HAVE_CXX_ATOMICS64_WITH_LIB) | ||
list(APPEND SCUDO_UNITTEST_LINK_FLAGS -latomic) | ||
endif() | ||
|
||
-- | ||
2.38.1 | ||
|
62 changes: 62 additions & 0 deletions
62
pkgs/development/compilers/llvm/19/compiler-rt/armv6-scudo-libatomic.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
From a56bb19a9dc303a50ef12d83cd24c2395bf81076 Mon Sep 17 00:00:00 2001 | ||
From: Ben Wolsieffer <[email protected]> | ||
Date: Wed, 7 Dec 2022 21:25:46 -0500 | ||
Subject: [PATCH] [scudo][standalone] Use CheckAtomic to decide to link to | ||
libatomic | ||
|
||
Standalone scudo uses the atomic operation builtin functions, which require | ||
linking to libatomic on some platforms. Currently, this is done in an ad-hoc | ||
manner. MIPS platforms always link to libatomic, and the tests are always linked | ||
to it as well. libatomic is required on base ARMv6 (but not ARMv6K), but it is | ||
currently not linked, causing the build to fail. | ||
|
||
This patch replaces this ad-hoc logic with the CheckAtomic CMake module already | ||
used in other parts of LLVM. The CheckAtomic module checks whether std::atomic | ||
requires libatomic, which is not strictly the same as checking the atomic | ||
builtins, but should have the same results as far as I know. If this is | ||
problematic, a custom version of CheckAtomic could be used to specifically test | ||
the builtins. | ||
--- | ||
compiler-rt/lib/scudo/standalone/CMakeLists.txt | 7 +++++++ | ||
compiler-rt/lib/scudo/standalone/tests/CMakeLists.txt | 4 +--- | ||
2 files changed, 8 insertions(+), 3 deletions(-) | ||
|
||
diff --git a/lib/scudo/standalone/CMakeLists.txt b/lib/scudo/standalone/CMakeLists.txt | ||
index dc700cec9bec..671dc7046604 100644 | ||
--- a/lib/scudo/standalone/CMakeLists.txt | ||
+++ b/lib/scudo/standalone/CMakeLists.txt | ||
@@ -1,5 +1,8 @@ | ||
add_compiler_rt_component(scudo_standalone) | ||
|
||
+include(DetermineGCCCompatible) | ||
+include(CheckAtomic) | ||
+ | ||
include_directories(../.. include) | ||
|
||
set(SCUDO_CFLAGS) | ||
@@ -39,6 +42,10 @@ list(APPEND SCUDO_LINK_FLAGS -Wl,-z,defs,-z,now,-z,relro) | ||
|
||
list(APPEND SCUDO_LINK_FLAGS -ffunction-sections -fdata-sections -Wl,--gc-sections) | ||
|
||
+if(HAVE_CXX_ATOMICS_WITH_LIB OR HAVE_CXX_ATOMICS64_WITH_LIB) | ||
+ list(APPEND SCUDO_LINK_FLAGS -latomic) | ||
+endif() | ||
+ | ||
# We don't use the C++ standard library, so avoid including it by mistake. | ||
append_list_if(COMPILER_RT_HAS_NOSTDLIBXX_FLAG -nostdlib++ SCUDO_LINK_FLAGS) | ||
append_list_if(CXX_SUPPORTS_UNWINDLIB_NONE_FLAG --unwindlib=none SCUDO_LINK_FLAGS) | ||
diff --git a/lib/scudo/standalone/tests/CMakeLists.txt b/lib/scudo/standalone/tests/CMakeLists.txt | ||
index a85eb737dba0..a23cf4d494f6 100644 | ||
--- a/lib/scudo/standalone/tests/CMakeLists.txt | ||
+++ b/lib/scudo/standalone/tests/CMakeLists.txt | ||
@@ -47,7 +47,7 @@ set(SCUDO_UNITTEST_LINK_FLAGS | ||
${SANITIZER_TEST_CXX_LIBRARIES}) | ||
list(APPEND SCUDO_UNITTEST_LINK_FLAGS -pthread -no-pie) | ||
|
||
-append_list_if(COMPILER_RT_HAS_LIBATOMIC -latomic SCUDO_UNITTEST_LINK_FLAGS) | ||
+append_list_if((HAVE_CXX_ATOMICS_WITH_LIB OR HAVE_CXX_ATOMICS64_WITH_LIB) -latomic SCUDO_UNITTEST_LINK_FLAGS) | ||
|
||
set(SCUDO_TEST_HEADERS | ||
scudo_unit_test.h | ||
2.38.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters