New package: llvm12-12.0.0

Distro changes since 11.0:

- html docs are now included (except lldb where they are broken)
- manpages are now included
- enabled linker build id
- libcxx(abi), libunwind, libomp are now built as subpackages
- disabled clangd on ppc32 (crashes assembler)
- template cleanups

Cross fixes by Leah.

Closes https://github.com/void-linux/void-packages/issues/28609
Closes https://github.com/void-linux/void-packages/issues/17935
This commit is contained in:
q66 2021-05-16 01:58:09 +02:00
parent 9ccf350809
commit 39374b4272
50 changed files with 1128 additions and 306 deletions

View file

@ -984,10 +984,11 @@ 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.11 lldb-11.0.0_1
libclang.so.11 libclang-11.0.0_1
libclang-cpp.so.11 libclang-cpp-11.0.0_1
liblldb.so.12 lldb-12.0.0_1
libclang.so.12 libclang-12.0.0_1
libclang-cpp.so.12 libclang-cpp-12.0.0_1
libLLVM-11.so libllvm11-11.0.0_1
libLLVM-12.so libllvm12-12.0.0_1
libisofs.so.6 libisofs-0.6.24_1
libmpack.so.0 libmpack-1.0.5_1
libGeoIP.so.1 libgeoip-1.4.8_1

View file

@ -1 +1 @@
llvm11
llvm12

View file

@ -1 +1 @@
llvm11
llvm12

View file

@ -1 +1 @@
llvm11
llvm12

View file

@ -1 +1 @@
llvm11
llvm12

View file

@ -1 +1 @@
llvm11
llvm12

1
srcpkgs/libcxx Symbolic link
View file

@ -0,0 +1 @@
llvm12

View file

@ -1 +1 @@
libcxx
llvm12

View file

@ -1,59 +0,0 @@
# Template file for 'libcxx'
pkgname=libcxx
version=11.0.0
revision=1
wrksrc="${pkgname}-${version}.src"
build_style=cmake
configure_args+=" -DLIBCXX_CXX_ABI=libcxxabi -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON
-DLIBCXX_CXX_ABI_LIBRARY_PATH=${XBPS_CROSS_BASE}/usr/lib
-DLIBCXXABI_USE_LLVM_UNWINDER=1"
hostmakedepends="llvm11 clang-tools-extra python3"
makedepends="libcxxabi-devel llvm11 llvm-libunwind-devel"
short_desc="New implementation of the C++ standard library, targeting C++11, C++14 and above"
maintainer="Orphaned <orphan@voidlinux.org>"
license="NCSA, MIT"
homepage="https://libcxx.llvm.org"
distfiles="
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}/llvm-${version}.src.tar.xz"
checksum="
6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a
58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15
913f68c898dfb4a03b397c5e11c6a2f39d0f22ed7665c9cefa87a34423a72469"
case "$XBPS_TARGET_MACHINE" in
*-musl) configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"
esac
post_extract() {
case "$XBPS_TARGET_MACHINE" in
*-musl) patch -Np1 <${FILESDIR}/libcxx-0001-musl-hacks.patch ;;
esac
# Since llvm 11, libcxxabi and llvm need to be present next to the libcxx root
mv ../libcxxabi-${version}.src ../libcxxabi
mv ../llvm-${version}.src ../llvm
}
post_patch() {
case "$XBPS_TARGET_MACHINE" in
i686-musl|ppc-musl) ;;
*) return 0 ;;
esac
vsed -i 's,#ssp,,' CMakeLists.txt
}
post_install() {
vlicense LICENSE.TXT
}
libcxx-devel_package() {
short_desc+=" - development files"
depends="${sourcepkg}>=${version}_${revision}"
pkg_install() {
vmove usr/include
vmove "usr/lib/*.so"
vmove "usr/lib/*.a"
}
}

View file

@ -1 +0,0 @@
site="http://www.llvm.org/releases/download.html"

1
srcpkgs/libcxxabi Symbolic link
View file

@ -0,0 +1 @@
llvm12

View file

@ -1 +1 @@
libcxxabi
llvm12

View file

