sm-commit AT lists.ibiblio.org
Subject: Source Mage code commit list
List archive
[SM-Commit] GIT changes to master grimoire by Ismael Luceno (d58ac0dfb1a700e7c0045b8273b4e4a04862901b)
- From: Ismael Luceno <scm AT sourcemage.org>
- To: sm-commit AT lists.ibiblio.org
- Subject: [SM-Commit] GIT changes to master grimoire by Ismael Luceno (d58ac0dfb1a700e7c0045b8273b4e4a04862901b)
- Date: Mon, 30 Aug 2021 20:11:23 +0000
GIT changes to master grimoire by Ismael Luceno <ismael AT sourcemage.org>:
devel/llvm/BUILD | 5
devel/llvm/HISTORY | 5
devel/llvm/PRE_BUILD | 6 -
devel/llvm/patches-clang/clang-001-fix-unwind-chain-inclusion.patch | 45
+++++++
devel/llvm/patches-clang/compiler-rt-size_t.patch | 12 ++
devel/llvm/patches-libcxx/libcxx-musl.patch | 28
++++
devel/llvm/patches-libcxx/libcxxabi-dl.patch | 27
++++
devel/llvm/patches-lldb/lldb-musl.patch | 12 ++
devel/llvm/patches-llvm/llvm-001-musl.patch | 58
++++++++++
9 files changed, 197 insertions(+), 1 deletion(-)
New commits:
commit d58ac0dfb1a700e7c0045b8273b4e4a04862901b
Author: Ismael Luceno <ismael AT sourcemage.org>
Commit: Ismael Luceno <ismael AT sourcemage.org>
llvm: Fix build against musl
diff --git a/devel/llvm/BUILD b/devel/llvm/BUILD
index e8e81fd..09af912 100755
--- a/devel/llvm/BUILD
+++ b/devel/llvm/BUILD
@@ -1,3 +1,8 @@
+case "$HOST" in
+ (*-musl)
+ OPTS+=' -DLIBCXX_HAS_MUSL_LIBC=YES'
+ ;;
+esac &&
# Remove -DPIC from compiler flags, produces build errors
CXXFLAGS="${CXXFLAGS//-DPIC}" &&
# Default target, not detected correctly
diff --git a/devel/llvm/HISTORY b/devel/llvm/HISTORY
index 831d07e..071f965 100644
--- a/devel/llvm/HISTORY
+++ b/devel/llvm/HISTORY
@@ -3,6 +3,11 @@
* DEPENDS: added libexecinfo for musl
added dep on system six
* PRE_BUILD: fixed typo
+ * patches-clang/clang-001-fix-unwind-chain-inclusion.patch,
+ patches-clang/compiler-rt-size_t.patch,
+ patches-libcxx/libcxx-musl.patch, patches-libcxx/libcxxabi-dl.patch,
+ patches-lldb/lldb-musl.patch, patches-llvm/llvm-001-musl.patch,
+ BUILD, PRE_BUILD: fixed build against musl
2021-07-10 Florian Franzmann <bwlf AT bandrate.org>
* PRE_BUILD: only apply lld-related patch when lld is actually built
diff --git a/devel/llvm/PRE_BUILD b/devel/llvm/PRE_BUILD
index 70c8822..add4afe 100755
--- a/devel/llvm/PRE_BUILD
+++ b/devel/llvm/PRE_BUILD
@@ -1,5 +1,6 @@
default_pre_build &&
cd "$SOURCE_DIRECTORY" &&
+apply_patch_dir patches-llvm &&
if [[ "$LLVM_WITH_CLANG" == y ]]; then
unpack_file 5 &&
mv compiler-rt-${VERSION}.src projects/compiler-rt &&
@@ -7,6 +8,7 @@ if [[ "$LLVM_WITH_CLANG" == y ]]; then
mv clang-${VERSION}.src tools/clang &&
unpack_file 9 &&
mv clang-tools-extra-${VERSION}.src tools/clang/tools/extra &&
+ apply_patch_dir patches-clang &&
sedit '/^[\t ]*set(model_compiler
/{s@[.][.]/clang-tools-@tools/clang/tools/@}' \
tools/clang/tools/extra/clangd/quality/CompletionModel.cmake &&
# disable sanitizers on musl
@@ -19,7 +21,8 @@ fi &&
if [[ "$LLVM_WITH_LLDB" == y ]]; then
unpack_file 7 &&
- mv lldb-${VERSION}.src tools/lldb
+ mv lldb-${VERSION}.src tools/lldb &&
+ apply_patch_dir patches-lldb
fi &&
if [[ "$LLVM_WITH_POLLY" == y ]]; then
@@ -36,6 +39,7 @@ if [[ "$LLVM_WITH_LLD" == y ]]; then
mv libcxx-${VERSION}.src projects/libcxx &&
unpack_file 19 &&
mv libcxxabi-${VERSION}.src projects/libcxxabi &&
+ apply_patch_dir patches-libcxx &&
# Bugfix for llvm 12.0.0, cf.
https://groups.google.com/g/llvm-dev/c/gIY5COm6V5E
# This will probably be fixed in llvm 12.0.1.
diff --git
a/devel/llvm/patches-clang/clang-001-fix-unwind-chain-inclusion.patch
b/devel/llvm/patches-clang/clang-001-fix-unwind-chain-inclusion.patch
new file mode 100644
index 0000000..adc3fcd
--- /dev/null
+++ b/devel/llvm/patches-clang/clang-001-fix-unwind-chain-inclusion.patch
@@ -0,0 +1,45 @@
+From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe AT gmail.com>
+Date: Tue, 8 Sep 2015 22:14:57 +0200
+Subject: [PATCH 2/7] fix unwind chain inclusion
+
+Origin: Void Linux
+---
+ lib/Headers/unwind.h | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
+index 303d792..44e10cc 100644
+--- a/tools/clang/lib/Headers/unwind.h
++++ b/tools/clang/lib/Headers/unwind.h
+@@ -9,9 +9,6 @@
+
+ /* See "Data Definitions for libgcc_s" in the Linux Standard Base.*/
+
+-#ifndef __CLANG_UNWIND_H
+-#define __CLANG_UNWIND_H
+-
+ #if defined(__APPLE__) && __has_include_next(<unwind.h>)
+ /* Darwin (from 11.x on) provide an unwind.h. If that's available,
+ * use it. libunwind wraps some of its definitions in #ifdef _GNU_SOURCE,
+@@ -39,6 +36,9 @@
+ # endif
+ #else
+
++#ifndef __CLANG_UNWIND_H
++#define __CLANG_UNWIND_H
++
+ #include <stdint.h>
+
+ #ifdef __cplusplus
+@@ -322,6 +322,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct
_Unwind_Context *);
+ }
+ #endif
+
++#endif /* __CLANG_UNWIND_H */
++
+ #endif
+
+-#endif /* __CLANG_UNWIND_H */
+--
+2.5.1
diff --git a/devel/llvm/patches-clang/compiler-rt-size_t.patch
b/devel/llvm/patches-clang/compiler-rt-size_t.patch
new file mode 100644
index 0000000..c7272c6
--- /dev/null
+++ b/devel/llvm/patches-clang/compiler-rt-size_t.patch
@@ -0,0 +1,12 @@
+Origin: Void Linux
+
+--- a/projects/compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp
++++ b/projects/compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp
+@@ -25,6 +25,7 @@
+ }
+
+ #include <cassert>
++#include <cstddef>
+ #include <cstdint>
+ #include <dlfcn.h> // for dlsym()
+
diff --git a/devel/llvm/patches-libcxx/libcxx-musl.patch
b/devel/llvm/patches-libcxx/libcxx-musl.patch
new file mode 100644
index 0000000..9c9ba30
--- /dev/null
+++ b/devel/llvm/patches-libcxx/libcxx-musl.patch
@@ -0,0 +1,28 @@
+Origin: Void Linux
+
+--- a/projects/libcxx/include/locale
++++ b/projects/libcxx/include/locale
+@@ -742,7 +742,11 @@ __num_get_signed_integral(const char* __a, const char*
__a_end,
+ typename remove_reference<decltype(errno)>::type __save_errno =
errno;
+ errno = 0;
+ char *__p2;
++#if defined(__linux__) && !defined(__GLIBC__)
++ long long __ll = strtoll(__a, &__p2, __base);
++#else
+ long long __ll = strtoll_l(__a, &__p2, __base,
_LIBCPP_GET_C_LOCALE);
++#endif
+ typename remove_reference<decltype(errno)>::type __current_errno =
errno;
+ if (__current_errno == 0)
+ errno = __save_errno;
+@@ -782,7 +786,11 @@ __num_get_unsigned_integral(const char* __a, const
char* __a_end,
+ typename remove_reference<decltype(errno)>::type __save_errno =
errno;
+ errno = 0;
+ char *__p2;
++#if defined(__linux__) && !defined(__GLIBC__)
++ unsigned long long __ll = strtoull(__a, &__p2, __base);
++#else
+ unsigned long long __ll = strtoull_l(__a, &__p2, __base,
_LIBCPP_GET_C_LOCALE);
++#endif
+ typename remove_reference<decltype(errno)>::type __current_errno =
errno;
+ if (__current_errno == 0)
+ errno = __save_errno;
diff --git a/devel/llvm/patches-libcxx/libcxxabi-dl.patch
b/devel/llvm/patches-libcxx/libcxxabi-dl.patch
new file mode 100644
index 0000000..b8adb09
--- /dev/null
+++ b/devel/llvm/patches-libcxx/libcxxabi-dl.patch
@@ -0,0 +1,27 @@
+Also link to -ldl to prevent undefined references.
+
+Origin: Void Linux
+
+--- a/projects/libcxxabi/src/CMakeLists.txt
++++ b/projects/libcxxabi/src/CMakeLists.txt
+@@ -73,6 +73,7 @@
+ endif()
+
+ add_library_flags_if(LIBCXXABI_HAS_C_LIB c)
++ add_library_flags_if(LIBCXXABI_HAS_C_LIB dl)
+ endif()
+
+ if (LIBCXXABI_USE_LLVM_UNWINDER)
+--- a/projects/libcxx/CMakeLists.txt
++++ b/projects/libcxx/CMakeLists.txt
+@@ -745,6 +745,10 @@
+ target_link_libraries(${target} PRIVATE m)
+ endif()
+
++ if (LIBCXX_HAS_C_LIB)
++ target_link_libraries(${target} PRIVATE dl)
++ endif()
++
+ if (LIBCXX_HAS_RT_LIB)
+ target_link_libraries(${target} PRIVATE rt)
+ endif()
diff --git a/devel/llvm/patches-lldb/lldb-musl.patch
b/devel/llvm/patches-lldb/lldb-musl.patch
new file mode 100644
index 0000000..f2ba9cc
--- /dev/null
+++ b/devel/llvm/patches-lldb/lldb-musl.patch
@@ -0,0 +1,12 @@
+Origin: Void Linux
+
+--- a/tools/lldb/source/Plugins/Process/Linux/Procfs.h
++++ b/tools/lldb/source/Plugins/Process/Linux/Procfs.h
+@@ -10,6 +10,7 @@
+ // sys/procfs.h on Android/Linux for all supported architectures.
+
+ #include <sys/ptrace.h>
++#include <asm/ptrace.h>
+
+ #ifdef __ANDROID__
+ #if defined(__arm64__) || defined(__aarch64__)
diff --git a/devel/llvm/patches-llvm/llvm-001-musl.patch
b/devel/llvm/patches-llvm/llvm-001-musl.patch
new file mode 100644
index 0000000..3e68f3f
--- /dev/null
+++ b/devel/llvm/patches-llvm/llvm-001-musl.patch
@@ -0,0 +1,58 @@
+From faca3fbd15d0c3108493c3c54cd93138e049ac43 Mon Sep 17 00:00:00 2001
+From: Andrea Brancaleoni <miwaxe AT gmail.com>
+Date: Tue, 8 Sep 2015 22:03:02 +0200
+Subject: [PATCH 3/3] musl
+
+Origin: Void Linux
+---
+ include/llvm/Analysis/TargetLibraryInfo.h | 9 +++++++++
+ lib/Support/DynamicLibrary.cpp | 2 +-
+ lib/Support/Unix/Signals.inc | 6 +++---
+ utils/unittest/googletest/src/gtest.cc | 1 +
+ 5 files changed, 17 insertions(+), 6 deletions(-)
+
+diff --git a/include/llvm/Analysis/TargetLibraryInfo.h
b/include/llvm/Analysis/TargetLibraryInfo.h
+index 34a8a1e3..1214ece5 100644
+--- a/include/llvm/Analysis/TargetLibraryInfo.h
++++ b/include/llvm/Analysis/TargetLibraryInfo.h
+@@ -18,6 +18,15 @@
+ #include "llvm/IR/PassManager.h"
+ #include "llvm/Pass.h"
+
++#undef fopen64
++#undef fseeko64
++#undef fstat64
++#undef fstatvfs64
++#undef ftello64
++#undef lstat64
++#undef stat64
++#undef tmpfile64
++
+ namespace llvm {
+ template <typename T> class ArrayRef;
+ class Triple;
+diff --git a/lib/Support/Unix/DynamicLibrary.inc
b/lib/Support/Unix/DynamicLibrary.inc
+index a2a37996..2f86c470 100644
+--- a/lib/Support/Unix/DynamicLibrary.inc
++++ b/lib/Support/Unix/DynamicLibrary.inc
+@@ -102,7 +102,7 @@ static void *DoSearch(const char* SymbolName) {
+
+ // This macro returns the address of a well-known, explicit symbol
+ #define EXPLICIT_SYMBOL(SYM) \
+- if (!strcmp(SymbolName, #SYM)) return &SYM
++ if (!strcmp(SymbolName, #SYM)) return (void *)&SYM
+
+ // Under glibc we have a weird situation. The stderr/out/in symbols are both
+ // macros and global variables because of standards requirements. So, we
+diff --git a/utils/unittest/googletest/src/gtest.cc
b/utils/unittest/googletest/src/gtest.cc
+index d882ab2e..f1fb12d0 100644
+--- a/utils/unittest/googletest/src/gtest.cc
++++ b/utils/unittest/googletest/src/gtest.cc
+@@ -128,6 +128,7 @@
+
+ #if GTEST_CAN_STREAM_RESULTS_
+ # include <arpa/inet.h> // NOLINT
++# include <sys/socket.h> // NOLINT
+ # include <netdb.h> // NOLINT
+ # include <sys/socket.h> // NOLINT
+ # include <sys/types.h> // NOLINT
- [SM-Commit] GIT changes to master grimoire by Ismael Luceno (d58ac0dfb1a700e7c0045b8273b4e4a04862901b), Ismael Luceno, 08/30/2021
Archive powered by MHonArc 2.6.24.