llvm10: rebuild standalone

This commit is contained in:
Robin Voetter 2020-11-08 18:21:16 +01:00 committed by q66
parent 93f0f1b804
commit fa29b75e73
8 changed files with 5 additions and 440 deletions

View file

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

View file

@ -1,44 +0,0 @@
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

@ -1,91 +0,0 @@
--- a/lib/Driver/ToolChains/Gnu.cpp
+++ b/lib/Driver/ToolChains/Gnu.cpp
@@ -1938,7 +1938,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"};
@@ -2077,6 +2078,78 @@ 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 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::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));
+ 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

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

View file

@ -1,30 +0,0 @@
--- a/lib/Basic/Targets/PPC.h
+++ b/lib/Basic/Targets/PPC.h
@@ -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 = "elfv1";
}
+ ABI = "elfv2";
if (Triple.getOS() == llvm::Triple::AIX)
SuitableAlign = 64;
--- a/lib/Driver/ToolChains/Clang.cpp
+++ b/lib/Driver/ToolChains/Clang.cpp
@@ -1918,11 +1918,7 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
ABIName = "elfv1-qpx";
break;
}
-
- if (T.isMusl() || (T.isOSFreeBSD() && T.getOSMajorVersion() >= 13))
- ABIName = "elfv2";
- else
- ABIName = "elfv1";
+ ABIName = "elfv2";
break;
}
case llvm::Triple::ppc64le:

View file

@ -1,11 +0,0 @@
--- 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}
)

View file

@ -1,31 +0,0 @@
--- 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

@ -1,7 +1,7 @@
# Template file for 'llvm10'
pkgname=llvm10
version=10.0.0
revision=6
revision=7
wrksrc="llvm-${version}.src"
build_style=cmake
configure_args="
@ -20,40 +20,14 @@ short_desc="Low Level Virtual Machine"
maintainer="q66 <daniel@octaforge.org>"
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"
distfiles="https://github.com/llvm/llvm-project/releases/download/llvmorg-${version}/llvm-${version}.src.tar.xz"
checksum="df83a44b3a9a71029049ec101fb0077ecbbdf5fe41e395215025779099a98fdf"
lib32disabled=yes
python_version=3
_lldb_enable=yes
conflicts="llvm11>=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 libclang libclang-cpp libllvm10"
if [ "$_lldb_enable" = "yes" ]; then
# XXX fails to cross compile due to python
subpackages+=" lldb lldb-devel"
fi
subpackages+=" lld lld-devel"
subpackages="libllvm10"
post_patch() {
# patches
@ -62,65 +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 [ -d ${XBPS_BUILDDIR}/lldb-${version}.src ]; then
if [ "$_lldb_enable" = "yes" ]; then
mv ${XBPS_BUILDDIR}/lldb-${version}.src ${wrksrc}/tools/lldb
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
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() {
@ -143,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
@ -188,120 +101,6 @@ do_install() {
fi
}
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/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*"
}
}
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"
}
}
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*
}
}
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() {
lib32disabled=yes
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() {