@ -1,54 +0,0 @@
# Template file for 'libcxxabi'
pkgname=libcxxabi
version=11.0.0
revision=1
wrksrc="${pkgname}-${version}.src"
build_style=cmake
configure_args="-DLIBCXXABI_LIBCXX_INCLUDES=../../libcxx/include
-DLIBCXXABI_USE_LLVM_UNWINDER=1
-DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
hostmakedepends="clang-tools-extra llvm11"
makedepends="llvm11 llvm-libunwind-devel"
short_desc="Low-level support for libc++ standard library"
maintainer="Orphaned <orphan@voidlinux.org>"
license="NCSA, MIT"
homepage="https://libcxxabi.llvm.org"
distfiles="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}/libcxx-${version}.src.tar.xz"
checksum="58697d4427b7a854ec7529337477eb4fba16407222390ad81a40d125673e4c15
6c1ee6690122f2711a77bc19241834a9219dda5036e1597bfa397f341a9b8b7a"
case "$XBPS_TARGET_MACHINE" in
armv[67]l)
broken="invalid operands of types 'char [8]' and 'const uint64_t' to binary 'operator&'"
;;
esac
post_extract() {
# Since llvm 11, libcxx needs to be present next to the libcxxabi root
mv ../libcxx-${version}.src ../libcxx
}
post_patch() {
case "$XBPS_TARGET_MACHINE" in
i686-musl|ppc-musl) ;;
*) return 0 ;;
esac
vsed -i 's,^# Setup flags.$,add_library_flags(ssp_nonshared),' src/CMakeLists.txt
}
post_install() {
vmkdir usr/include
vcopy include/* usr/include
vlicense LICENSE.TXT
}
libcxxabi-devel_package() {
short_desc+=" - development files"
depends="${sourcepkg}>=${version}_${revision}"
pkg_install() {
vmove usr/include
vmove "usr/lib/*.a"
vmove "usr/lib/*.so"
}
}

View file

@ -1 +0,0 @@
site="http://www.llvm.org/releases/download.html"

1
srcpkgs/libllvm12 Symbolic link
View file

@ -0,0 +1 @@
llvm12

1
srcpkgs/libomp Symbolic link
View file

@ -0,0 +1 @@
llvm12

View file

@ -1 +1 @@
libomp
llvm12

View file

@ -1,64 +0,0 @@
Remove the invalid assumption that ELFv2 == LE.
--- runtime/src/z_Linux_asm.S
+++ runtime/src/z_Linux_asm.S
@@ -1503,12 +1503,12 @@ KMP_LABEL(kmp_1):
// return: r3 (always 1/TRUE)
//
.text
-# if KMP_ARCH_PPC64_LE
+# if _CALL_ELF == 2
.abiversion 2
# endif
.globl __kmp_invoke_microtask
-# if KMP_ARCH_PPC64_LE
+# if _CALL_ELF == 2
.p2align 4
# else
.p2align 2
@@ -1516,7 +1516,7 @@ KMP_LABEL(kmp_1):
.type __kmp_invoke_microtask,@function
-# if KMP_ARCH_PPC64_LE
+# if _CALL_ELF == 2
__kmp_invoke_microtask:
.Lfunc_begin0:
.Lfunc_gep0:
@@ -1560,7 +1560,7 @@ __kmp_invoke_microtask:
.cfi_offset lr, 16
// Compute the size necessary for the local stack frame.
-# if KMP_ARCH_PPC64_LE
+# if _CALL_ELF == 2
li 12, 72
# else
li 12, 88
@@ -1638,7 +1638,7 @@ __kmp_invoke_microtask:
// for the microtask begins 48 + 8*8 == 112 bytes above r1 for ELFv1 and
// 32 + 8*8 == 96 bytes above r1 for ELFv2.
addi 4, 4, 40
-# if KMP_ARCH_PPC64_LE
+# if _CALL_ELF == 2
addi 12, 1, 88
# else
addi 12, 1, 104
@@ -1650,7 +1650,7 @@ __kmp_invoke_microtask:
bdnz .Lnext
.Lcall:
-# if KMP_ARCH_PPC64_LE
+# if _CALL_ELF == 2
std 2, 24(1)
mr 12, 3
#else
@@ -1666,7 +1666,7 @@ __kmp_invoke_microtask:
mtctr 12
bctrl
-# if KMP_ARCH_PPC64_LE
+# if _CALL_ELF == 2
ld 2, 24(1)
# else
ld 2, 40(1)

View file

@ -1,29 +0,0 @@
# Template file for 'libomp'
pkgname=libomp
version=8.0.0
revision=2
archs="x86_64* i686* armv[67]* aarch64* ppc64*"
wrksrc="openmp-${version}.src"
build_style=cmake
configure_args="-DLIBOMP_ENABLE_SHARED=ON -DLIBOMP_INSTALL_ALIASES=OFF"
hostmakedepends="perl pkg-config"
makedepends="elfutils-devel libffi-devel"
short_desc="LLVM OpenMP Runtime Library"
maintainer="Andy Weidenbaum <atweiden@tutanota.de>"
license="NCSA"
homepage="https://openmp.llvm.org"
distfiles="https://releases.llvm.org/${version}/openmp-${version}.src.tar.xz"
checksum=f7b1705d2f16c4fc23d6531f67d2dd6fb78a077dd346b02fed64f4b8df65c9d5
do_check() {
# requires lit and clang, lit is not packaged
:
}
libomp-devel_package() {
short_desc+=" - development files"
depends="${sourcepkg}-${version}_${revision}"
pkg_install() {
vmove usr/include
}
}

View file

@ -1 +1 @@
llvm11
llvm12

View file

@ -1 +1 @@
llvm11
llvm12

View file

@ -1 +1 @@
llvm11
llvm12

View file

@ -1 +1 @@
llvm11
llvm12

1
srcpkgs/llvm-libunwind Symbolic link
View file

@ -0,0 +1 @@
llvm12

View file

@ -1 +1 @@
llvm-libunwind
llvm12

View file

@ -1,15 +0,0 @@
Source: @pullmoll
Upstream: no
Reason: -1ULL is not a signed long long but the result is signed.
--- src/AddressSpace.hpp 2019-05-30 06:40:21.000000000 +0200
+++ src/AddressSpace.hpp 2020-03-04 22:55:16.140731907 +0100
@@ -288,7 +288,7 @@
} while (byte & 0x80);
// sign extend negative numbers
if ((byte & 0x40) != 0)
- result |= (-1ULL) << bit;
+ result |= (-1LL) << bit;
addr = (pint_t) p;
return result;
}

View file

@ -1,39 +0,0 @@
# Template file for 'llvm-libunwind'
pkgname=llvm-libunwind
version=11.0.0
revision=1
build_style=cmake
wrksrc="libunwind-${version}.src"
hostmakedepends="llvm11"
makedepends="llvm11"
short_desc="LLVM version of libunwind library"
maintainer="Orphaned <orphan@voidlinux.org>"
license="NCSA, MIT"
homepage="https://llvm.org"
distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/libunwind-${version}.src.tar.xz"
checksum=8455011c33b14abfe57b2fd9803fb610316b16d4c9818bec552287e2ba68922f
post_patch() {
case "$XBPS_TARGET_MACHINE" in
i686-musl|ppc-musl) ;;
*) return 0 ;;
esac
vsed -i 's,^# Setup flags.$,add_library_flags(ssp_nonshared),' src/CMakeLists.txt
}
post_install() {
vmkdir usr/include
vcopy include/* usr/include
vlicense LICENSE.TXT LICENSE
}
llvm-libunwind-devel_package() {
short_desc+=" - development files"
depends="${sourcepkg}>=${version}_${revision}"
conflicts="libunwind-devel>=0"
pkg_install() {
vmove usr/include
vmove "usr/lib/*.a"
vmove "usr/lib/*.so"
}
}

View file

@ -1,2 +0,0 @@
pkgname=libunwind
site="http://www.llvm.org/releases/download.html"

View file

@ -0,0 +1,9 @@
#include <bits/wordsize.h>
#if __WORDSIZE == 32
#include "llvm-config-32.h"
#elif __WORDSIZE == 64
#include "llvm-config-64.h"
#else
#error "Unknown word size"
#endif

View file

@ -0,0 +1,44 @@
From 352974169f0d2b5da3d5321f588f5e3b5941330e Mon Sep 17 00:00:00 2001
From: Andrea Brancaleoni <miwaxe@gmail.com>
Date: Tue, 8 Sep 2015 22:14:57 +0200
Subject: [PATCH 2/7] fix unwind chain inclusion
---
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/lib/Headers/unwind.h
+++ b/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

View file

@ -0,0 +1,110 @@
--- a/lib/Driver/ToolChains/Gnu.cpp
+++ b/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",
"armv6hl-suse-linux-gnueabi",
- "armv7hl-suse-linux-gnueabi"};
+ "armv7hl-suse-linux-gnueabi",
+ "armv7l-linux-gnueabihf"};
static const char *const ARMebLibDirs[] = {"/lib"};
static const char *const ARMebTriples[] = {"armeb-linux-gnueabi",
"armeb-linux-androideabi"};
@@ -2153,8 +2154,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
"powerpc64-suse-linux", "powerpc-montavista-linuxspe"};
static const char *const PPCLELibDirs[] = {"/lib32", "/lib"};
static const char *const PPCLETriples[] = {"powerpcle-linux-gnu",
- "powerpcle-unknown-linux-gnu",
- "powerpcle-linux-musl"};
+ "powerpcle-unknown-linux-gnu"};
static const char *const PPC64LibDirs[] = {"/lib64", "/lib"};
static const char *const PPC64Triples[] = {
@@ -2235,6 +2235,87 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
return;
}
+ if (TargetTriple.isMusl()) {
+ static const char *const AArch64MuslTriples[] = {"aarch64-linux-musl"};
+ static const char *const ARMHFMuslTriples[] = {
+ "arm-linux-musleabihf", "armv7l-linux-musleabihf"
+ };
+ static const char *const ARMMuslTriples[] = {"arm-linux-musleabi"};
+ static const char *const X86_64MuslTriples[] = {"x86_64-linux-musl"};
+ static const char *const X86MuslTriples[] = {"i686-linux-musl"};
+ static const char *const MIPSMuslTriples[] = {
+ "mips-linux-musl", "mipsel-linux-musl",
+ "mipsel-linux-muslhf", "mips-linux-muslhf"
+ };
+ static const char *const PPCMuslTriples[] = {"powerpc-linux-musl"};
+ static const char *const PPCLEMuslTriples[] = {"powerpcle-linux-musl"};
+ static const char *const PPC64MuslTriples[] = {"powerpc64-linux-musl"};
+ static const char *const PPC64LEMuslTriples[] = {"powerpc64le-linux-musl"};
+
+ switch (TargetTriple.getArch()) {
+ case llvm::Triple::aarch64:
+ LibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
+ TripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
+ BiarchLibDirs.append(begin(AArch64LibDirs), end(AArch64LibDirs));
+ BiarchTripleAliases.append(begin(AArch64MuslTriples), end(AArch64MuslTriples));
+ break;
+ case llvm::Triple::arm:
+ LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
+ if (TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
+ TripleAliases.append(begin(ARMHFMuslTriples), end(ARMHFMuslTriples));
+ } else {
+ TripleAliases.append(begin(ARMMuslTriples), end(ARMMuslTriples));
+ }
+ break;
+ case llvm::Triple::x86_64:
+ LibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
+ TripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
+ BiarchLibDirs.append(begin(X86LibDirs), end(X86LibDirs));
+ BiarchTripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
+ break;
+ case llvm::Triple::x86:
+ LibDirs.append(begin(X86LibDirs), end(X86LibDirs));
+ TripleAliases.append(begin(X86MuslTriples), end(X86MuslTriples));
+ BiarchLibDirs.append(begin(X86_64LibDirs), end(X86_64LibDirs));
+ BiarchTripleAliases.append(begin(X86_64MuslTriples), end(X86_64MuslTriples));
+ break;
+ case llvm::Triple::mips:
+ LibDirs.append(begin(MIPSLibDirs), end(MIPSLibDirs));
+ TripleAliases.append(begin(MIPSMuslTriples), end(MIPSMuslTriples));
+ break;
+ case llvm::Triple::ppc:
+ LibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
+ TripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
+ BiarchLibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
+ BiarchTripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
+ break;
+ case llvm::Triple::ppcle:
+ LibDirs.append(begin(PPCLELibDirs), end(PPCLELibDirs));
+ TripleAliases.append(begin(PPCLEMuslTriples), end(PPCLEMuslTriples));
+ BiarchLibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
+ BiarchTripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
+ break;
+ case llvm::Triple::ppc64:
+ LibDirs.append(begin(PPC64LibDirs), end(PPC64LibDirs));
+ TripleAliases.append(begin(PPC64MuslTriples), end(PPC64MuslTriples));
+ BiarchLibDirs.append(begin(PPCLibDirs), end(PPCLibDirs));
+ BiarchTripleAliases.append(begin(PPCMuslTriples), end(PPCMuslTriples));
+ break;
+ case llvm::Triple::ppc64le:
+ LibDirs.append(begin(PPC64LELibDirs), end(PPC64LELibDirs));
+ TripleAliases.append(begin(PPC64LEMuslTriples), end(PPC64LEMuslTriples));
+ BiarchLibDirs.append(begin(PPCLELibDirs), end(PPCLELibDirs));
+ BiarchTripleAliases.append(begin(PPCLEMuslTriples), end(PPCLEMuslTriples));
+ break;
+ default:
+ break;
+ }
+ TripleAliases.push_back(TargetTriple.str());
+ if (TargetTriple.str() != BiarchTriple.str())
+ BiarchTripleAliases.push_back(BiarchTriple.str());
+ return;
+ }
+
// Android targets should not use GNU/Linux tools or libraries.
if (TargetTriple.isAndroid()) {
static const char *const AArch64AndroidTriples[] = {

View file

@ -0,0 +1,13 @@
--- a/lib/Driver/ToolChains/Linux.cpp
+++ b/lib/Driver/ToolChains/Linux.cpp
@@ -504,10 +504,6 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
Loader = "ld.so.1";
break;
case llvm::Triple::ppc64:
- LibDir = "lib64";
- Loader =
- (tools::ppc::hasPPCAbiArg(Args, "elfv2")) ? "ld64.so.2" : "ld64.so.1";
- break;
case llvm::Triple::ppc64le:
LibDir = "lib64";
Loader =

View file

@ -0,0 +1,48 @@
--- a/lib/Basic/Targets/PPC.h
+++ b/lib/Basic/Targets/PPC.h
@@ -415,11 +415,10 @@ public:
LongDoubleFormat = &llvm::APFloat::IEEEdouble();
} else if ((Triple.getArch() == llvm::Triple::ppc64le)) {
DataLayout = "e-m:e-i64:64-n32:64";
- ABI = "elfv2";
} else {
DataLayout = "E-m:e-i64:64-n32:64";
- ABI = "elfv1";
}
+ ABI = "elfv2";
if (Triple.isOSFreeBSD() || Triple.isOSOpenBSD() || Triple.isMusl()) {
LongDoubleWidth = LongDoubleAlign = 64;
--- a/lib/CodeGen/TargetInfo.cpp
+++ b/lib/CodeGen/TargetInfo.cpp
@@ -10927,9 +10927,9 @@ const TargetCodeGenInfo &CodeGenModule::getTargetCodeGenInfo() {
return SetCGInfo(new AIXTargetCodeGenInfo(Types, /*Is64Bit*/ true));
if (Triple.isOSBinFormatELF()) {
- PPC64_SVR4_ABIInfo::ABIKind Kind = PPC64_SVR4_ABIInfo::ELFv1;
- if (getTarget().getABI() == "elfv2")
- Kind = PPC64_SVR4_ABIInfo::ELFv2;
+ PPC64_SVR4_ABIInfo::ABIKind Kind = PPC64_SVR4_ABIInfo::ELFv2;
+ if (getTarget().getABI() == "elfv1")
+ Kind = PPC64_SVR4_ABIInfo::ELFv1;
bool IsSoftFloat = CodeGenOpts.FloatABI == "soft";
return SetCGInfo(
--- a/lib/Driver/ToolChains/Clang.cpp
+++ b/lib/Driver/ToolChains/Clang.cpp
@@ -1920,14 +1920,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
const llvm::Triple &T = getToolChain().getTriple();
if (T.isOSBinFormatELF()) {
switch (getToolChain().getArch()) {
- case llvm::Triple::ppc64: {
- if ((T.isOSFreeBSD() && T.getOSMajorVersion() >= 13) ||
- T.isOSOpenBSD() || T.isMusl())
- ABIName = "elfv2";
- else
- ABIName = "elfv1";
- break;
- }
+ case llvm::Triple::ppc64:
case llvm::Triple::ppc64le:
ABIName = "elfv2";
break;

View file

@ -0,0 +1,11 @@
--- compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp.orig
+++ compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
@@ -1799,7 +1799,7 @@
static bool Aarch64GetESR(ucontext_t *ucontext, u64 *esr) {
static const u32 kEsrMagic = 0x45535201;
- u8 *aux = ucontext->uc_mcontext.__reserved;
+ u8 *aux = reinterpret_cast<u8 *>(ucontext->uc_mcontext.__reserved);
while (true) {
_aarch64_ctx *ctx = (_aarch64_ctx *)aux;
if (ctx->size == 0) break;

View file

@ -0,0 +1,35 @@
--- a/lib/sanitizer_common/sanitizer_linux.cpp
+++ b/lib/sanitizer_common/sanitizer_linux.cpp
@@ -74,6 +74,10 @@
#include <sys/utsname.h>
#endif
+#if SANITIZER_LINUX && defined(__powerpc__)
+#include <asm/ptrace.h>
+#endif
+
#if SANITIZER_LINUX && !SANITIZER_ANDROID
#include <sys/personality.h>
#endif
--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
+++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
@@ -92,7 +92,7 @@
# include <utime.h>
# include <sys/ptrace.h>
#if defined(__mips64) || defined(__aarch64__) || defined(__arm__) || \
- SANITIZER_RISCV64
+ defined(__powerpc__) || SANITIZER_RISCV64
# include <asm/ptrace.h>
# 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
@@ -31,7 +31,7 @@
#include <sys/types.h> // for pid_t
#include <sys/uio.h> // for iovec
#include <elf.h> // for NT_PRSTATUS
-#if (defined(__aarch64__) || SANITIZER_RISCV64) && !SANITIZER_ANDROID
+#if (defined(__aarch64__) || defined(__powerpc__) || SANITIZER_RISCV64) && !SANITIZER_ANDROID
// GLIBC 2.20+ sys/user does not include asm/ptrace.h
# include <asm/ptrace.h>
#endif

View file

@ -0,0 +1,10 @@
--- compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp.orig
+++ compiler-rt/lib/fuzzer/FuzzerInterceptors.cpp
@@ -25,6 +25,7 @@
}
#include <cassert>
+#include <cstddef>
#include <cstdint>
#include <dlfcn.h> // for dlsym()

View file

@ -0,0 +1,62 @@
--- a/lib/xray/xray_powerpc64.inc
+++ b/lib/xray/xray_powerpc64.inc
@@ -12,7 +12,13 @@
#include <cstdint>
#include <mutex>
+#ifdef __GLIBC__
#include <sys/platform/ppc.h>
+#else
+#include <cctype>
+#include <cstring>
+#include <cstdlib>
+#endif
#include "xray_defs.h"
@@ -20,13 +26,45 @@ namespace __xray {
ALWAYS_INLINE uint64_t readTSC(uint8_t &CPU) XRAY_NEVER_INSTRUMENT {
CPU = 0;
+#ifdef __GLIBC__
return __ppc_get_timebase();
+#else
+ return __builtin_ppc_get_timebase();
+#endif
}
inline uint64_t getTSCFrequency() XRAY_NEVER_INSTRUMENT {
static std::mutex M;
std::lock_guard<std::mutex> Guard(M);
+#ifdef __GLIBC__
return __ppc_get_timebase_freq();
+#else
+ /* FIXME: a less dirty implementation? */
+ static uint64_t base;
+ if (!base) {
+ FILE *f = fopen("/proc/cpuinfo", "rb");
+ if (f) {
+ ssize_t nr;
+ /* virtually always big enough to hold the line */
+ char buf[512];
+ while (fgets(buf, sizeof(buf), f)) {
+ char *ret = strstr(buf, "timebase");
+ if (!ret) {
+ continue;
+ }
+ ret += sizeof("timebase" - 1);
+ ret = strchr(ret, ':');
+ if (!ret) {
+ continue;
+ }
+ base = strtoul(ret + 1, nullptr, 10);
+ break;
+ }
+ fclose(f);
+ }
+ }
+ return base;
+#endif
}
inline bool probeRequiredCPUFeatures() XRAY_NEVER_INSTRUMENT {

View file

@ -1,28 +1,26 @@
--- a/include/locale
+++ b/include/locale
@@ -10,7 +10,6 @@
#ifndef _LIBCPP_LOCALE
#define _LIBCPP_LOCALE
-
/*
locale synopsis
@@ -871,7 +870,7 @@ __num_get_signed_integral(const char* __a, const char* __a_end,
@@ -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;
- long long __ll = strtoll_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
+#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;
@@ -911,7 +910,7 @@ __num_get_unsigned_integral(const char* __a, const char* __a_end,
@@ -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;
- unsigned long long __ll = strtoull_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
+#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;

View file

@ -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.
--- include/limits
+++ include/limits
--- a/include/limits
+++ b/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__;}

View file

@ -1,5 +1,5 @@
--- CMakeLists.txt
+++ CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -769,6 +769,8 @@ function(cxx_link_system_libraries target)
target_link_libraries(${target} PRIVATE atomic)
endif()

View file

@ -1,7 +1,7 @@
This fixes build at least with gcc9 which does not define `__ppc__`.
--- include/__libunwind_config.h
+++ include/__libunwind_config.h
--- a/include/__libunwind_config.h
+++ b/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
--- src/UnwindRegistersRestore.S
+++ src/UnwindRegistersRestore.S
--- a/src/UnwindRegistersRestore.S
+++ b/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)
//
--- src/UnwindRegistersSave.S
+++ src/UnwindRegistersSave.S
--- a/src/UnwindRegistersSave.S
+++ b/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)
--- src/config.h
+++ src/config.h
--- a/src/config.h
+++ b/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__)
--- src/libunwind.cpp
+++ src/libunwind.cpp
--- a/src/libunwind.cpp
+++ b/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__)

View file

@ -0,0 +1,31 @@
--- a/source/Plugins/Process/Linux/Procfs.h
+++ b/source/Plugins/Process/Linux/Procfs.h
@@ -10,21 +10,12 @@
// 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__)
-typedef unsigned long elf_greg_t;
-typedef elf_greg_t
- elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
-typedef struct user_fpsimd_state elf_fpregset_t;
-#ifndef NT_FPREGSET
-#define NT_FPREGSET NT_PRFPREG
-#endif // NT_FPREGSET
-#elif defined(__mips__)
-#ifndef NT_FPREGSET
-#define NT_FPREGSET NT_PRFPREG
-#endif // NT_FPREGSET
-#endif
-#else // __ANDROID__
+#if !defined(__GLIBC__) && defined(__powerpc__)
+#define pt_regs musl_pt_regs
+#include <sys/procfs.h>
+#undef pt_regs
+#else
#include <sys/procfs.h>
-#endif // __ANDROID__
+#endif

View file

@ -0,0 +1,57 @@
From faca3fbd15d0c3108493c3c54cd93138e049ac43 Mon Sep 17 00:00:00 2001
From: Andrea Brancaleoni <miwaxe@gmail.com>
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 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

View file

@ -0,0 +1,30 @@
This patches LLVM to use ELFv2 on ppc64 unconditionally unless overridden. We
need this because unlike most distros we use ELFv2 for both glibc and musl
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
@@ -222,9 +222,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;
}
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
@@ -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

View file

@ -0,0 +1,11 @@
--- llvm/lib/Target/PowerPC/PPCSubtarget.cpp
+++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp
@@ -165,7 +165,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)

View file

@ -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
@@ -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()
+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)

View file

@ -0,0 +1,36 @@
From f3dbdd49c06bfafc1d6138094cf42889c14d38b6 Mon Sep 17 00:00:00 2001
From: Samuel Holland <samuel@sholland.org>
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/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
@@ -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.
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/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
@@ -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.
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);

View file

@ -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
@@ -58,7 +58,7 @@ static int getPosixProtectionFlags(unsigned Flags) {
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

529
srcpkgs/llvm12/template Normal file
View file

@ -0,0 +1,529 @@
# Template file for 'llvm12'
pkgname=llvm12
version=12.0.0
revision=1
wrksrc="llvm-${version}.src"
build_style=cmake
configure_args="
-DCMAKE_BUILD_TYPE=Release -Wno-dev
-DENABLE_LINKER_BUILD_ID=ON
-DLLDB_USE_SYSTEM_SIX=ON
-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
-DLLVM_BINUTILS_INCDIR=/usr/include"
hostmakedepends="groff perl python3 zlib-devel libffi-devel swig python3-Sphinx
python3-recommonmark python3-sphinx-automodapi"
makedepends="python3-devel zlib-devel elfutils-devel libffi-devel libedit-devel
libxml2-devel binutils-devel libatomic-devel"
depends="libllvm12>=${version}_${revision}"
short_desc="Low Level Virtual Machine"
maintainer="q66 <daniel@octaforge.org>"
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"
lib32disabled=yes
python_version=3
if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES"
makedepends+=" libexecinfo-devel"
fi
# "operand out of range" assembler failures
case "$XBPS_TARGET_MACHINE" in
ppc64*) ;;
ppc*) configure_args+=" -DCLANG_ENABLE_CLANGD=OFF" ;;
esac
_lldb_enable=yes
_libomp_enable=no
case "$XBPS_TARGET_MACHINE" in
ppc64le*) ;;
ppc*) _lldb_enable=no ;;
esac
case "$XBPS_TARGET_MACHINE" in
x86_64*|aarch64*|ppc64*) _libomp_enable=yes;;
esac
subpackages="clang-tools-extra"
# must go before clang
if [ "$_libomp_enable" = "yes" ]; then
subpackages+=" libomp libomp-devel"
# because of cmake nonsense referencing libomptarget.so.*
depends+=" libomp>=${version}_${revision}"
fi
subpackages+=" clang clang-analyzer libclang libclang-cpp
llvm-libunwind llvm-libunwind-devel libcxx libcxx-devel
libcxxabi libcxxabi-devel libllvm12"
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
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
fi
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
# fix linker failures on 32-bit ppc
case "$XBPS_TARGET_MACHINE" in
ppc64*) ;;
aarch64*|ppc*)
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
# 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
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
;;
esac
# some sanitizer currently only on x86_64 stuff needs backtrace
case "$XBPS_TARGET_MACHINE" in
x86_64-musl)
vsed -i 's,# Set common link flags.,list(APPEND SANITIZER_COMMON_LINK_LIBS execinfo),' \
${wrksrc}/projects/compiler-rt/CMakeLists.txt
;;
esac
# sanitizer code is broken on arm*-musl since it duplicates some libc bits
if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
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
fi
}
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
ppc64*) ;;
mips*-musl|ppc*) 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
[ "$_lldb_enable" = "yes" ] && make ${makejobs} -C tools/lldb/utils/TableGen
configure_args+=" -DLLVM_TABLEGEN=${wrksrc}/build/HOST/bin/llvm-tblgen"
configure_args+=" -DCLANG_TABLEGEN=${wrksrc}/build/HOST/bin/clang-tblgen"
[ "$_lldb_enable" = "yes" ] && configure_args+=" -DLLDB_TABLEGEN=${wrksrc}/build/HOST/bin/lldb-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_HOST_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
configure_args+=" -DLLVM_DEFAULT_TARGET_TRIPLE=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}"
}
do_install() {
cd build
cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr -P cmake_install.cmake
# 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
# Install libcxxabi headers
vinstall ${wrksrc}/projects/libcxxabi/include/__cxxabi_config.h 644 usr/include
vinstall ${wrksrc}/projects/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
}
clang-analyzer_package() {
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() {
lib32disabled=yes
depends="clang-${version}_${revision} python3"
short_desc+=" - Extra Clang tools"
homepage="https://clang.llvm.org/extra/"
pkg_install() {
vmove usr/include/clang-tidy
vmove usr/bin/clang-apply-replacements
vmove usr/bin/clang-query
vmove usr/bin/clang-rename
vmove usr/bin/clang-tidy
vmove usr/bin/diagtool
vmove usr/bin/find-all-symbols
vmove usr/bin/hmaptool
vmove usr/bin/modularize
vmove usr/bin/pp-trace
vmove usr/bin/sancov
vmove "usr/lib/libclangApplyReplacements*"
vmove "usr/lib/libclangQuery*"
vmove "usr/lib/libclangTidy*"
vmove "usr/share/clang/*tidy*"
vmove usr/share/doc/clang-tools
vmove usr/share/man/man1/extraclangtools.1
vmove usr/share/man/man1/diagtool.1
}
}
clang_package() {
lib32disabled=yes
depends="libstdc++-devel libgcc-devel binutils ${XBPS_TARGET_LIBC}-devel
libclang-${version}_${revision}"
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*.a"
vmove "usr/lib/libclang*.so"
vmove usr/share/clang
vmove usr/share/doc/clang
vmove usr/share/man/man1/clang.1
}
}
libclang_package() {
short_desc+=" - C frontend runtime library"
pkg_install() {
vmove "usr/lib/libclang.so.*"
}
}
libclang-cpp_package() {
short_desc+=" - C frontend runtime library (C++ interface)"
pkg_install() {
vmove "usr/lib/libclang-cpp.so.*"
}
}
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*
vmove usr/bin/ld64.lld*
vmove usr/share/doc/lld
}
}
lld-devel_package() {
lib32disabled=yes
short_desc+=" - linker - development files"
homepage="https://lld.llvm.org"
depends="lld>=${version}_${revision}"
pkg_install() {
vmove usr/include/lld
vmove usr/lib/cmake/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*
}
}
lldb-devel_package() {
lib32disabled=yes
depends="lldb>=${version}_${revision}"
short_desc+=" - LLDB debugger - development files"
pkg_install() {
vmove usr/include/lldb
vmove "usr/lib/liblldb*.so"
}
}
llvm-libunwind_package() {
short_desc+=" - libunwind"
pkg_install() {
vmove "usr/lib/libunwind.so.*"
}
}
llvm-libunwind-devel_package() {
short_desc+=" - libunwind - development files"
depends="llvm-libunwind>=${version}_${revision}"
conflicts="libunwind-devel>=0"
pkg_install() {
vmove usr/lib/libunwind.so
vmove usr/lib/libunwind.a
vmove "usr/include/*unwind*"
vmove usr/include/mach-o
vmove usr/share/doc/libunwind
}
}
libcxxabi_package() {
short_desc+=" - low level support for libc++"
pkg_install() {
vmove "usr/lib/libc++abi.so.*"
}
}
libcxxabi-devel_package() {
short_desc+=" - low level support for libc++ - development files"
depends="libcxxabi>=${version}_${revision}"
pkg_install() {
vmove usr/lib/libc++abi.so
vmove usr/lib/libc++abi.a
vmove "usr/include/*cxxabi*"
}
}
libcxx_package() {
short_desc+=" - C++ standard library"
pkg_install() {
vmove "usr/lib/libc++.so.*"
}
}
libcxx-devel_package() {
short_desc+=" - C++ standard library - development files"
depends="libcxx>=${version}_${revision}"
pkg_install() {
vmove usr/lib/libc++.so
vmove usr/lib/libc++.a
vmove usr/lib/libc++experimental.a
vmove usr/include/c++
vmove usr/share/doc/libcxx
}
}
libomp_package() {
short_desc+=" - Clang OpenMP support library"
pkg_install() {
vmove usr/lib/libomp.so
vmove "usr/lib/libomptarget.rtl.*.so"
vmove usr/lib/libarcher.so
vmove "usr/lib/libomp*.so.*"
}
}
libomp-devel_package() {
short_desc+=" - Clang OpenMP support library - development files"
depends="libomp>=${version}_${revision}"
pkg_install() {
vmove "usr/lib/libomp*.so"
vmove "usr/lib/libarcher*"
vmove "usr/include/omp*.h"
vmove "usr/lib/clang/${version}/include/omp*.h"
vmove usr/share/man/man1/llvmopenmp.1
vmove usr/share/doc/openmp
}
}
libllvm12_package() {
short_desc+=" - runtime library"
pkg_install() {
vmove "usr/lib/libLLVM-*.so*"
}
}

3
srcpkgs/llvm12/update Normal file
View file

@ -0,0 +1,3 @@
site="https://github.com/llvm/llvm-project/releases"
pattern="llvmorg-\K(\d+.){2}\d+(-rc\d+)?"
ignore="*-rc*"