Commit 9c42240e authored by Natanael Copa's avatar Natanael Copa

main/llvm: build with gcc and fix arm

clang is not ready to use for production yet so we don't bootstrap
clang to build itself.

Also fix arm build.

fixes #4372
parent c6940867
......@@ -2,7 +2,7 @@
# Maintainer: Travis Tilley <ttilley@gmail.com>
pkgname=llvm
pkgver=3.6.1
pkgrel=1
pkgrel=2
use_svn="false"
pkgdesc="low level virtual machine compiler system"
arch="x86 x86_64 armhf"
......@@ -213,36 +213,37 @@ build() {
# auto-detect it by guessing either.
ffi_include_dir="$(pkg-config --cflags-only-I libffi | sed 's|^-I||g')"
mkdir -p "$_builddir"
cd "$_builddir"
if [ -n "$BOOTSTRAP_CLANG" ]; then
die "should not happen"
msg "Compiling bootstrap compiler"
cmake -G "Unix Makefiles" -Wno-dev ${_cmake_bootstrap_flags} \
-DCMAKE_C_FLAGS_RELEASE="${cflags}" \
-DCMAKE_CXX_FLAGS_RELEASE="${cxxflags}" \
-DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \
-DCMAKE_SHARED_LINKER_FLAGS="${LDFLAGS}" \
-DFFI_INCLUDE_DIR="$ffi_include_dir" \
"${_srcdir}" || return 1
make || return 1
make install || return 1
cflags="${orig_cflags} -DNDEBUG"
cxxflags="${orig_cxxflags} -DNDEBUG"
CC="${_bootstrap_prefix}/bin/clang"
CXX="${_bootstrap_prefix}/bin/clang++"
cd ..
rm -rf "$_builddir"
mkdir -p "$_builddir"
cd "$_builddir"
fi
msg "Compiling bootstrap compiler"
cmake -G "Unix Makefiles" -Wno-dev ${_cmake_bootstrap_flags} \
-DCMAKE_C_FLAGS_RELEASE="${cflags}" \
-DCMAKE_CXX_FLAGS_RELEASE="${cxxflags}" \
-DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \
-DCMAKE_SHARED_LINKER_FLAGS="${LDFLAGS}" \
-DFFI_INCLUDE_DIR="$ffi_include_dir" \
"${_srcdir}" || return 1
make || return 1
make install || return 1
cflags="${orig_cflags} -DNDEBUG"
cxxflags="${orig_cxxflags} -DNDEBUG"
CC="${_bootstrap_prefix}/bin/clang"
CXX="${_bootstrap_prefix}/bin/clang++"
cd ..
rm -rf "$_builddir"
mkdir -p "$_builddir"
cd "$_builddir"
msg "Compiling final compiler"
cmake -G "Unix Makefiles" -Wno-dev ${_cmake_final_flags} \
-DCMAKE_C_COMPILER="${CC}" \
-DCMAKE_CXX_COMPILER="${CXX}" \
-DCMAKE_C_FLAGS_RELEASE="${cflags}" \
-DCMAKE_CXX_FLAGS_RELEASE="${cxxflags}" \
-DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \
......@@ -252,17 +253,19 @@ build() {
make || return 1
# llvm tests don't run under PaX, almost certainly due to MCJIT
# TODO: detect when running a vanilla kernel and run all tests
# make check-llvm || return 1
if [ -n "$BOOTSTRAP_CLANG" ]; then
# llvm tests don't run under PaX, almost certainly due to MCJIT
# TODO: detect when running a vanilla kernel and run all tests
# make check-llvm || return 1
make check-clang || return 1
make check-clang || return 1
# 27 failures, all related to clang-tidy.
# clang-format/clang-modernize and friends pass their test suites
# make check-clang-tools || return 1
# 27 failures, all related to clang-tidy.
# clang-format/clang-modernize and friends pass their test suites
# make check-clang-tools || return 1
make check-compiler-rt || return 1
make check-compiler-rt || return 1
fi
}
package() {
......@@ -309,7 +312,7 @@ libs() {
}
md5sums="0947294a8c83c8d7f857dfc16204c4eb llvm-0001-fix-shared-build.patch
d10fc3574c560ccfae3eeacdc4a988f2 llvm-0002-musl-triple.patch
dacc40624cf09fa98de27016bebb1432 llvm-0002-musl-triple.patch
056178d87918d531f531b1b765a59e7c llvm-0003-musl-hacks.patch
346081b2f0825ca7f491155c4b3ca0ea compiler-rt-0001-musl-no-dlvsym.patch
eb3797555357896a92f74bf1bacfbdc2 compiler-rt-0002-musl-no-sanitizers.patch
......@@ -319,8 +322,8 @@ eab0123372fa909817ed21cfcffdbe16 clang-0001-fix-stdint.h.patch
93ffbede80bc857c8ae6bed5ff016a52 clang-0003-add-alpine-linux-distro.patch
231fad6dc619ef6a54567c14082bf7af clang-0004-alpine-use-z-relro.patch
2967fea7ed0624d99808bc091be1bab4 clang-0005-alpine-hash-style-gnu.patch
2848c592e5388069b7f4785085193078 clang-0006-musl-alpine-triple.patch
e24a82edcd6caa5e405ff67a45d6befc clang-0007-musl-dynamic-linker-paths.patch
1ae0e80cfd31a42b299a65ba67e244ef clang-0006-musl-alpine-triple.patch
f69714b175a5a888f77d68e2ebf76167 clang-0007-musl-dynamic-linker-paths.patch
6bc4b7047042f9afec452a97c35c2cd5 clang-0008-alpine-PIE-by-default.patch
0ae0c5939c27750c52b39158fbc7a7a9 clang-0009-pass-host-triple-to-compiler-rt.patch
ebf9e97be405ae126e134d3a357cd58a llvm-3.6.1.src.tar.xz
......@@ -328,7 +331,7 @@ ebf9e97be405ae126e134d3a357cd58a llvm-3.6.1.src.tar.xz
1ad810536f0f7fefd4541a907aff83b3 clang-tools-extra-3.6.1.src.tar.xz
6f204b1feb324b1672ac907b32d927c0 compiler-rt-3.6.1.src.tar.xz"
sha256sums="4f75c2a76cf4c439d65c8e67511cd91c895edf8ccf003a5f94ffa07c29456296 llvm-0001-fix-shared-build.patch
3062c6135b12eab1ff365d1d609193723bb4c6ff3dfa9fcf76fe2b75948668c9 llvm-0002-musl-triple.patch
98d92c6cb305faff141b1b5a7cfa18656bd80aa478e7a45984f27e60a80bfdd9 llvm-0002-musl-triple.patch
c6892c843b38c9a852367e5d76ffc29c21bdfd522adbc4c4e3e3c890a513c0db llvm-0003-musl-hacks.patch
94f5626b4729afb39ad00a6cac4f8d44e3ee6f3d87362268bcd2c0ec637edc22 compiler-rt-0001-musl-no-dlvsym.patch
7dd2d22c61892eb651809649606fb3722520a5d12f8d88c2e96be977d0f8b71a compiler-rt-0002-musl-no-sanitizers.patch
......@@ -338,8 +341,8 @@ c6892c843b38c9a852367e5d76ffc29c21bdfd522adbc4c4e3e3c890a513c0db llvm-0003-musl
78449c4f7c9fdfaccef3b68039c69e7e041fb34862d39c803d7e6fac17f659aa clang-0003-add-alpine-linux-distro.patch
501ab6e3fb99c9ffb82329475051a633797bf824c0dea437843266f190c062a0 clang-0004-alpine-use-z-relro.patch
1c4dbd1d474bf08de5979d6f4399aeba29de9ba8950aa0688d081d82e552d7d3 clang-0005-alpine-hash-style-gnu.patch
a7c3ab756cae110887dad315b8458212830949442a491618253c79eba754b546 clang-0006-musl-alpine-triple.patch
c7612168defefcb35cc8c988ff8b519aa983f07a62fd3b2c67f7d468459ca48a clang-0007-musl-dynamic-linker-paths.patch
b62205ddb4b76470ba433c69ecb20d1be41963d1f826b8a6937cc024d8159268 clang-0006-musl-alpine-triple.patch
44667890d5fa1816ca6cb33e63b49c5e9cfcb8265cdae513b2d0bd0916726766 clang-0007-musl-dynamic-linker-paths.patch
39c275490e3360d50fe339406992616fad0fa9127204c9b93578ee2403ae850c clang-0008-alpine-PIE-by-default.patch
ec0c2014d455040499f599dc3d690fb92e54baf6058605be5f25c2c845629cfe clang-0009-pass-host-triple-to-compiler-rt.patch
2f00c615913aa0b56607ee1548936e60ad2aa89e6d56f23fb032a4463366fc7a llvm-3.6.1.src.tar.xz
......@@ -347,7 +350,7 @@ ec0c2014d455040499f599dc3d690fb92e54baf6058605be5f25c2c845629cfe clang-0009-pas
f4ee70d870d550a9147ac6a548ce7daf7d9e6897348bf411f43c572966fb92b6 clang-tools-extra-3.6.1.src.tar.xz
fcbf610c77be6047f11ca10c4725610417beba832565115a9e2fcfe2897b649f compiler-rt-3.6.1.src.tar.xz"
sha512sums="b3c0e0f74680e9b2d02f1c923a191ef5eb913be84105e4d63aae6a88b1dac758467cecad3430496a7945cebdc73ec5ee1f643dc5dc7b336fee920e3c8b6d54d2 llvm-0001-fix-shared-build.patch
8088e79c51694d237f0e29a1c9032776f943561aff389f8706f1c10b3b0405d4fa72643fb83c973be55370e89d893f7b7592bb8c64dcf2310369c0d1b7ba5db2 llvm-0002-musl-triple.patch
49203df74402b2e080fafb99a4df54d1822dbd3e4e018c44f2b41c95fcfa01b14c8c505405fd1c8909eac5effd36c60decdc771b4db9a16faf5f980af75c7551 llvm-0002-musl-triple.patch
df8959d43af48054bc35e4125f98e5dab1e1b5beaf7b67e95791caf144efec06764bd31a9eb5efc2179932591de8b862ebf89592d131e47070c89f19412979b7 llvm-0003-musl-hacks.patch
f1e6d17f4cc618b6a1edba64bda652f210d3c839bd8d2d4eff81af0895176062dab1e8fa963d0fe2403311863aee083d257bdb57ad9b44e23a958286a0d2e12b compiler-rt-0001-musl-no-dlvsym.patch
45f64cd5863238b7f7ad2f4a3733455e17eb3ab3121ba3404404f312beb91bb4d109c7c3278f77fc78730086e70cfe6532e159efef30e34af0132ca44a965220 compiler-rt-0002-musl-no-sanitizers.patch
......@@ -357,8 +360,8 @@ effed16bed6160c1629c72960424afed87f8c1c1290bf4eccd43da5a1fcb5b350242c01fcc1cc735
0b8108c96948a1704275a93f3b872572fe2c61a0cd3e7f4caf63c0ca262cc079e2424b70f41d20f4a9aebe30333e39e3c594b4240fd41f7bd9a6682e751a23d9 clang-0003-add-alpine-linux-distro.patch
ac72ea29d6f889f2b54915b97d56bc388e849da2f524b872241053fa6bb9dde4eb6b1333813070e3671115121da34c22ff1e87aa19ce82a393166143b30c7de4 clang-0004-alpine-use-z-relro.patch
0594cc85b6cf0be66e747eb7ba6af5aff401d65b4072f3da4a3e531795965f72df5a3850c7abbbe4e1fde3dc6ad583ecfc4a77429531bae02143b5ca36bed37e clang-0005-alpine-hash-style-gnu.patch
e00a05f6a599b4686d6759c844f8283360a95bc6d1f171d4ab56ba7e17e017bc244f302ba2a4191a3e006bb8bc3b8d235de3624d423357fe30a3595d20bb9371 clang-0006-musl-alpine-triple.patch
c4365cbf9645e7aacbef2392cd7418c055a45e178e4ad956dfe45eafc90ab1db70ff620dfeeec11a4fab550ec557385f2d75f68adc0830ce74b5ece7077a3baf clang-0007-musl-dynamic-linker-paths.patch
0c87ff437bebc9dda188a710a6c32a6e7288692ff862556bb53f5e61b0ef6aa6bba74b9a9302808df6bfe1afaa41489203f45779c627c09e46ebffd1627eff3f clang-0006-musl-alpine-triple.patch
d23c9fb922312229d333091122ca65d94a4595af651657d8cca5a57c5804642897947702567c213027b02c98204cac9b92fee4a3e9e514bd7c539902e84462f4 clang-0007-musl-dynamic-linker-paths.patch
2a217800aefbce07017b793a8c91e174dac20546343de47749b4b07b4905db9a55411ef45e482b8df93cb4dbbdf25415202c3257be36ae095a6f2de11935f80b clang-0008-alpine-PIE-by-default.patch
7628c1b12febb27d0a9ecb846205edec61044fbb963ba5e588863652bccbb05d1436febf8840ff4b47dfb326689bb142464be59a18b17bd5d30aa03bb7e76a9f clang-0009-pass-host-triple-to-compiler-rt.patch
fa07d0fe6c527d86c0b91b1b62597f949d777e3609e4e8ca2ea5e07931e1ebc7a363273cc705cf4a13b45e7ab00716b76de26688d077c1b51341d9dd2972de3f llvm-3.6.1.src.tar.xz
......
......@@ -8,8 +8,8 @@ index 6007a98..44e929f 100644
static const char *const ARMHFTriples[] = { "arm-linux-gnueabihf",
- "armv7hl-redhat-linux-gnueabi" };
+ "armv7hl-redhat-linux-gnueabi",
+ "armv6-alpine-linux-musleabihf",
+ "armv7-alpine-linux-musleabihf"};
+ "armv6-alpine-linux-muslgnueabihf",
+ "armv7-alpine-linux-muslgnueabihf"};
static const char *const ARMebLibDirs[] = { "/lib" };
static const char *const ARMebTriples[] = { "armeb-linux-gnueabi",
"armeb-linux-androideabi" };
......@@ -34,5 +34,182 @@ index 6007a98..44e929f 100644
};
static const char *const MIPSLibDirs[] = { "/lib" };
--- a/lib/Basic/Targets.cpp
+++ b/lib/Basic/Targets.cpp
@@ -3933,6 +3933,8 @@
case llvm::Triple::Android:
case llvm::Triple::GNUEABI:
case llvm::Triple::GNUEABIHF:
+ case llvm::Triple::MuslEABI:
+ case llvm::Triple::MuslEABIHF:
setABI("aapcs-linux");
break;
case llvm::Triple::EABIHF:
--- a/lib/CodeGen/TargetInfo.cpp
+++ b/lib/CodeGen/TargetInfo.cpp
@@ -4344,6 +4344,8 @@
case llvm::Triple::EABIHF:
case llvm::Triple::GNUEABI:
case llvm::Triple::GNUEABIHF:
+ case llvm::Triple::MuslEABI:
+ case llvm::Triple::MuslEABIHF:
return true;
default:
return false;
@@ -4354,6 +4356,7 @@
switch (getTarget().getTriple().getEnvironment()) {
case llvm::Triple::EABIHF:
case llvm::Triple::GNUEABIHF:
+ case llvm::Triple::MuslEABIHF:
return true;
default:
return false;
@@ -7107,7 +7110,8 @@
Kind = ARMABIInfo::APCS;
else if (CodeGenOpts.FloatABI == "hard" ||
(CodeGenOpts.FloatABI != "soft" &&
- Triple.getEnvironment() == llvm::Triple::GNUEABIHF))
+ (Triple.getEnvironment() == llvm::Triple::GNUEABIHF ||
+ Triple.getEnvironment() == llvm::Triple::MuslEABIHF)))
Kind = ARMABIInfo::AAPCS_VFP;
switch (Triple.getOS()) {
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -1393,7 +1393,8 @@
case llvm::Triple::arm:
case llvm::Triple::thumb:
LibDirs.append(begin(ARMLibDirs), end(ARMLibDirs));
- if (TargetTriple.getEnvironment() == llvm::Triple::GNUEABIHF) {
+ if (TargetTriple.getEnvironment() == llvm::Triple::GNUEABIHF ||
+ TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
TripleAliases.append(begin(ARMHFTriples), end(ARMHFTriples));
} else {
TripleAliases.append(begin(ARMTriples), end(ARMTriples));
@@ -1402,7 +1403,8 @@
case llvm::Triple::armeb:
case llvm::Triple::thumbeb:
LibDirs.append(begin(ARMebLibDirs), end(ARMebLibDirs));
- if (TargetTriple.getEnvironment() == llvm::Triple::GNUEABIHF) {
+ if (TargetTriple.getEnvironment() == llvm::Triple::GNUEABIHF ||
+ TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
TripleAliases.append(begin(ARMebHFTriples), end(ARMebHFTriples));
} else {
TripleAliases.append(begin(ARMebTriples), end(ARMebTriples));
@@ -2502,6 +2504,8 @@
switch (getTriple().getEnvironment()) {
case llvm::Triple::GNUEABIHF:
case llvm::Triple::GNUEABI:
+ case llvm::Triple::MuslEABIHF:
+ case llvm::Triple::MuslEABI:
case llvm::Triple::EABI:
return false;
@@ -2541,10 +2545,12 @@
switch (Triple.getEnvironment()) {
case llvm::Triple::EABI:
case llvm::Triple::GNUEABI:
+ case llvm::Triple::MuslEABI:
getFilePaths().push_back("=/usr/lib/eabi");
break;
case llvm::Triple::EABIHF:
case llvm::Triple::GNUEABIHF:
+ case llvm::Triple::MuslEABIHF:
getFilePaths().push_back("=/usr/lib/eabihf");
break;
default:
@@ -2815,7 +2821,8 @@
// regardless of what the actual target triple is.
case llvm::Triple::arm:
case llvm::Triple::thumb:
- if (TargetTriple.getEnvironment() == llvm::Triple::GNUEABIHF) {
+ if (TargetTriple.getEnvironment() == llvm::Triple::GNUEABIHF ||
+ TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
if (llvm::sys::fs::exists(SysRoot + "/lib/arm-linux-gnueabihf"))
return "arm-linux-gnueabihf";
} else {
@@ -2825,7 +2832,8 @@
return TargetTriple.str();
case llvm::Triple::armeb:
case llvm::Triple::thumbeb:
- if (TargetTriple.getEnvironment() == llvm::Triple::GNUEABIHF) {
+ if (TargetTriple.getEnvironment() == llvm::Triple::GNUEABIHF ||
+ TargetTriple.getEnvironment() == llvm::Triple::MuslEABIHF) {
if (llvm::sys::fs::exists(SysRoot + "/lib/armeb-linux-gnueabihf"))
return "armeb-linux-gnueabihf";
} else {
@@ -3246,7 +3254,8 @@
getTriple().getArch() == llvm::Triple::aarch64_be) {
MultiarchIncludeDirs = AArch64MultiarchIncludeDirs;
} else if (getTriple().getArch() == llvm::Triple::arm) {
- if (getTriple().getEnvironment() == llvm::Triple::GNUEABIHF)
+ if (getTriple().getEnvironment() == llvm::Triple::GNUEABIHF ||
+ getTriple().getEnvironment() == llvm::Triple::MuslEABIHF)
MultiarchIncludeDirs = ARMHFMultiarchIncludeDirs;
else
MultiarchIncludeDirs = ARMMultiarchIncludeDirs;
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -656,6 +656,7 @@
case llvm::Triple::FreeBSD:
switch(Triple.getEnvironment()) {
case llvm::Triple::GNUEABIHF:
+ case llvm::Triple::MuslEABIHF:
FloatABI = "hard";
break;
default:
@@ -668,6 +669,7 @@
default:
switch(Triple.getEnvironment()) {
case llvm::Triple::GNUEABIHF:
+ case llvm::Triple::MuslEABIHF:
FloatABI = "hard";
break;
case llvm::Triple::GNUEABI:
@@ -789,6 +791,8 @@
case llvm::Triple::Android:
case llvm::Triple::GNUEABI:
case llvm::Triple::GNUEABIHF:
+ case llvm::Triple::MuslEABI:
+ case llvm::Triple::MuslEABIHF:
ABIName = "aapcs-linux";
break;
case llvm::Triple::EABIHF:
@@ -6561,6 +6565,8 @@
switch(getToolChain().getTriple().getEnvironment()) {
case llvm::Triple::GNUEABIHF:
case llvm::Triple::GNUEABI:
+ case llvm::Triple::MuslEABIHF:
+ case llvm::Triple::MuslEABI:
case llvm::Triple::EABI:
CmdArgs.push_back("-meabi=5");
break;
@@ -6888,10 +6894,12 @@
switch (getToolChain().getTriple().getEnvironment()) {
case llvm::Triple::EABI:
case llvm::Triple::GNUEABI:
+ case llvm::Triple::MuslEABI:
CmdArgs.push_back("armelf_nbsd_eabi");
break;
case llvm::Triple::EABIHF:
case llvm::Triple::GNUEABIHF:
+ case llvm::Triple::MuslEABIHF:
CmdArgs.push_back("armelf_nbsd_eabihf");
break;
default:
@@ -6906,10 +6914,12 @@
switch (getToolChain().getTriple().getEnvironment()) {
case llvm::Triple::EABI:
case llvm::Triple::GNUEABI:
+ case llvm::Triple::MuslEABI:
CmdArgs.push_back("armelfb_nbsd_eabi");
break;
case llvm::Triple::EABIHF:
case llvm::Triple::GNUEABIHF:
+ case llvm::Triple::MuslEABIHF:
CmdArgs.push_back("armelfb_nbsd_eabihf");
break;
default:
--
2.1.4
......@@ -27,9 +27,9 @@ index 75eef9e..3e71522 100644
+ switch (ToolChain.getTriple().getEnvironment()) {
+ case llvm::Triple::Musl:
+ case llvm::Triple::MuslEABI:
+ return "/lib/ld-musl-arm.so.3";
+ return "/lib/ld-musl-arm.so.1";
+ case llvm::Triple::MuslEABIHF:
+ return "/lib/ld-musl-armhf.so.3";
+ return "/lib/ld-musl-armhf.so.1";
+ case llvm::Triple::GNUEABIHF:
return "/lib/ld-linux-armhf.so.3";
- else
......
......@@ -22,8 +22,8 @@ index 0838e90..4be78e5 100644
case EABI: return "eabi";
case EABIHF: return "eabihf";
+ case Musl: return "musl";
+ case MuslEABIHF: return "musleabihf";
+ case MuslEABI: return "musleabi";
+ case MuslEABIHF: return "muslgnueabihf";
+ case MuslEABI: return "muslgnueabi";
case Android: return "android";
case MSVC: return "msvc";
case Itanium: return "itanium";
......@@ -31,12 +31,22 @@ index 0838e90..4be78e5 100644
.StartsWith("code16", Triple::CODE16)
.StartsWith("gnu", Triple::GNU)
.StartsWith("android", Triple::Android)
+ .StartsWith("musleabihf", Triple::MuslEABIHF)
+ .StartsWith("musleabi", Triple::MuslEABI)
+ .StartsWith("muslgnueabihf", Triple::MuslEABIHF)
+ .StartsWith("muslgnueabi", Triple::MuslEABI)
+ .StartsWith("musl", Triple::Musl)
.StartsWith("msvc", Triple::MSVC)
.StartsWith("itanium", Triple::Itanium)
.StartsWith("cygnus", Triple::Cygnus)
--- llvm-3.6.1.src.orig/lib/Support/Triple.cpp
+++ llvm-3.6.1.src/lib/Support/Triple.cpp
@@ -1094,6 +1094,7 @@
switch (getEnvironment()) {
case llvm::Triple::EABIHF:
case llvm::Triple::GNUEABIHF:
+ case llvm::Triple::MuslEABIHF:
return "arm1176jzf-s";
default:
return "arm7tdmi";
diff --git a/lib/Target/ARM/ARMSubtarget.h b/lib/Target/ARM/ARMSubtarget.h
index dbacd4d..b330be5 100644
--- a/lib/Target/ARM/ARMSubtarget.h
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment