From a1a6021f2aa6a822a5c5cc8eccc6e098e71eb285 Mon Sep 17 00:00:00 2001 From: q66 Date: Tue, 22 Jun 2021 21:11:13 +0200 Subject: [PATCH] llvm12: clean up template, fix libc++ with compiler-rt --- ...clang-001-fix-unwind-chain-inclusion.patch | 4 +- .../clang-002-add-musl-triples.patch | 4 +- .../clang-003-ppc64-dynamic-linker-path.patch | 4 +- .../clang-004-ppc64-musl-elfv2.patch | 12 +- .../compiler-rt-aarch64-ucontext.patch | 4 +- .../compiler-rt-sanitizer-ppc64-musl.patch | 12 +- .../compiler-rt-size_t.patch | 4 +- .../compiler-rt-xray-ppc64-musl.patch | 4 +- .../libcxx => patches}/libcxx-musl.patch | 4 +- .../libcxx => patches}/libcxx-ppc.patch | 4 +- .../libcxx-ssp-nonshared.patch | 4 +- srcpkgs/llvm12/patches/libcxxabi-dl.patch | 25 ++ .../libunwind-ppc32.patch | 20 +- .../musl.patch => patches/lldb-musl.patch} | 4 +- .../llvm => patches}/llvm-001-musl.patch | 12 +- .../llvm-002-musl-ppc64-elfv2.patch | 8 +- .../llvm-003-ppc-secureplt.patch | 4 +- .../llvm-004-override-opt.patch | 4 +- .../llvm-005-ppc-bigpic.patch | 8 +- .../llvm-006-aarch64-mf_exec.patch | 4 +- .../llvm12/patches/ppc32-compiler-rt.patch | 21 ++ srcpkgs/llvm12/template | 215 +++++------------- 22 files changed, 163 insertions(+), 222 deletions(-) rename srcpkgs/llvm12/{files/patches/clang => patches}/clang-001-fix-unwind-chain-inclusion.patch (94%) rename srcpkgs/llvm12/{files/patches/clang => patches}/clang-002-add-musl-triples.patch (98%) rename srcpkgs/llvm12/{files/patches/clang => patches}/clang-003-ppc64-dynamic-linker-path.patch (79%) rename srcpkgs/llvm12/{files/patches/clang => patches}/clang-004-ppc64-musl-elfv2.patch (86%) rename srcpkgs/llvm12/{files/patches/compiler-rt => patches}/compiler-rt-aarch64-ucontext.patch (73%) rename srcpkgs/llvm12/{files/patches/compiler-rt => patches}/compiler-rt-sanitizer-ppc64-musl.patch (67%) rename srcpkgs/llvm12/{files/patches/compiler-rt => patches}/compiler-rt-size_t.patch (52%) rename srcpkgs/llvm12/{files/patches/compiler-rt => patches}/compiler-rt-xray-ppc64-musl.patch (93%) rename srcpkgs/llvm12/{files/patches/libcxx => patches}/libcxx-musl.patch (95%) rename srcpkgs/llvm12/{files/patches/libcxx => patches}/libcxx-ppc.patch (94%) rename srcpkgs/llvm12/{files/patches/libcxx => patches}/libcxx-ssp-nonshared.patch (83%) create mode 100644 srcpkgs/llvm12/patches/libcxxabi-dl.patch rename srcpkgs/llvm12/{files/patches/libunwind => patches}/libunwind-ppc32.patch (82%) rename srcpkgs/llvm12/{files/patches/lldb/musl.patch => patches/lldb-musl.patch} (88%) rename srcpkgs/llvm12/{files/patches/llvm => patches}/llvm-001-musl.patch (85%) rename srcpkgs/llvm12/{files/patches/llvm => patches}/llvm-002-musl-ppc64-elfv2.patch (88%) rename srcpkgs/llvm12/{files/patches/llvm => patches}/llvm-003-ppc-secureplt.patch (78%) rename srcpkgs/llvm12/{files/patches/llvm => patches}/llvm-004-override-opt.patch (91%) rename srcpkgs/llvm12/{files/patches/llvm => patches}/llvm-005-ppc-bigpic.patch (89%) rename srcpkgs/llvm12/{files/patches/llvm => patches}/llvm-006-aarch64-mf_exec.patch (95%) create mode 100644 srcpkgs/llvm12/patches/ppc32-compiler-rt.patch diff --git a/srcpkgs/llvm12/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm12/patches/clang-001-fix-unwind-chain-inclusion.patch similarity index 94% rename from srcpkgs/llvm12/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch rename to srcpkgs/llvm12/patches/clang-001-fix-unwind-chain-inclusion.patch index 04244bcc274..e4eaa7783e7 100644 --- a/srcpkgs/llvm12/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch +++ b/srcpkgs/llvm12/patches/clang-001-fix-unwind-chain-inclusion.patch @@ -9,8 +9,8 @@ Subject: [PATCH 2/7] fix unwind chain inclusion diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h index 303d792..44e10cc 100644 ---- a/lib/Headers/unwind.h -+++ b/lib/Headers/unwind.h +--- a/clang/lib/Headers/unwind.h ++++ b/clang/lib/Headers/unwind.h @@ -9,9 +9,6 @@ /* See "Data Definitions for libgcc_s" in the Linux Standard Base.*/ diff --git a/srcpkgs/llvm12/files/patches/clang/clang-002-add-musl-triples.patch b/srcpkgs/llvm12/patches/clang-002-add-musl-triples.patch similarity index 98% rename from srcpkgs/llvm12/files/patches/clang/clang-002-add-musl-triples.patch rename to srcpkgs/llvm12/patches/clang-002-add-musl-triples.patch index 6945e7fe79e..25688d40dbc 100644 --- a/srcpkgs/llvm12/files/patches/clang/clang-002-add-musl-triples.patch +++ b/srcpkgs/llvm12/patches/clang-002-add-musl-triples.patch @@ -1,5 +1,5 @@ ---- a/lib/Driver/ToolChains/Gnu.cpp -+++ b/lib/Driver/ToolChains/Gnu.cpp +--- a/clang/lib/Driver/ToolChains/Gnu.cpp ++++ b/clang/lib/Driver/ToolChains/Gnu.cpp @@ -2086,7 +2086,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf", "armv7hl-redhat-linux-gnueabi", diff --git a/srcpkgs/llvm12/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm12/patches/clang-003-ppc64-dynamic-linker-path.patch similarity index 79% rename from srcpkgs/llvm12/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch rename to srcpkgs/llvm12/patches/clang-003-ppc64-dynamic-linker-path.patch index afc0810f48d..4ad6412d1e6 100644 --- a/srcpkgs/llvm12/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch +++ b/srcpkgs/llvm12/patches/clang-003-ppc64-dynamic-linker-path.patch @@ -1,5 +1,5 @@ ---- a/lib/Driver/ToolChains/Linux.cpp -+++ b/lib/Driver/ToolChains/Linux.cpp +--- a/clang/lib/Driver/ToolChains/Linux.cpp ++++ b/clang/lib/Driver/ToolChains/Linux.cpp @@ -504,10 +504,6 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const { Loader = "ld.so.1"; break; diff --git a/srcpkgs/llvm12/files/patches/clang/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm12/patches/clang-004-ppc64-musl-elfv2.patch similarity index 86% rename from srcpkgs/llvm12/files/patches/clang/clang-004-ppc64-musl-elfv2.patch rename to srcpkgs/llvm12/patches/clang-004-ppc64-musl-elfv2.patch index 912094e5535..21fc8003c5f 100644 --- a/srcpkgs/llvm12/files/patches/clang/clang-004-ppc64-musl-elfv2.patch +++ b/srcpkgs/llvm12/patches/clang-004-ppc64-musl-elfv2.patch @@ -1,5 +1,5 @@ ---- a/lib/Basic/Targets/PPC.h -+++ b/lib/Basic/Targets/PPC.h +--- a/clang/lib/Basic/Targets/PPC.h ++++ b/clang/lib/Basic/Targets/PPC.h @@ -415,11 +415,10 @@ public: LongDoubleFormat = &llvm::APFloat::IEEEdouble(); } else if ((Triple.getArch() == llvm::Triple::ppc64le)) { @@ -13,8 +13,8 @@ if (Triple.isOSFreeBSD() || Triple.isOSOpenBSD() || Triple.isMusl()) { LongDoubleWidth = LongDoubleAlign = 64; ---- a/lib/CodeGen/TargetInfo.cpp -+++ b/lib/CodeGen/TargetInfo.cpp +--- a/clang/lib/CodeGen/TargetInfo.cpp ++++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -10927,9 +10927,9 @@ const TargetCodeGenInfo &CodeGenModule::getTargetCodeGenInfo() { return SetCGInfo(new AIXTargetCodeGenInfo(Types, /*Is64Bit*/ true)); @@ -28,8 +28,8 @@ bool IsSoftFloat = CodeGenOpts.FloatABI == "soft"; return SetCGInfo( ---- a/lib/Driver/ToolChains/Clang.cpp -+++ b/lib/Driver/ToolChains/Clang.cpp +--- a/clang/lib/Driver/ToolChains/Clang.cpp ++++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -1920,14 +1920,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args, const llvm::Triple &T = getToolChain().getTriple(); if (T.isOSBinFormatELF()) { diff --git a/srcpkgs/llvm12/files/patches/compiler-rt/compiler-rt-aarch64-ucontext.patch b/srcpkgs/llvm12/patches/compiler-rt-aarch64-ucontext.patch similarity index 73% rename from srcpkgs/llvm12/files/patches/compiler-rt/compiler-rt-aarch64-ucontext.patch rename to srcpkgs/llvm12/patches/compiler-rt-aarch64-ucontext.patch index 49689ca01a6..893c059d7b8 100644 --- a/srcpkgs/llvm12/files/patches/compiler-rt/compiler-rt-aarch64-ucontext.patch +++ b/srcpkgs/llvm12/patches/compiler-rt-aarch64-ucontext.patch @@ -1,5 +1,5 @@ ---- compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp.orig -+++ compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp +--- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp.orig ++++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp @@ -1799,7 +1799,7 @@ static bool Aarch64GetESR(ucontext_t *ucontext, u64 *esr) { diff --git a/srcpkgs/llvm12/files/patches/compiler-rt/compiler-rt-sanitizer-ppc64-musl.patch b/srcpkgs/llvm12/patches/compiler-rt-sanitizer-ppc64-musl.patch similarity index 67% rename from srcpkgs/llvm12/files/patches/compiler-rt/compiler-rt-sanitizer-ppc64-musl.patch rename to srcpkgs/llvm12/patches/compiler-rt-sanitizer-ppc64-musl.patch index a776e823de1..35f16d24f34 100644 --- a/srcpkgs/llvm12/files/patches/compiler-rt/compiler-rt-sanitizer-ppc64-musl.patch +++ b/srcpkgs/llvm12/patches/compiler-rt-sanitizer-ppc64-musl.patch @@ -1,5 +1,5 @@ ---- a/lib/sanitizer_common/sanitizer_linux.cpp -+++ b/lib/sanitizer_common/sanitizer_linux.cpp +--- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp ++++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp @@ -74,6 +74,10 @@ #include #endif @@ -11,8 +11,8 @@ #if SANITIZER_LINUX && !SANITIZER_ANDROID #include #endif ---- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp -+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp +--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp ++++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp @@ -92,7 +92,7 @@ # include # include @@ -22,8 +22,8 @@ # include # ifdef __arm__ typedef struct user_fpregs elf_fpregset_t; ---- a/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp -+++ b/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp +--- a/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp ++++ b/compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp @@ -31,7 +31,7 @@ #include // for pid_t #include // for iovec diff --git a/srcpkgs/llvm12/files/patches/compiler-rt/compiler-rt-size_t.patch b/srcpkgs/llvm12/patches/compiler-rt-size_t.patch similarity index 52% rename from srcpkgs/llvm12/files/patches/compiler-rt/compiler-rt-size_t.patch rename to srcpkgs/llvm12/patches/compiler-rt-size_t.patch index 2c943d92470..2c63063a5e9 100644 --- a/srcpkgs/llvm12/files/patches/compiler-rt/compiler-rt-size_t.patch +++ b/srcpkgs/llvm12/patches/compiler-rt-size_t.patch @@ -1,5 +1,5 @@ ---- compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp.orig -+++ compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp +--- a/compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp.orig ++++ b/compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp @@ -25,6 +25,7 @@ } diff --git a/srcpkgs/llvm12/files/patches/compiler-rt/compiler-rt-xray-ppc64-musl.patch b/srcpkgs/llvm12/patches/compiler-rt-xray-ppc64-musl.patch similarity index 93% rename from srcpkgs/llvm12/files/patches/compiler-rt/compiler-rt-xray-ppc64-musl.patch rename to srcpkgs/llvm12/patches/compiler-rt-xray-ppc64-musl.patch index 6db37ce06f7..d0b61c80c89 100644 --- a/srcpkgs/llvm12/files/patches/compiler-rt/compiler-rt-xray-ppc64-musl.patch +++ b/srcpkgs/llvm12/patches/compiler-rt-xray-ppc64-musl.patch @@ -1,5 +1,5 @@ ---- a/lib/xray/xray_powerpc64.inc -+++ b/lib/xray/xray_powerpc64.inc +--- a/compiler-rt/lib/xray/xray_powerpc64.inc ++++ b/compiler-rt/lib/xray/xray_powerpc64.inc @@ -12,7 +12,13 @@ #include diff --git a/srcpkgs/llvm12/files/patches/libcxx/libcxx-musl.patch b/srcpkgs/llvm12/patches/libcxx-musl.patch similarity index 95% rename from srcpkgs/llvm12/files/patches/libcxx/libcxx-musl.patch rename to srcpkgs/llvm12/patches/libcxx-musl.patch index f6068f7d440..bbd31ffc2cb 100644 --- a/srcpkgs/llvm12/files/patches/libcxx/libcxx-musl.patch +++ b/srcpkgs/llvm12/patches/libcxx-musl.patch @@ -1,5 +1,5 @@ ---- a/include/locale -+++ b/include/locale +--- a/libcxx/include/locale ++++ b/libcxx/include/locale @@ -742,7 +742,11 @@ __num_get_signed_integral(const char* __a, const char* __a_end, typename remove_reference::type __save_errno = errno; errno = 0; diff --git a/srcpkgs/llvm12/files/patches/libcxx/libcxx-ppc.patch b/srcpkgs/llvm12/patches/libcxx-ppc.patch similarity index 94% rename from srcpkgs/llvm12/files/patches/libcxx/libcxx-ppc.patch rename to srcpkgs/llvm12/patches/libcxx-ppc.patch index b1a7bab499f..7a92f8004e1 100644 --- a/srcpkgs/llvm12/files/patches/libcxx/libcxx-ppc.patch +++ b/srcpkgs/llvm12/patches/libcxx-ppc.patch @@ -2,8 +2,8 @@ This ensures `is_iec559` is defined correctly under all long double ABIs, including musl and its 64-bit long double. Also, `__ppc__` or `__ppc64__` is not defined on gcc. ---- a/include/limits -+++ b/include/limits +--- a/libcxx/include/limits ++++ b/libcxx/include/limits @@ -426,8 +426,14 @@ protected: _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansl("");} _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;} diff --git a/srcpkgs/llvm12/files/patches/libcxx/libcxx-ssp-nonshared.patch b/srcpkgs/llvm12/patches/libcxx-ssp-nonshared.patch similarity index 83% rename from srcpkgs/llvm12/files/patches/libcxx/libcxx-ssp-nonshared.patch rename to srcpkgs/llvm12/patches/libcxx-ssp-nonshared.patch index 86ce396959d..70292beb2fc 100644 --- a/srcpkgs/llvm12/files/patches/libcxx/libcxx-ssp-nonshared.patch +++ b/srcpkgs/llvm12/patches/libcxx-ssp-nonshared.patch @@ -1,5 +1,5 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt +--- a/libcxx/CMakeLists.txt ++++ b/libcxx/CMakeLists.txt @@ -769,6 +769,8 @@ function(cxx_link_system_libraries target) target_link_libraries(${target} PRIVATE atomic) endif() diff --git a/srcpkgs/llvm12/patches/libcxxabi-dl.patch b/srcpkgs/llvm12/patches/libcxxabi-dl.patch new file mode 100644 index 00000000000..3a15f9db8c9 --- /dev/null +++ b/srcpkgs/llvm12/patches/libcxxabi-dl.patch @@ -0,0 +1,25 @@ +Also link to -ldl to prevent undefined references. + +--- a/libcxxabi/src/CMakeLists.txt ++++ b/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/libcxx/CMakeLists.txt ++++ b/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/srcpkgs/llvm12/files/patches/libunwind/libunwind-ppc32.patch b/srcpkgs/llvm12/patches/libunwind-ppc32.patch similarity index 82% rename from srcpkgs/llvm12/files/patches/libunwind/libunwind-ppc32.patch rename to srcpkgs/llvm12/patches/libunwind-ppc32.patch index 08fdb991531..74aa7576ecf 100644 --- a/srcpkgs/llvm12/files/patches/libunwind/libunwind-ppc32.patch +++ b/srcpkgs/llvm12/patches/libunwind-ppc32.patch @@ -1,7 +1,7 @@ This fixes build at least with gcc9 which does not define `__ppc__`. ---- a/include/__libunwind_config.h -+++ b/include/__libunwind_config.h +--- a/libunwind/include/__libunwind_config.h ++++ b/libunwind/include/__libunwind_config.h @@ -49,7 +49,7 @@ # define _LIBUNWIND_CONTEXT_SIZE 167 # define _LIBUNWIND_CURSOR_SIZE 179 @@ -11,8 +11,8 @@ This fixes build at least with gcc9 which does not define `__ppc__`. # define _LIBUNWIND_TARGET_PPC 1 # define _LIBUNWIND_CONTEXT_SIZE 117 # define _LIBUNWIND_CURSOR_SIZE 124 ---- a/src/UnwindRegistersRestore.S -+++ b/src/UnwindRegistersRestore.S +--- a/libunwind/src/UnwindRegistersRestore.S ++++ b/libunwind/src/UnwindRegistersRestore.S @@ -392,7 +392,7 @@ Lnovec: PPC64_LR(3) bctr @@ -22,8 +22,8 @@ This fixes build at least with gcc9 which does not define `__ppc__`. DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind13Registers_ppc6jumptoEv) // ---- a/src/UnwindRegistersSave.S -+++ b/src/UnwindRegistersSave.S +--- a/libunwind/src/UnwindRegistersSave.S ++++ b/libunwind/src/UnwindRegistersSave.S @@ -554,7 +554,7 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getcontext) blr @@ -33,8 +33,8 @@ This fixes build at least with gcc9 which does not define `__ppc__`. // // extern int unw_getcontext(unw_context_t* thread_state) ---- a/src/config.h -+++ b/src/config.h +--- a/libunwind/src/config.h ++++ b/libunwind/src/config.h @@ -95,12 +95,12 @@ #define _LIBUNWIND_BUILD_SJLJ_APIS #endif @@ -50,8 +50,8 @@ This fixes build at least with gcc9 which does not define `__ppc__`. (!defined(__APPLE__) && defined(__arm__)) || \ (defined(__arm64__) || defined(__aarch64__)) || \ defined(__mips__) ---- a/src/libunwind.cpp -+++ b/src/libunwind.cpp +--- a/libunwind/src/libunwind.cpp ++++ b/libunwind/src/libunwind.cpp @@ -42,7 +42,7 @@ _LIBUNWIND_HIDDEN int __unw_init_local(unw_cursor_t *cursor, # define REGISTER_KIND Registers_x86_64 #elif defined(__powerpc64__) diff --git a/srcpkgs/llvm12/files/patches/lldb/musl.patch b/srcpkgs/llvm12/patches/lldb-musl.patch similarity index 88% rename from srcpkgs/llvm12/files/patches/lldb/musl.patch rename to srcpkgs/llvm12/patches/lldb-musl.patch index 37416bb478d..601c0d13852 100644 --- a/srcpkgs/llvm12/files/patches/lldb/musl.patch +++ b/srcpkgs/llvm12/patches/lldb-musl.patch @@ -1,5 +1,5 @@ ---- a/source/Plugins/Process/Linux/Procfs.h -+++ b/source/Plugins/Process/Linux/Procfs.h +--- a/lldb/source/Plugins/Process/Linux/Procfs.h ++++ b/lldb/source/Plugins/Process/Linux/Procfs.h @@ -10,21 +10,12 @@ // sys/procfs.h on Android/Linux for all supported architectures. diff --git a/srcpkgs/llvm12/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm12/patches/llvm-001-musl.patch similarity index 85% rename from srcpkgs/llvm12/files/patches/llvm/llvm-001-musl.patch rename to srcpkgs/llvm12/patches/llvm-001-musl.patch index 0204a89d8af..f2a3f8d6281 100644 --- a/srcpkgs/llvm12/files/patches/llvm/llvm-001-musl.patch +++ b/srcpkgs/llvm12/patches/llvm-001-musl.patch @@ -12,8 +12,8 @@ Subject: [PATCH 3/3] musl 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 +--- a/llvm/include/llvm/Analysis/TargetLibraryInfo.h ++++ b/llvm/include/llvm/Analysis/TargetLibraryInfo.h @@ -18,6 +18,15 @@ #include "llvm/IR/PassManager.h" #include "llvm/Pass.h" @@ -32,8 +32,8 @@ index 34a8a1e3..1214ece5 100644 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 +--- a/llvm/lib/Support/Unix/DynamicLibrary.inc ++++ b/llvm/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 @@ -45,8 +45,8 @@ index a2a37996..2f86c470 100644 // 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 +--- a/llvm/utils/unittest/googletest/src/gtest.cc ++++ b/llvm/utils/unittest/googletest/src/gtest.cc @@ -128,6 +128,7 @@ #if GTEST_CAN_STREAM_RESULTS_ diff --git a/srcpkgs/llvm12/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm12/patches/llvm-002-musl-ppc64-elfv2.patch similarity index 88% rename from srcpkgs/llvm12/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch rename to srcpkgs/llvm12/patches/llvm-002-musl-ppc64-elfv2.patch index fb842cf0034..0071d964bd3 100644 --- a/srcpkgs/llvm12/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch +++ b/srcpkgs/llvm12/patches/llvm-002-musl-ppc64-elfv2.patch @@ -4,8 +4,8 @@ on big endian ppc64. diff --git a/lib/Target/PowerPC/PPCTargetMachine.cpp b/lib/Target/PowerPC/PPCTargetMachine.cpp index 0634833e..b7cbc2e7 100644 ---- a/lib/Target/PowerPC/PPCTargetMachine.cpp -+++ b/lib/Target/PowerPC/PPCTargetMachine.cpp +--- a/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp ++++ b/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp @@ -222,9 +222,8 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT, switch (TT.getArch()) { @@ -19,8 +19,8 @@ index 0634833e..b7cbc2e7 100644 } diff --git a/test/CodeGen/PowerPC/ppc64-elf-abi.ll b/test/CodeGen/PowerPC/ppc64-elf-abi.ll index 8b1cf6b5..296a2afa 100644 ---- a/test/CodeGen/PowerPC/ppc64-elf-abi.ll -+++ b/test/CodeGen/PowerPC/ppc64-elf-abi.ll +--- a/llvm/test/CodeGen/PowerPC/ppc64-elf-abi.ll ++++ b/llvm/test/CodeGen/PowerPC/ppc64-elf-abi.ll @@ -1,4 +1,5 @@ -; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv1 +; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2 diff --git a/srcpkgs/llvm12/files/patches/llvm/llvm-003-ppc-secureplt.patch b/srcpkgs/llvm12/patches/llvm-003-ppc-secureplt.patch similarity index 78% rename from srcpkgs/llvm12/files/patches/llvm/llvm-003-ppc-secureplt.patch rename to srcpkgs/llvm12/patches/llvm-003-ppc-secureplt.patch index b9e60d5629f..b5d15974375 100644 --- a/srcpkgs/llvm12/files/patches/llvm/llvm-003-ppc-secureplt.patch +++ b/srcpkgs/llvm12/patches/llvm-003-ppc-secureplt.patch @@ -1,5 +1,5 @@ ---- llvm/lib/Target/PowerPC/PPCSubtarget.cpp -+++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp +--- a/llvm/lib/Target/PowerPC/PPCSubtarget.cpp ++++ b/llvm/lib/Target/PowerPC/PPCSubtarget.cpp @@ -165,7 +165,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) { if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) || diff --git a/srcpkgs/llvm12/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm12/patches/llvm-004-override-opt.patch similarity index 91% rename from srcpkgs/llvm12/files/patches/llvm/llvm-004-override-opt.patch rename to srcpkgs/llvm12/patches/llvm-004-override-opt.patch index 3f5276c3cfd..51d0e4b31b3 100644 --- a/srcpkgs/llvm12/files/patches/llvm/llvm-004-override-opt.patch +++ b/srcpkgs/llvm12/patches/llvm-004-override-opt.patch @@ -1,8 +1,8 @@ This allows us to override the optimization level as not all platforms can deal with -O3. ---- a/CMakeLists.txt -+++ b/CMakeLists.txt +--- a/llvm/CMakeLists.txt ++++ b/llvm/CMakeLists.txt @@ -918,6 +918,12 @@ if( MINGW AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" ) llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "-O2") endif() diff --git a/srcpkgs/llvm12/files/patches/llvm/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm12/patches/llvm-005-ppc-bigpic.patch similarity index 89% rename from srcpkgs/llvm12/files/patches/llvm/llvm-005-ppc-bigpic.patch rename to srcpkgs/llvm12/patches/llvm-005-ppc-bigpic.patch index d0c0cdb0680..d332687b9d9 100644 --- a/srcpkgs/llvm12/files/patches/llvm/llvm-005-ppc-bigpic.patch +++ b/srcpkgs/llvm12/patches/llvm-005-ppc-bigpic.patch @@ -10,8 +10,8 @@ Subject: [PATCH] [LLVM][PowerPC] Assume BigPIC if no PIC level is specified diff --git a/lib/Target/PowerPC/PPCAsmPrinter.cpp b/lib/Target/PowerPC/PPCAsmPrinter.cpp index cce21f32..87ca5f9b 100644 ---- a/lib/Target/PowerPC/PPCAsmPrinter.cpp -+++ b/lib/Target/PowerPC/PPCAsmPrinter.cpp +--- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp ++++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp @@ -520,7 +520,7 @@ void PPCAsmPrinter::EmitTlsCall(const MachineInstr *MI, // Add 32768 offset to the symbol so we follow up the latest GOT/PLT ABI. @@ -23,8 +23,8 @@ index cce21f32..87ca5f9b 100644 const MachineOperand &MO = MI->getOperand(2); diff --git a/lib/Target/PowerPC/PPCMCInstLower.cpp b/lib/Target/PowerPC/PPCMCInstLower.cpp index 5cc180d7..a5b02565 100644 ---- a/lib/Target/PowerPC/PPCMCInstLower.cpp -+++ b/lib/Target/PowerPC/PPCMCInstLower.cpp +--- a/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp ++++ b/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp @@ -117,7 +117,7 @@ static MCOperand GetSymbolRef(const MachineOperand &MO, const MCSymbol *Symbol, const MCExpr *Expr = MCSymbolRefExpr::create(Symbol, RefKind, Ctx); // If -msecure-plt -fPIC, add 32768 to symbol. diff --git a/srcpkgs/llvm12/files/patches/llvm/llvm-006-aarch64-mf_exec.patch b/srcpkgs/llvm12/patches/llvm-006-aarch64-mf_exec.patch similarity index 95% rename from srcpkgs/llvm12/files/patches/llvm/llvm-006-aarch64-mf_exec.patch rename to srcpkgs/llvm12/patches/llvm-006-aarch64-mf_exec.patch index 098d7484c27..a00abd21666 100644 --- a/srcpkgs/llvm12/files/patches/llvm/llvm-006-aarch64-mf_exec.patch +++ b/srcpkgs/llvm12/patches/llvm-006-aarch64-mf_exec.patch @@ -12,8 +12,8 @@ Fix failures in AllocationTests/MappedMemoryTest.* on aarch64: Upstream-Issue: https://bugs.llvm.org/show_bug.cgi?id=14278#c10 ---- a/lib/Support/Unix/Memory.inc -+++ b/lib/Support/Unix/Memory.inc +--- a/llvm/lib/Support/Unix/Memory.inc ++++ b/llvm/lib/Support/Unix/Memory.inc @@ -58,7 +58,7 @@ static int getPosixProtectionFlags(unsigned Flags) { return PROT_READ | PROT_WRITE | PROT_EXEC; case llvm::sys::Memory::MF_EXEC: diff --git a/srcpkgs/llvm12/patches/ppc32-compiler-rt.patch b/srcpkgs/llvm12/patches/ppc32-compiler-rt.patch new file mode 100644 index 00000000000..8e0a9a779d1 --- /dev/null +++ b/srcpkgs/llvm12/patches/ppc32-compiler-rt.patch @@ -0,0 +1,21 @@ +commit ba4ede595ff9599232f5dd2b4384c243137b53fc +Author: Daniel Kolesa +Date: Tue Jun 22 23:40:54 2021 +0200 + + enable compiler-rt support for ppc32 + +diff --git a/compiler-rt/cmake/base-config-ix.cmake b/compiler-rt/cmake/base-config-ix.cmake +index 1edab43..5c0c8a2 100644 +--- a/compiler-rt/cmake/base-config-ix.cmake ++++ b/compiler-rt/cmake/base-config-ix.cmake +@@ -182,9 +182,7 @@ macro(test_targets) + elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "powerpc64le") + test_target_arch(powerpc64le "" "-m64") + elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "powerpc") +- if(CMAKE_SYSTEM_NAME MATCHES "AIX") +- test_target_arch(powerpc "" "-m32") +- endif() ++ test_target_arch(powerpc "" "-m32") + test_target_arch(powerpc64 "" "-m64") + elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "s390x") + test_target_arch(s390x "" "") diff --git a/srcpkgs/llvm12/template b/srcpkgs/llvm12/template index 38937f68564..f837db61f06 100644 --- a/srcpkgs/llvm12/template +++ b/srcpkgs/llvm12/template @@ -1,27 +1,29 @@ # Template file for 'llvm12' pkgname=llvm12 version=12.0.0 -revision=2 -wrksrc="llvm-${version}.src" +revision=3 +wrksrc="llvm-project-${version}.src" +build_wrksrc=llvm build_style=cmake configure_args=" -DCMAKE_BUILD_TYPE=Release -Wno-dev - -DENABLE_LINKER_BUILD_ID=ON - -DLLDB_USE_SYSTEM_SIX=ON + -DENABLE_LINKER_BUILD_ID=YES + -DLLDB_USE_SYSTEM_SIX=YES -DLIBCXX_CXX_ABI=libcxxabi - -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON - -DLIBCXXABI_USE_LLVM_UNWINDER=1 - -DLIBOMP_ENABLE_SHARED=ON - -DLIBOMP_INSTALL_ALIASES=OFF - -DLLVM_INCLUDE_DOCS=ON - -DLLVM_BUILD_DOCS=ON - -DLLVM_ENABLE_SPHINX=ON - -DSPHINX_WARNINGS_AS_ERRORS=OFF - -DLLVM_INSTALL_UTILS=ON - -DLLVM_BUILD_LLVM_DYLIB=ON - -DLLVM_LINK_LLVM_DYLIB=ON - -DLLVM_ENABLE_RTTI=ON - -DLLVM_ENABLE_FFI=ON + -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=YES + -DLIBCXXABI_USE_LLVM_UNWINDER=YES + -DLIBCXXABI_ENABLE_STATIC_UNWINDER=YES + -DLIBOMP_ENABLE_SHARED=YES + -DLIBOMP_INSTALL_ALIASES=NO + -DLLVM_INCLUDE_DOCS=YES + -DLLVM_BUILD_DOCS=YES + -DLLVM_ENABLE_SPHINX=YES + -DSPHINX_WARNINGS_AS_ERRORS=NO + -DLLVM_INSTALL_UTILS=YES + -DLLVM_BUILD_LLVM_DYLIB=YES + -DLLVM_LINK_LLVM_DYLIB=YES + -DLLVM_ENABLE_RTTI=YES + -DLLVM_ENABLE_FFI=YES -DLLVM_BINUTILS_INCDIR=/usr/include" hostmakedepends="groff perl python3 zlib-devel libffi-devel swig python3-Sphinx python3-recommonmark python3-sphinx-automodapi" @@ -32,28 +34,8 @@ short_desc="Low Level Virtual Machine" maintainer="q66 " license="Apache-2.0" homepage="https://www.llvm.org" -distfiles=" - https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz - https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lldb-${version}.src.tar.xz - https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/lld-${version}.src.tar.xz - https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-${version}.src.tar.xz - https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/clang-tools-extra-${version}.src.tar.xz - https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/compiler-rt-${version}.src.tar.xz - https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libunwind-${version}.src.tar.xz - https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxx-${version}.src.tar.xz - https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libcxxabi-${version}.src.tar.xz - https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/openmp-${version}.src.tar.xz" -checksum=" - 49dc47c8697a1a0abd4ee51629a696d7bfe803662f2a7252a3b16fc75f3a8b50 - 14bcc0f55644df1a50ae9830e1f1751a7b3f633fb8605ee50e685a3db0c705ed - 2cb7d497f3ce33ce8a2c50ad26ec93a8c45f57268d4d96953cd0f25566f753fd - e26e452e91d4542da3ebbf404f024d3e1cbf103f4cd110c26bf0a19621cca9ed - ad41e0b527a65ade95c1ba690a5434cefaab4a2daa1be307caaa1e8541fe6d5c - 85a8cd0a62413eaa0457d8d02f8edac38c4dc0c96c00b09dc550260c23268434 - 9ed2a5b28853f7f58be9d04836ff43d6e4132df5a2c058b690dc3e9d75bd1cf5 - 7dcb75ca4f6aae2c677d128460c48a57398c8b6791b77b74bea7cf9e04e7c3f1 - 6ab8e8cd148a7d5103067e05c36e36ef36e27634fc8e73b5712853c9affe75b1 - eb1b7022a247332114985ed155a8fb632c28ce7c35a476e2c0caf865150f167d" +distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-project-${version}.src.tar.xz" +checksum="9ed1688943a4402d7c904cc4515798cdb20080066efa010fe7e1f2551b423628" lib32disabled=yes python_version=3 @@ -69,6 +51,8 @@ case "$XBPS_TARGET_MACHINE" in ppc*) configure_args+=" -DCLANG_ENABLE_CLANGD=OFF" ;; esac +_enabled_projects="clang;clang-tools-extra;compiler-rt;libcxx;libcxxabi;libunwind;lld" + _lldb_enable=yes _libomp_enable=no @@ -85,6 +69,7 @@ subpackages="clang-tools-extra" # must go before clang if [ "$_libomp_enable" = "yes" ]; then + _enabled_projects+=";openmp" subpackages+=" libomp libomp-devel" # because of cmake nonsense referencing libomptarget.so.* depends+=" libomp>=${version}_${revision}" @@ -96,157 +81,62 @@ subpackages+=" clang clang-analyzer libclang libclang-cpp if [ "$_lldb_enable" = "yes" ]; then # XXX fails to cross compile due to python + _enabled_projects+=";lldb" subpackages+=" lldb lldb-devel" fi subpackages+=" lld lld-devel" +configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}" + post_patch() { - # patches - cd ${XBPS_BUILDDIR}/llvm-${version}.src - for i in ${FILESDIR}/patches/llvm/llvm-*.patch; do - msg_normal "Applying $i to llvm\n" - patch -sNp1 -i ${i} - done - - cd ${XBPS_BUILDDIR}/clang-${version}.src - for i in ${FILESDIR}/patches/clang/clang-*.patch; do - msg_normal "Applying $i to clang\n" - patch -sNp1 -i ${i} - done - - cd ${XBPS_BUILDDIR}/compiler-rt-${version}.src - for i in ${FILESDIR}/patches/compiler-rt/compiler-rt-*.patch; do - msg_normal "Applying $i to compiler-rt\n" - patch -sNp1 -i ${i} - done - - cd ${XBPS_BUILDDIR}/libunwind-${version}.src - for i in ${FILESDIR}/patches/libunwind/libunwind-*.patch; do - msg_normal "Applying $i to libunwind\n" - patch -sNp1 -i ${i} - done - - cd ${XBPS_BUILDDIR}/libcxx-${version}.src - for i in ${FILESDIR}/patches/libcxx/libcxx-*.patch; do - msg_normal "Applying $i to libcxx\n" - patch -sNp1 -i ${i} - done - if [ "$_lldb_enable" = "yes" ]; then - cd ${XBPS_BUILDDIR}/lldb-${version}.src - for i in ${FILESDIR}/patches/lldb/*.patch; do - msg_normal "Applying $i to lldb\n" - patch -sNp1 -i ${i} - done if [ "$XBPS_TARGET_LIBC" = "musl" ]; then vsed -i 's|__ptrace_request|int|g' \ - source/Plugins/Process/Linux/NativeProcessLinux.cpp + ${wrksrc}/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp fi + # disable docs for lldb as they fail to generate + vsed -i '/add_subdirectory(docs)/d' \ + ${wrksrc}/lldb/CMakeLists.txt fi - # Move clang files into the llvm source. - if [ -d ${XBPS_BUILDDIR}/clang-${version}.src ]; then - mv ${XBPS_BUILDDIR}/clang-${version}.src ${wrksrc}/tools/clang - fi - # Move clang-tools-extra files into llvm source. - if [ -d ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src ]; then - mv ${XBPS_BUILDDIR}/clang-tools-extra-${version}.src \ - ${wrksrc}/tools/clang/tools/extra - fi - # Move lld files into the llvm source. - if [ -d ${XBPS_BUILDDIR}/lld-${version}.src ]; then - mv ${XBPS_BUILDDIR}/lld-${version}.src ${wrksrc}/tools/lld - # https://bugs.llvm.org/show_bug.cgi?id=49228 - mkdir -p ${wrksrc}/tools/lld/include/mach-o - cp ${XBPS_BUILDDIR}/libunwind-${version}.src/include/mach-o/compact_unwind_encoding.h \ - ${wrksrc}/tools/lld/include/mach-o - fi - # Move lldb files into the llvm source. - if [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then - if [ "$_lldb_enable" = "yes" ]; then - mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb - # disable docs for lldb as they fail to generate - vsed -i '/add_subdirectory(docs)/d' \ - ${wrksrc}/tools/lldb/CMakeLists.txt - else - rm -rf ${XBPS_BUILDDIR}/lldb-${version}.src - fi - fi - # Move compiler-rt files into the llvm source. - if [ -d ${XBPS_BUILDDIR}/compiler-rt-${version}.src ]; then - mv ${XBPS_BUILDDIR}/compiler-rt-${version}.src \ - ${wrksrc}/projects/compiler-rt - fi - # Move libunwind files into the llvm source. - if [ -d ${XBPS_BUILDDIR}/libunwind-${version}.src ]; then - mv ${XBPS_BUILDDIR}/libunwind-${version}.src \ - ${wrksrc}/projects/libunwind - fi - # Move libcxx files into the llvm source. - if [ -d ${XBPS_BUILDDIR}/libcxx-${version}.src ]; then - mv ${XBPS_BUILDDIR}/libcxx-${version}.src \ - ${wrksrc}/projects/libcxx - fi - # Move libcxxabi files into the llvm source. - if [ -d ${XBPS_BUILDDIR}/libcxxabi-${version}.src ]; then - mv ${XBPS_BUILDDIR}/libcxxabi-${version}.src \ - ${wrksrc}/projects/libcxxabi - fi - # Move openmp files into the llvm source. - if [ -d ${XBPS_BUILDDIR}/openmp-${version}.src ]; then - if [ "$_libomp_enable" = "yes" ]; then - mv ${XBPS_BUILDDIR}/openmp-${version}.src \ - ${wrksrc}/projects/openmp - else - rm -rf ${XBPS_BUILDDIR}/openmp-${version}.src - fi - fi - - # fix early build failure - vsed -e "/set(model_compiler/s:\${CMAKE_SOURCE_DIR}/\.\./clang-tools-extra/:\${CMAKE_SOURCE_DIR}/tools/clang/tools/extra/:" \ - -i ${wrksrc}/tools/clang/tools/extra/clangd/quality/CompletionModel.cmake - # update config.guess for better platform detection cp $XBPS_COMMONDIR/environment/configure/automake/config.guess \ - ${wrksrc}/cmake + ${wrksrc}/llvm/cmake # fix linker failures on some archs - case "$XBPS_TARGET_MACHINE" in - ppc64*) ;; - aarch64*|ppc*|i686*) - vsed -i 's,check_library_exists(gcc_s .*,set(LIBCXXABI_HAS_GCC_S_LIB ON),' \ - ${wrksrc}/projects/libcxxabi/cmake/config-ix.cmake - vsed -i 's,check_library_exists(gcc .*,set(LIBCXXABI_HAS_GCC_LIB ON),' \ - ${wrksrc}/projects/libcxxabi/cmake/config-ix.cmake - ;; - esac + vsed -i 's,check_library_exists(gcc_s .*,set(LIBCXXABI_HAS_GCC_S_LIB ON),' \ + ${wrksrc}/libcxxabi/cmake/config-ix.cmake + vsed -i 's,check_library_exists(gcc .*,set(LIBCXXABI_HAS_GCC_LIB ON),' \ + ${wrksrc}/libcxxabi/cmake/config-ix.cmake # need libssp_nonshared on some musl platforms (because of nodefaultlibs) case "$XBPS_TARGET_MACHINE" in ppc64*) ;; ppc*-musl|i686-musl|mips*-musl) vsed -i 's,^# Setup flags.$,add_library_flags(ssp_nonshared),' \ - ${wrksrc}/projects/libunwind/src/CMakeLists.txt + ${wrksrc}/libunwind/src/CMakeLists.txt vsed -i 's,^# Setup flags.$,add_library_flags(ssp_nonshared),' \ - ${wrksrc}/projects/libcxxabi/src/CMakeLists.txt - vsed -i 's,#ssp,,' ${wrksrc}/projects/libcxx/CMakeLists.txt + ${wrksrc}/libcxxabi/src/CMakeLists.txt + vsed -i 's,#ssp,,' ${wrksrc}/libcxx/CMakeLists.txt ;; esac case "$XBPS_TARGET_MACHINE" in x86_64-musl) # some sanitizer currently only on x86_64 stuff needs backtrace vsed -i 's,# Set common link flags.,list(APPEND SANITIZER_COMMON_LINK_LIBS execinfo),' \ - ${wrksrc}/projects/compiler-rt/CMakeLists.txt + ${wrksrc}/compiler-rt/CMakeLists.txt ;; arm*-musl) # sanitizer code is broken on arm*-musl since it duplicates some libc bits vsed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' \ - ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake + ${wrksrc}/compiler-rt/cmake/config-ix.cmake ;; esac } pre_configure() { + local triplet + # Vastly reduce size of debugging symbols: CFLAGS=${CFLAGS/ -g/ -g1} CXXFLAGS=${CXXFLAGS/ -g/ -g1} @@ -285,9 +175,12 @@ pre_configure() { mips*) _arch="Mips";; ppc*) _arch="PowerPC";; esac + + triplet=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET} + configure_args+=" -DLLVM_TARGET_ARCH=${_arch}" - configure_args+=" -DLLVM_HOST_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}" - configure_args+=" -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}" + configure_args+=" -DLLVM_HOST_TRIPLE=${triplet}" + configure_args+=" -DLLVM_DEFAULT_TARGET_TRIPLE=${triplet}" } do_install() { @@ -309,13 +202,15 @@ do_install() { fi # Install libcxxabi headers - vinstall ${wrksrc}/projects/libcxxabi/include/__cxxabi_config.h 644 usr/include - vinstall ${wrksrc}/projects/libcxxabi/include/cxxabi.h 644 usr/include + vinstall ${wrksrc}/libcxxabi/include/__cxxabi_config.h 644 usr/include + vinstall ${wrksrc}/libcxxabi/include/cxxabi.h 644 usr/include # Install libunwind headers - vinstall ${wrksrc}/projects/libunwind/include/__libunwind_config.h 644 usr/include - vinstall ${wrksrc}/projects/libunwind/include/libunwind.h 644 usr/include - vinstall ${wrksrc}/projects/libunwind/include/unwind.h 644 usr/include + vinstall ${wrksrc}/libunwind/include/__libunwind_config.h 644 usr/include + vinstall ${wrksrc}/libunwind/include/libunwind.h 644 usr/include + vinstall ${wrksrc}/libunwind/include/unwind.h 644 usr/include + vinstall ${wrksrc}/libunwind/include/mach-o/compact_unwind_encoding.h \ + 644 usr/include/mach-o } clang-analyzer_package() {