diff --git a/common/shlibs b/common/shlibs index fa8af66f92..8342e11709 100644 --- a/common/shlibs +++ b/common/shlibs @@ -1026,9 +1026,10 @@ libuchardet.so.0 uchardet-0.0.6_1 libgtksourceviewmm-3.0.so.0 gtksourceviewmm-3.2.0_1 libyajl.so.2 yajl-2.0.1_1 libconfuse.so.2 confuse-3.2.1_1 -liblldb.so.9 lldb-9.0.0_1 -libclang.so.9 clang-9.0.0_1 -libclang-cpp.so.9 clang-9.0.0_1 +liblldb.so.10 lldb-10.0.0_1 +libclang.so.10 clang-10.0.0_1 +libclang-cpp.so.10 clang-10.0.0_1 +libLLVM-10.so libllvm10-10.0.0_1 libLLVM-9.so libllvm9-9.0.0_1 libisofs.so.6 libisofs-0.6.24_1 libmpack.so.0 libmpack-1.0.5_1 diff --git a/srcpkgs/clang b/srcpkgs/clang index 14540d7bad..59f26575cb 120000 --- a/srcpkgs/clang +++ b/srcpkgs/clang @@ -1 +1 @@ -llvm9 \ No newline at end of file +llvm10 \ No newline at end of file diff --git a/srcpkgs/clang-analyzer b/srcpkgs/clang-analyzer index 14540d7bad..59f26575cb 120000 --- a/srcpkgs/clang-analyzer +++ b/srcpkgs/clang-analyzer @@ -1 +1 @@ -llvm9 \ No newline at end of file +llvm10 \ No newline at end of file diff --git a/srcpkgs/clang-tools-extra b/srcpkgs/clang-tools-extra index 14540d7bad..59f26575cb 120000 --- a/srcpkgs/clang-tools-extra +++ b/srcpkgs/clang-tools-extra @@ -1 +1 @@ -llvm9 \ No newline at end of file +llvm10 \ No newline at end of file diff --git a/srcpkgs/libllvm10 b/srcpkgs/libllvm10 new file mode 120000 index 0000000000..59f26575cb --- /dev/null +++ b/srcpkgs/libllvm10 @@ -0,0 +1 @@ +llvm10 \ No newline at end of file diff --git a/srcpkgs/lld b/srcpkgs/lld index 14540d7bad..59f26575cb 120000 --- a/srcpkgs/lld +++ b/srcpkgs/lld @@ -1 +1 @@ -llvm9 \ No newline at end of file +llvm10 \ No newline at end of file diff --git a/srcpkgs/lld-devel b/srcpkgs/lld-devel index 14540d7bad..59f26575cb 120000 --- a/srcpkgs/lld-devel +++ b/srcpkgs/lld-devel @@ -1 +1 @@ -llvm9 \ No newline at end of file +llvm10 \ No newline at end of file diff --git a/srcpkgs/lldb b/srcpkgs/lldb index 14540d7bad..59f26575cb 120000 --- a/srcpkgs/lldb +++ b/srcpkgs/lldb @@ -1 +1 @@ -llvm9 \ No newline at end of file +llvm10 \ No newline at end of file diff --git a/srcpkgs/lldb-devel b/srcpkgs/lldb-devel index 14540d7bad..59f26575cb 120000 --- a/srcpkgs/lldb-devel +++ b/srcpkgs/lldb-devel @@ -1 +1 @@ -llvm9 \ No newline at end of file +llvm10 \ No newline at end of file diff --git a/srcpkgs/llvm10/files/llvm-Config-config.h b/srcpkgs/llvm10/files/llvm-Config-config.h new file mode 100644 index 0000000000..c369b4551f --- /dev/null +++ b/srcpkgs/llvm10/files/llvm-Config-config.h @@ -0,0 +1,9 @@ +#include + +#if __WORDSIZE == 32 +#include "config-32.h" +#elif __WORDSIZE == 64 +#include "config-64.h" +#else +#error "Unknown word size" +#endif diff --git a/srcpkgs/llvm10/files/llvm-Config-llvm-config.h b/srcpkgs/llvm10/files/llvm-Config-llvm-config.h new file mode 100644 index 0000000000..2fa08c9be6 --- /dev/null +++ b/srcpkgs/llvm10/files/llvm-Config-llvm-config.h @@ -0,0 +1,9 @@ +#include + +#if __WORDSIZE == 32 +#include "llvm-config-32.h" +#elif __WORDSIZE == 64 +#include "llvm-config-64.h" +#else +#error "Unknown word size" +#endif diff --git a/srcpkgs/llvm9/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch b/srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch similarity index 100% rename from srcpkgs/llvm9/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch rename to srcpkgs/llvm10/files/patches/clang/clang-001-fix-unwind-chain-inclusion.patch diff --git a/srcpkgs/llvm9/files/patches/clang/clang-002-add-musl-triples.patch b/srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch similarity index 100% rename from srcpkgs/llvm9/files/patches/clang/clang-002-add-musl-triples.patch rename to srcpkgs/llvm10/files/patches/clang/clang-002-add-musl-triples.patch diff --git a/srcpkgs/llvm9/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch b/srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch similarity index 100% rename from srcpkgs/llvm9/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch rename to srcpkgs/llvm10/files/patches/clang/clang-003-ppc64-dynamic-linker-path.patch diff --git a/srcpkgs/llvm9/files/patches/clang/clang-004-ppc64-musl-elfv2.patch b/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch similarity index 63% rename from srcpkgs/llvm9/files/patches/clang/clang-004-ppc64-musl-elfv2.patch rename to srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch index 14dfc007ed..f1af1b79b5 100644 --- a/srcpkgs/llvm9/files/patches/clang/clang-004-ppc64-musl-elfv2.patch +++ b/srcpkgs/llvm10/files/patches/clang/clang-004-ppc64-musl-elfv2.patch @@ -1,26 +1,29 @@ --- a/lib/Basic/Targets/PPC.h +++ b/lib/Basic/Targets/PPC.h -@@ -376,11 +376,11 @@ public: +@@ -386,11 +386,10 @@ public: if ((Triple.getArch() == llvm::Triple::ppc64le)) { resetDataLayout("e-m:e-i64:64-n32:64"); - ABI = "elfv2"; } else { resetDataLayout("E-m:e-i64:64-n32:64"); -- ABI = Triple.getEnvironment() == llvm::Triple::ELFv2 ? "elfv2" : "elfv1"; +- ABI = "elfv1"; } -+ /* default to elfv2 always, ignore llvm's elfv2 triples */ + ABI = "elfv2"; if (Triple.getOS() == llvm::Triple::AIX) SuitableAlign = 64; --- a/lib/Driver/ToolChains/Clang.cpp +++ b/lib/Driver/ToolChains/Clang.cpp -@@ -1804,7 +1804,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args, +@@ -1918,11 +1918,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args, + ABIName = "elfv1-qpx"; break; } - -- ABIName = "elfv1"; +- +- if (T.isMusl() || (T.isOSFreeBSD() && T.getOSMajorVersion() >= 13)) +- ABIName = "elfv2"; +- else +- ABIName = "elfv1"; + ABIName = "elfv2"; break; } diff --git a/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch b/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch new file mode 100644 index 0000000000..893dd244c5 --- /dev/null +++ b/srcpkgs/llvm10/files/patches/compiler-rt/compiler-rt-armv5.patch @@ -0,0 +1,11 @@ +--- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt ++++ compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt +@@ -428,8 +428,6 @@ + ) + set(arm_Thumb1_SOURCES + ${arm_Thumb1_JT_SOURCES} +- ${arm_Thumb1_SjLj_EH_SOURCES} +- ${arm_Thumb1_VFPv2_SOURCES} + ${arm_Thumb1_icache_SOURCES} + ) + diff --git a/srcpkgs/llvm9/files/patches/lldb/musl.patch b/srcpkgs/llvm10/files/patches/lldb/musl.patch similarity index 100% rename from srcpkgs/llvm9/files/patches/lldb/musl.patch rename to srcpkgs/llvm10/files/patches/lldb/musl.patch diff --git a/srcpkgs/llvm10/files/patches/llvm/llvm-001-musl.patch b/srcpkgs/llvm10/files/patches/llvm/llvm-001-musl.patch new file mode 100644 index 0000000000..a0eddbf58b --- /dev/null +++ b/srcpkgs/llvm10/files/patches/llvm/llvm-001-musl.patch @@ -0,0 +1,58 @@ +From faca3fbd15d0c3108493c3c54cd93138e049ac43 Mon Sep 17 00:00:00 2001 +From: Andrea Brancaleoni +Date: Tue, 8 Sep 2015 22:03:02 +0200 +Subject: [PATCH 3/3] musl + +--- + 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 e0a1ee3..465b65a 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 class ArrayRef; + +diff --git a/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc +index 5780764..1d548c1 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 // NOLINT ++# include // NOLINT + # include // NOLINT + # include // NOLINT + # include // NOLINT +-- +2.5.1 + +--- 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/srcpkgs/llvm10/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch b/srcpkgs/llvm10/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch new file mode 100644 index 0000000000..1ff8aaa239 --- /dev/null +++ b/srcpkgs/llvm10/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch @@ -0,0 +1,26 @@ +This patches LLVM to use ELFv2 on ppc64 uncoditionally unless overridden. We +need this because unlike most distros we use ELFv2 for both glibc and musl +on big endian ppc64. + +--- a/lib/Target/PowerPC/PPCTargetMachine.cpp ++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp +@@ -213,9 +213,8 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT, + + switch (TT.getArch()) { + case Triple::ppc64le: +- return PPCTargetMachine::PPC_ABI_ELFv2; + case Triple::ppc64: +- return PPCTargetMachine::PPC_ABI_ELFv1; ++ return PPCTargetMachine::PPC_ABI_ELFv2; + default: + return PPCTargetMachine::PPC_ABI_UNKNOWN; + } +--- a/test/CodeGen/PowerPC/ppc64-elf-abi.ll ++++ b/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 ++; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-musl < %s | FileCheck %s -check-prefix=CHECK-ELFv2 + ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv1 < %s | FileCheck %s -check-prefix=CHECK-ELFv1 + ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv2 < %s | FileCheck %s -check-prefix=CHECK-ELFv2 + ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2 diff --git a/srcpkgs/llvm10/files/patches/llvm/llvm-003-secureplt.patch b/srcpkgs/llvm10/files/patches/llvm/llvm-003-secureplt.patch new file mode 100644 index 0000000000..fcbaba8633 --- /dev/null +++ b/srcpkgs/llvm10/files/patches/llvm/llvm-003-secureplt.patch @@ -0,0 +1,11 @@ +--- llvm/lib/Target/PowerPC/PPCSubtarget.cpp ++++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp +@@ -150,7 +150,7 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) { + + if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) || + TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() || +- TargetTriple.isMusl()) ++ isTargetLinux()) + SecurePlt = true; + + if (HasSPE && IsPPC64) diff --git a/srcpkgs/llvm10/files/patches/llvm/llvm-004-override-opt.patch b/srcpkgs/llvm10/files/patches/llvm/llvm-004-override-opt.patch new file mode 100644 index 0000000000..30d1e14e19 --- /dev/null +++ b/srcpkgs/llvm10/files/patches/llvm/llvm-004-override-opt.patch @@ -0,0 +1,18 @@ +This allows us to override the optimization level as not all platforms can +deal with -O3. + +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -893,6 +893,12 @@ if( MINGW AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" ) + llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "-O2") + endif() + ++set(VOID_CXX_OPT_FLAGS "" CACHE STRING "Optimization level to use") ++ ++if(NOT VOID_CXX_OPT_FLAGS STREQUAL "") ++ llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "${VOID_CXX_OPT_FLAGS}") ++endif() ++ + # Put this before tblgen. Else we have a circular dependence. + add_subdirectory(lib/Demangle) + add_subdirectory(lib/Support) diff --git a/srcpkgs/llvm10/files/patches/llvm/llvm-005-ppc-bigpic.patch b/srcpkgs/llvm10/files/patches/llvm/llvm-005-ppc-bigpic.patch new file mode 100644 index 0000000000..4e0045d97d --- /dev/null +++ b/srcpkgs/llvm10/files/patches/llvm/llvm-005-ppc-bigpic.patch @@ -0,0 +1,38 @@ +From f3dbdd49c06bfafc1d6138094cf42889c14d38b6 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sun, 3 Nov 2019 10:57:27 -0600 +Subject: [PATCH] [LLVM][PowerPC] Assume BigPIC if no PIC level is specified + +--- + llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp | 2 +- + llvm/lib/Target/PowerPC/PPCMCInstLower.cpp | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp +index 269b84b4e8d..03246a5242c 100644 +--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp ++++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp +@@ -488,7 +488,7 @@ void PPCAsmPrinter::EmitTlsCall(const MachineInstr *MI, + + // Add 32768 offset to the symbol so we follow up the latest GOT/PLT ABI. + if (Kind == MCSymbolRefExpr::VK_PLT && Subtarget->isSecurePlt() && +- M->getPICLevel() == PICLevel::BigPIC) ++ M->getPICLevel() != PICLevel::SmallPIC) + TlsRef = MCBinaryExpr::createAdd( + TlsRef, MCConstantExpr::create(32768, OutContext), OutContext); + const MachineOperand &MO = MI->getOperand(2); +diff --git a/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp b/llvm/lib/Target/PowerPC/PPCMCInstLower.cpp +index 027e6bd1ba0..ae461f4eea9 100644 +--- llvm/lib/Target/PowerPC/PPCMCInstLower.cpp ++++ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp +@@ -116,7 +116,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. + if (Subtarget->isSecurePlt() && TM.isPositionIndependent() && +- M->getPICLevel() == PICLevel::BigPIC && ++ M->getPICLevel() != PICLevel::SmallPIC && + MO.getTargetFlags() == PPCII::MO_PLT) + Expr = + MCBinaryExpr::createAdd(Expr, MCConstantExpr::create(32768, Ctx), Ctx); +-- +2.23.0 diff --git a/srcpkgs/llvm10/files/patches/llvm/llvm-006-aarch64-mf_exec.patch b/srcpkgs/llvm10/files/patches/llvm/llvm-006-aarch64-mf_exec.patch new file mode 100644 index 0000000000..a64a317ee6 --- /dev/null +++ b/srcpkgs/llvm10/files/patches/llvm/llvm-006-aarch64-mf_exec.patch @@ -0,0 +1,25 @@ +Fix failures in AllocationTests/MappedMemoryTest.* on aarch64: + + Failing Tests (8): + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.AllocAndRelease/3 + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.DuplicateNear/3 + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.EnabledWrite/3 + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.MultipleAllocAndRelease/3 + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.SuccessiveNear/3 + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.UnalignedNear/3 + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroNear/3 + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroSizeNear/3 + +Upstream-Issue: https://bugs.llvm.org/show_bug.cgi?id=14278#c10 + +--- a/lib/Support/Unix/Memory.inc ++++ b/lib/Support/Unix/Memory.inc +@@ -59,7 +59,7 @@ + return PROT_READ | PROT_WRITE | PROT_EXEC; + case llvm::sys::Memory::MF_EXEC: + #if (defined(__FreeBSD__) || defined(__POWERPC__) || defined (__ppc__) || \ +- defined(_POWER) || defined(_ARCH_PPC)) ++ defined(_POWER) || defined(_ARCH_PPC) || (defined(__linux__) && defined(__aarch64__))) + // On PowerPC, having an executable page that has no read permission + // can have unintended consequences. The function InvalidateInstruction- + // Cache uses instructions dcbf and icbi, both of which are treated by diff --git a/srcpkgs/llvm10/template b/srcpkgs/llvm10/template new file mode 100644 index 0000000000..8fe09a332b --- /dev/null +++ b/srcpkgs/llvm10/template @@ -0,0 +1,287 @@ +# Template file for 'llvm10' +pkgname=llvm10 +version=10.0.0 +revision=1 +wrksrc="llvm-${version}.src" +build_style=cmake +configure_args=" + -DCMAKE_BUILD_TYPE=Release + -DLLVM_INSTALL_UTILS=ON + -DLLVM_BUILD_LLVM_DYLIB=ON + -DLLVM_LINK_LLVM_DYLIB=ON + -DLLVM_ENABLE_RTTI=ON + -DLLVM_ENABLE_FFI=ON + -DLLVM_BINUTILS_INCDIR=/usr/include" +hostmakedepends="groff perl python3 zlib-devel libffi-devel swig" +makedepends="python3-devel zlib-devel libffi-devel libedit-devel + libxml2-devel binutils-devel libatomic-devel" +depends="libllvm10" +short_desc="Low Level Virtual Machine" +maintainer="q66 " +license="NCSA" +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" +checksum=" + df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf + dd1ffcb42ed033f5167089ec4c6ebe84fbca1db4a9eaebf5c614af09d89eb135 + b9a0d7c576eeef05bc06d6e954938a01c5396cee1d1e985891e0b1cf16e3d708 + 885b062b00e903df72631c5f98b9579ed1ed2790f74e5646b4234fa084eacb21 + acdf8cf6574b40e6b1dabc93e76debb84a9feb6f22970126b04d4ba18b92911c + 6a7da64d3a0a7320577b68b9ca4933bdcab676e898b759850e827333c3282c75" +lib32disabled=yes +python_version=3 + +_lldb_enable=yes + +if [ "$CROSS_BUILD" ]; then + _lldb_enable=no +fi + +case "$XBPS_TARGET_MACHINE" in + ppc64le*) ;; + ppc*) _lldb_enable=no ;; +esac + +subpackages="clang-tools-extra clang clang-analyzer libllvm10" +if [ "$_lldb_enable" = "yes" ]; then + # XXX fails to cross compile due to python + subpackages+=" lldb lldb-devel" +fi +subpackages+=" lld lld-devel" + +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 + + case "$XBPS_TARGET_MACHINE" in + armv5*) + 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 + ;; + esac + + 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 + case "$XBPS_TARGET_MACHINE" in + *-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;; + esac + 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 + fi + # Move lldb files into the llvm source. + if [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then + mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb + 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 + case "$XBPS_TARGET_MACHINE" in + *-musl) + # Disable sanitizers + sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake + ;; + esac + +} + +pre_configure() { + # Vastly reduce size of debugging symbols: + CFLAGS=${CFLAGS/ -g/ -g1} + CXXFLAGS=${CXXFLAGS/ -g/ -g1} + + # since gcc9, the build likes to blow up for ppc32 apparently because + # of clang being too large for a 24-bit relative call to the PLT, so + # optimize for size instead + case "$XBPS_TARGET_MACHINE" in + ppc|ppc-musl) configure_args+=" -DVOID_CXX_OPT_FLAGS=-Os" ;; + esac + + if [ "$CROSS_BUILD" ]; then + msg_normal "Building host tblgen\n" + mkdir -p build/HOST + cd build/HOST + CC="$BUILD_CC" CXX="$BUILD_CXX" CFLAGS="$BUILD_CFLAGS" \ + CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \ + cmake ../.. -DCMAKE_BUILD_TYPE=Release + make ${makejobs} -C utils/TableGen + make ${makejobs} -C tools/clang/utils/TableGen + configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen" + configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen" + cd ../.. + fi + + case "$XBPS_TARGET_MACHINE" in + i686*) _arch="X86";; + x86_64*) _arch="X86";; + armv5*) _arch="Armv5te";; + armv6*) _arch="Armv6";; + armv7*) _arch="Armv7";; + aarch64*) _arch="AArch64";; + mips*) _arch="Mips";; + ppc*) _arch="PowerPC";; + esac + configure_args+=" -DLLVM_TARGET_ARCH=${_arch}" + configure_args+=" -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}" +} + +do_install() { + vlicense LICENSE.TXT + + cd build + cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake + + # Fix permissions of static libs + chmod -x ${DESTDIR}/usr/lib/*.a + + # Required for multilib. + if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then + for _header in llvm-config; do + mv ${DESTDIR}/usr/include/llvm/Config/${_header}{,-64}.h + vinstall ${FILESDIR}/llvm-Config-${_header}.h 644 \ + usr/include/llvm/Config ${_header}.h + done + fi + + # Remove llvm-config-host in cross builds. + if [ "$CROSS_BUILD" ]; then + rm -f ${DESTDIR}/usr/bin/llvm-config-host + fi +} + +clang-analyzer_package() { + archs=noarch + pycompile_dirs="usr/share/scan-view" + depends="clang-${version}_${revision} python3" + short_desc+=" - A source code analysis framework" + homepage="https://clang-analyzer.llvm.org/" + pkg_install() { + vmove usr/share/man/man1/scan-build.1 + vmove "/usr/bin/scan-*" + vmove "/usr/share/scan-*" + vmove "/usr/libexec/*analyzer" + } +} + +clang-tools-extra_package() { + depends="clang-${version}_${revision} python3" + short_desc+=" - Extra Clang tools" + homepage="https://clang.llvm.org/extra/" + pkg_install() { + vmove usr/bin/clang-apply-replacements + vmove usr/bin/clang-query + vmove usr/bin/clang-rename + vmove usr/bin/clang-tidy + vmove usr/bin/modularize + vmove "usr/lib/libclangApplyReplacements*" + vmove "usr/lib/libclangQuery*" + vmove "usr/lib/libclangTidy*" + vmove "usr/share/clang/*tidy*" + } +} + +clang_package() { + lib32disabled=yes + depends="libstdc++-devel libgcc-devel binutils" + case "$XBPS_TARGET_MACHINE" in + *-musl) depends+=" musl-devel";; + *) depends+=" glibc-devel";; + esac + short_desc+=" - C language family frontend" + homepage="https://clang.llvm.org/" + pkg_install() { + vmove usr/include/clang + vmove usr/include/clang-c + vmove "usr/bin/*clang*" + vmove usr/bin/c-index-test + vmove usr/lib/clang + vmove usr/lib/cmake/clang + vmove "usr/lib/libclang*" + vmove "usr/share/clang" + } +} + +lld_package() { + lib32disabled=yes + short_desc+=" - linker" + homepage="https://lld.llvm.org" + pkg_install() { + vmove usr/bin/lld* + vmove usr/bin/wasm-ld + vmove usr/bin/ld.lld* + } +} + +lld-devel_package() { + lib32disabled=yes + short_desc+=" - linker - development files" + homepage="https://lld.llvm.org" + pkg_install() { + vmove usr/include/lld + vmove "usr/lib/liblld*a" + } +} + +lldb_package() { + lib32disabled=yes + depends+=" python3-six" + short_desc+=" - LLDB debugger" + homepage="https://lldb.llvm.org/" + pkg_install() { + vmove usr/bin/*lldb* + vmove usr/lib/liblldb*so.* + vmove /usr/lib/python* + # Depend on python3-six instead of conflicting + rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py + } +} + +lldb-devel_package() { + depends="lldb>=${version}_${revision}" + short_desc+=" - LLDB debugger - development files" + pkg_install() { + vmove usr/include/lldb + vmove "usr/lib/liblldb*.so" + } +} + +libllvm10_package() { + short_desc+=" - runtime library" + pkg_install() { + vmove "usr/lib/libLLVM-*.so*" + } +} diff --git a/srcpkgs/llvm10/update b/srcpkgs/llvm10/update new file mode 100644 index 0000000000..3d09eaff37 --- /dev/null +++ b/srcpkgs/llvm10/update @@ -0,0 +1,2 @@ +site=https://releases.llvm.org/ +pattern="'\K[\d\.]*(?=')" diff --git a/srcpkgs/llvm9/files/patches/compiler-rt/compiler-rt-armv5.patch b/srcpkgs/llvm9/files/patches/compiler-rt/compiler-rt-armv5.patch deleted file mode 100644 index f4d2e341b6..0000000000 --- a/srcpkgs/llvm9/files/patches/compiler-rt/compiler-rt-armv5.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- compiler-rt-9.0.1.src/lib/builtins/CMakeLists.txt 2019-12-11 20:15:30.000000000 +0100 -+++ compiler-rt-9.0.1.src/lib/builtins/CMakeLists.txt 2020-03-29 07:23:38.172813038 +0200 -@@ -419,8 +419,6 @@ - ) - set(arm_Thumb1_SOURCES - ${arm_Thumb1_JT_SOURCES} -- ${arm_Thumb1_SjLj_EH_SOURCES} -- ${arm_Thumb1_VFPv2_SOURCES} - ${arm_Thumb1_icache_SOURCES} - ) - diff --git a/srcpkgs/llvm9/files/patches/llvm/llvm-007-aarch64-mf_exec.patch b/srcpkgs/llvm9/files/patches/llvm/llvm-007-aarch64-mf_exec.patch new file mode 100644 index 0000000000..a64a317ee6 --- /dev/null +++ b/srcpkgs/llvm9/files/patches/llvm/llvm-007-aarch64-mf_exec.patch @@ -0,0 +1,25 @@ +Fix failures in AllocationTests/MappedMemoryTest.* on aarch64: + + Failing Tests (8): + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.AllocAndRelease/3 + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.DuplicateNear/3 + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.EnabledWrite/3 + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.MultipleAllocAndRelease/3 + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.SuccessiveNear/3 + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.UnalignedNear/3 + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroNear/3 + LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroSizeNear/3 + +Upstream-Issue: https://bugs.llvm.org/show_bug.cgi?id=14278#c10 + +--- a/lib/Support/Unix/Memory.inc ++++ b/lib/Support/Unix/Memory.inc +@@ -59,7 +59,7 @@ + return PROT_READ | PROT_WRITE | PROT_EXEC; + case llvm::sys::Memory::MF_EXEC: + #if (defined(__FreeBSD__) || defined(__POWERPC__) || defined (__ppc__) || \ +- defined(_POWER) || defined(_ARCH_PPC)) ++ defined(_POWER) || defined(_ARCH_PPC) || (defined(__linux__) && defined(__aarch64__))) + // On PowerPC, having an executable page that has no read permission + // can have unintended consequences. The function InvalidateInstruction- + // Cache uses instructions dcbf and icbi, both of which are treated by diff --git a/srcpkgs/llvm9/template b/srcpkgs/llvm9/template index 350a9d67d1..75d9c8aed7 100644 --- a/srcpkgs/llvm9/template +++ b/srcpkgs/llvm9/template @@ -1,7 +1,7 @@ # Template file for 'llvm9' pkgname=llvm9 version=9.0.1 -revision=5 +revision=6 wrksrc="llvm-${version}.src" build_style=cmake configure_args=" @@ -20,42 +20,14 @@ short_desc="Low Level Virtual Machine" maintainer="q66 " license="NCSA" 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" -checksum=" - 00a1ee1f389f81e9979f3a640a01c431b3021de0d42278f6508391a2f0b81c9a - 8a7b9fd795c31a3e3cba6ce1377a2ae5c67376d92888702ce27e26f0971beb09 - 86262bad3e2fd784ba8c5e2158d7aa36f12b85f2515e95bc81d65d75bb9b0c82 - 5778512b2e065c204010f88777d44b95250671103e434f9dc7363ab2e3804253 - b26fd72a78bd7db998a26270ec9ec6a01346651d88fa87b4b323e13049fb6f07 - c2bfab95c9986318318363d7f371a85a95e333bc0b34fbfa52edbd3f5e3a9077" -disable_parallel_builds=yes +distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz" +checksum="00a1ee1f389f81e9979f3a640a01c431b3021de0d42278f6508391a2f0b81c9a" lib32disabled=yes -# necessary to override auto default python_version=3 -_lldb_enable=yes +conflicts="llvm10>=0" -if [ "$CROSS_BUILD" ]; then - _lldb_enable=no -fi - -case "$XBPS_TARGET_MACHINE" in - ppc64le*) ;; - ppc*) _lldb_enable=no ;; -esac - -subpackages="clang-tools-extra clang clang-analyzer libllvm9" -if [ "$_lldb_enable" = "yes" ]; then - # XXX fails to cross compile due to python - subpackages+=" lldb lldb-devel" -fi -subpackages+=" lld lld-devel" +subpackages="libllvm9" post_patch() { # patches @@ -64,61 +36,6 @@ post_patch() { 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 - - case "$XBPS_TARGET_MACHINE" in - armv5*) - 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 - ;; - esac - - 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 - case "$XBPS_TARGET_MACHINE" in - *-musl) sed -i 's|__ptrace_request|int|g' source/Plugins/Process/Linux/NativeProcessLinux.cpp ;; - esac - 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 - fi - # Move lldb files into the llvm source. - if [ "$_lldb_enable" = "yes" -a -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then - mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb - 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 - case "$XBPS_TARGET_MACHINE" in - *-musl) - # Disable sanitizers - sed -i 's/set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)/set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)/' ${wrksrc}/projects/compiler-rt/cmake/config-ix.cmake - ;; - esac - } pre_configure() { @@ -141,9 +58,7 @@ pre_configure() { CXXFLAGS="$BUILD_CXXFLAGS" LDFLAGS="$BUILD_LDFLAGS" \ cmake ../.. -DCMAKE_BUILD_TYPE=Release make ${makejobs} -C utils/TableGen - make ${makejobs} -C tools/clang/utils/TableGen configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen" - configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen" cd ../.. fi @@ -185,103 +100,6 @@ do_install() { fi } -clang-analyzer_package() { - archs=noarch - pycompile_dirs="usr/share/scan-view" - depends="clang-${version}_${revision} python3" - short_desc+=" - A source code analysis framework" - homepage="https://clang-analyzer.llvm.org/" - pkg_install() { - vmove usr/share/man/man1/scan-build.1 - vmove "/usr/bin/scan-*" - vmove "/usr/share/scan-*" - vmove "/usr/libexec/*analyzer" - } -} - -clang-tools-extra_package() { - depends="clang-${version}_${revision} python3" - short_desc+=" - Extra Clang tools" - homepage="https://clang.llvm.org/extra/" - pkg_install() { - vmove usr/bin/clang-apply-replacements - vmove usr/bin/clang-query - vmove usr/bin/clang-rename - vmove usr/bin/clang-tidy - vmove usr/bin/modularize - vmove "usr/lib/libclangApplyReplacements*" - vmove "usr/lib/libclangQuery*" - vmove "usr/lib/libclangTidy*" - vmove "usr/share/clang/*tidy*" - } -} - -clang_package() { - lib32disabled=yes - depends="libstdc++-devel libgcc-devel binutils" - case "$XBPS_TARGET_MACHINE" in - *-musl) depends+=" musl-devel";; - *) depends+=" glibc-devel";; - esac - short_desc+=" - C language family frontend" - homepage="https://clang.llvm.org/" - pkg_install() { - vmove usr/include/clang - vmove usr/include/clang-c - vmove "usr/bin/*clang*" - vmove usr/bin/c-index-test - vmove usr/lib/clang - vmove usr/lib/cmake/clang - vmove "usr/lib/libclang*" - vmove "usr/share/clang" - } -} - -lld_package() { - lib32disabled=yes - short_desc+=" - linker" - homepage="https://lld.llvm.org" - pkg_install() { - vmove usr/bin/lld* - vmove usr/bin/wasm-ld - vmove usr/bin/ld.lld* - } -} - -lld-devel_package() { - lib32disabled=yes - short_desc+=" - linker - development files" - homepage="https://lld.llvm.org" - pkg_install() { - vmove usr/include/lld - vmove "usr/lib/liblld*a" - } -} - -lldb_package() { - lib32disabled=yes - depends+=" python3-six" - short_desc+=" - LLDB debugger" - homepage="https://lldb.llvm.org/" - pkg_install() { - vmove usr/bin/*lldb* - vmove usr/lib/liblldb*so.* - vman tools/lldb/docs/lldb.1 - vmove /usr/lib/python* - # Depend on python3-six instead of conflicting - rm ${PKGDESTDIR}/usr/lib/python3*/site-packages/six.py - } -} - -lldb-devel_package() { - depends="lldb>=${version}_${revision}" - short_desc+=" - LLDB debugger - development files" - pkg_install() { - vmove usr/include/lldb - vmove "usr/lib/liblldb*.so" - } -} - libllvm9_package() { short_desc+=" - runtime library" pkg_install() {