diff options
Diffstat (limited to 'main/llvm')
-rw-r--r-- | main/llvm/APKBUILD | 21 | ||||
-rw-r--r-- | main/llvm/llvm-3.3-alpine-linux.patch | 128 | ||||
-rw-r--r-- | main/llvm/llvm-musl.patch | 167 |
3 files changed, 269 insertions, 47 deletions
diff --git a/main/llvm/APKBUILD b/main/llvm/APKBUILD index 668ee739d0..19923dbc14 100644 --- a/main/llvm/APKBUILD +++ b/main/llvm/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: William Pitcock <nenolod@dereferenced.org> pkgname=llvm pkgver=3.3 -pkgrel=0 +pkgrel=1 pkgdesc="low level virtual machine compiler system" arch="x86 x86_64" url="http://llvm.org/" @@ -14,7 +14,8 @@ install= subpackages="clang $pkgname-dev $pkgname-doc $pkgname-libs" source="http://llvm.org/releases/$pkgver/llvm-$pkgver.src.tar.gz http://llvm.org/releases/$pkgver/cfe-$pkgver.src.tar.gz - llvm-3.3-alpine-linux.patch + llvm-3.3-alpine-linux.patch + llvm-musl.patch " # clang hardcodes linker paths; and don't know of a fix like the --with-dynamic-linker # patch we use for gcc. So llvm-3.2-alpine-linux.patch needs to be updated if/when the @@ -24,18 +25,13 @@ _builddir="$srcdir"/build _srcdir="$srcdir"/"$pkgname-$pkgver.src" prepare() { - mkdir "$_builddir" - msg "Preparing CLANG sources..." - mv "$srcdir"/cfe-$pkgver.src \ "$srcdir"/$pkgname-$pkgver.src/tools/clang || return 1 msg "Patching LLVM core..." - cd "$srcdir"/$pkgname-$pkgver.src || return 1 update_config_sub || return 1 - for i in $source; do case $i in *.patch) @@ -49,6 +45,7 @@ prepare() { } build() { + mkdir "$_builddir" cd "$_builddir" export CBUILD @@ -67,6 +64,7 @@ build() { --infodir=/usr/share/info \ --enable-ffi \ --enable-shared \ + --enable-optimized \ || return 1 # configure gets it wrong. We do have error_t @@ -112,10 +110,13 @@ libs() { md5sums="40564e1dc390f9844f1711c08b08e391 llvm-3.3.src.tar.gz 8284891e3e311829b8e44ac813d0c9ef cfe-3.3.src.tar.gz -5d5f4da3582349c9a8626cf55f8ac5e4 llvm-3.3-alpine-linux.patch" +18f9165003a5b86101547d40ec5d3036 llvm-3.3-alpine-linux.patch +517019fb4907cf5944c84315c681f905 llvm-musl.patch" sha256sums="68766b1e70d05a25e2f502e997a3cb3937187a3296595cf6e0977d5cd6727578 llvm-3.3.src.tar.gz b1b55de4ab3a57d3e0331a83e0284610191c77d924e3446498d9113d08dfb996 cfe-3.3.src.tar.gz -4c9a6b6838585ffe8d5ea063a1fa51514d407f9bb32ad56e859ed30c612fa641 llvm-3.3-alpine-linux.patch" +5a6e40c7ffe280534ce964eaca5bc8ec325cb747f8de1390f534be2944c72361 llvm-3.3-alpine-linux.patch +3b653520e79933058e9b4ab0943a364a87babe8e5e6b520ac15660c146302c74 llvm-musl.patch" sha512sums="1b7f7c5e907a68f642dcbe48fdff9585cb1504022bc9d386f310ebe5d25103d0d5f7cf0abf19e0e3fd666970160a98c90033754e2b79b2fac0cf866c984f8038 llvm-3.3.src.tar.gz 06773f43f7d3529f06edb029f7de398f06a700a0f2476e00c4727e70c291028221bfac23625dfd2c220d6ac91a21670848187a934b99a21801c695127371afcc cfe-3.3.src.tar.gz -4c177652bca81168e70ed37f95b337eea0fc4ad17ca8a5d77a018124aad89c06f851b92b9c89708b616fa37404a4a26f002dc035f6d4d7e22d97369d3fe71a95 llvm-3.3-alpine-linux.patch" +d240f0fbef611b9863cbe1a79c10b4383dabf8be2ee49fd0f853d23fb0b4c935a41f3d50456a05815102834f2a4b1ac3c9334b444ed3868b7f3fb24e14ff14eb llvm-3.3-alpine-linux.patch +52f9791a11c103ff8d1a35e0fd94a9d8e1379fd6f8046e346f52686bb256ca969ead77059271931ac1fff5581146dd7e3862a3a14d85b96555b8823e807f2d70 llvm-musl.patch" diff --git a/main/llvm/llvm-3.3-alpine-linux.patch b/main/llvm/llvm-3.3-alpine-linux.patch index 4964973271..bfb9de0328 100644 --- a/main/llvm/llvm-3.3-alpine-linux.patch +++ b/main/llvm/llvm-3.3-alpine-linux.patch @@ -1,62 +1,78 @@ -diff --git a/include/llvm/ADT/Triple.h b/include/llvm/ADT/Triple.h -index 3a72e87..ac4c3ea 100644 ---- a/include/llvm/ADT/Triple.h -+++ b/include/llvm/ADT/Triple.h -@@ -117,7 +117,8 @@ public: +--- llvm-3.3.src.orig/include/llvm/ADT/Triple.h ++++ llvm-3.3.src/include/llvm/ADT/Triple.h +@@ -117,7 +117,11 @@ EABI, MachO, Android, - ELF + ELF, -+ UClibc ++ UClibc, ++ Musl, ++ MuslEABI, ++ MuslEABIHF }; private: -diff --git a/lib/Support/Triple.cpp b/lib/Support/Triple.cpp -index 412e34c..64dfce8 100644 ---- a/lib/Support/Triple.cpp -+++ b/lib/Support/Triple.cpp -@@ -151,6 +151,7 @@ const char *Triple::getEnvironmentTypeName(EnvironmentType Kind) { +--- llvm-3.3.src.orig/lib/Support/Triple.cpp ++++ llvm-3.3.src/lib/Support/Triple.cpp +@@ -151,6 +151,10 @@ case MachO: return "macho"; case Android: return "android"; case ELF: return "elf"; + case UClibc: return "uclibc"; ++ case Musl: return "musl"; ++ case MuslEABI: return "muslgnueabi"; ++ case MuslEABIHF: return "muslgnueabihf"; } llvm_unreachable("Invalid EnvironmentType!"); -@@ -300,6 +301,7 @@ static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName) { +@@ -300,6 +304,10 @@ .StartsWith("macho", Triple::MachO) .StartsWith("android", Triple::Android) .StartsWith("elf", Triple::ELF) + .StartsWith("uclibc", Triple::UClibc) ++ .StartsWith("muslgnueabihf", Triple::MuslEABIHF) ++ .StartsWith("muslgnueabi", Triple::MuslEABI) ++ .StartsWith("musl", Triple::Musl) .Default(Triple::UnknownEnvironment); } -diff --git a/tools/clang/lib/Driver/ToolChains.cpp b/tools/clang/lib/Driver/ToolChains.cpp -index fffba0e..797d0c1 100644 ---- a/tools/clang/lib/Driver/ToolChains.cpp -+++ b/tools/clang/lib/Driver/ToolChains.cpp -@@ -1099,7 +1099,8 @@ Generic_GCC::GCCInstallationDetector::GCCInstallationDetector( +--- llvm-3.3.src.orig/tools/clang/lib/Driver/ToolChains.cpp ++++ llvm-3.3.src/tools/clang/lib/Driver/ToolChains.cpp +@@ -1086,7 +1086,9 @@ + }; + static const char *const ARMHFTriples[] = { + "arm-linux-gnueabihf", +- "armv7hl-redhat-linux-gnueabi" ++ "armv7hl-redhat-linux-gnueabi", ++ "armv6-alpine-linux-muslgnueabihf", ++ "armv7-alpine-linux-muslgnueabihf" + }; + + static const char *const X86_64LibDirs[] = { "/lib64", "/lib" }; +@@ -1099,7 +1101,9 @@ "x86_64-suse-linux", "x86_64-manbo-linux-gnu", "x86_64-linux-gnu", - "x86_64-slackware-linux" + "x86_64-slackware-linux", -+ "x86_64-alpine-linux-uclibc" ++ "x86_64-alpine-linux-uclibc", ++ "x86_64-alpine-linux-musl" }; static const char *const X86LibDirs[] = { "/lib32", "/lib" }; static const char *const X86Triples[] = { -@@ -1113,7 +1114,8 @@ Generic_GCC::GCCInstallationDetector::GCCInstallationDetector( +@@ -1113,7 +1117,9 @@ "i386-redhat-linux", "i586-suse-linux", "i486-slackware-linux", - "i686-montavista-linux" + "i686-montavista-linux", -+ "i486-alpine-linux-uclibc" ++ "i486-alpine-linux-uclibc", ++ "i486-alpine-linux-musl" }; static const char *const MIPSLibDirs[] = { "/lib" }; -@@ -1980,6 +1982,7 @@ Tool *Solaris::buildLinker() const { +@@ -1980,6 +1986,7 @@ /// Distribution (very bare-bones at the moment). enum Distro { @@ -64,21 +80,19 @@ index fffba0e..797d0c1 100644 ArchLinux, DebianLenny, DebianSqueeze, -@@ -2109,6 +2112,9 @@ static Distro DetectDistro(llvm::Triple::ArchType Arch) { +@@ -2108,6 +2115,9 @@ + if (!llvm::sys::fs::exists("/etc/arch-release", Exists) && Exists) return ArchLinux; - ++ + if (!llvm::sys::fs::exists("/etc/alpine-release", Exists) && Exists) + return AlpineLinux; -+ + return UnknownDistro; } - -diff --git a/tools/clang/lib/Driver/Tools.cpp b/tools/clang/lib/Driver/Tools.cpp -index aba1fe4..cc8e9c9 100644 ---- a/tools/clang/lib/Driver/Tools.cpp -+++ b/tools/clang/lib/Driver/Tools.cpp -@@ -5983,9 +5983,12 @@ void gnutools::Link::ConstructJob(Compilation &C, const JobAction &JA, +--- llvm-3.3.src.orig/tools/clang/lib/Driver/Tools.cpp ++++ llvm-3.3.src/tools/clang/lib/Driver/Tools.cpp +@@ -5983,16 +5983,37 @@ CmdArgs.push_back("-dynamic-linker"); if (isAndroid) CmdArgs.push_back("/system/bin/linker"); @@ -86,20 +100,60 @@ index aba1fe4..cc8e9c9 100644 - CmdArgs.push_back("/lib/ld-linux.so.2"); - else if (ToolChain.getArch() == llvm::Triple::aarch64) + else if (ToolChain.getArch() == llvm::Triple::x86) { -+ if (ToolChain.getTriple().getEnvironment() == llvm::Triple::UClibc) ++ switch (ToolChain.getTriple().getEnvironment()) { ++ case llvm::Triple::UClibc: + CmdArgs.push_back("/lib/ld-uClibc.so.0.9.32"); -+ else ++ break; ++ case llvm::Triple::Musl: ++ CmdArgs.push_back("/lib/ld-musl-i386.so.1"); ++ break; ++ default: + CmdArgs.push_back("/lib/ld-linux.so.2"); ++ break; ++ } + } else if (ToolChain.getArch() == llvm::Triple::aarch64) CmdArgs.push_back("/lib/ld-linux-aarch64.so.1"); else if (ToolChain.getArch() == llvm::Triple::arm || ToolChain.getArch() == llvm::Triple::thumb) { -@@ -6009,6 +6012,8 @@ void gnutools::Link::ConstructJob(Compilation &C, const JobAction &JA, +- if (ToolChain.getTriple().getEnvironment() == llvm::Triple::GNUEABIHF) ++ switch (ToolChain.getTriple().getEnvironment()) { ++ case llvm::Triple::Musl: ++ case llvm::Triple::MuslEABI: ++ CmdArgs.push_back("/lib/ld-musl-arm.so.3"); ++ break; ++ case llvm::Triple::MuslEABIHF: ++ CmdArgs.push_back("/lib/ld-musl-armhf.so.3"); ++ break; ++ case llvm::Triple::GNUEABIHF: + CmdArgs.push_back("/lib/ld-linux-armhf.so.3"); +- else ++ break; ++ default: + CmdArgs.push_back("/lib/ld-linux.so.3"); ++ break; ++ } + } + else if (ToolChain.getArch() == llvm::Triple::mips || + ToolChain.getArch() == llvm::Triple::mipsel) +@@ -6009,8 +6030,19 @@ else if (ToolChain.getArch() == llvm::Triple::ppc64 || ToolChain.getArch() == llvm::Triple::systemz) CmdArgs.push_back("/lib64/ld64.so.1"); -+ else if (ToolChain.getTriple().getEnvironment() == llvm::Triple::UClibc) -+ CmdArgs.push_back("/lib/ld64-uClibc.so.0.9.32"); - else - CmdArgs.push_back("/lib64/ld-linux-x86-64.so.2"); +- else +- CmdArgs.push_back("/lib64/ld-linux-x86-64.so.2"); ++ else { ++ switch (ToolChain.getTriple().getEnvironment()) { ++ case llvm::Triple::Musl: ++ CmdArgs.push_back("/lib/ld-musl-x86_64.so.1"); ++ break; ++ case llvm::Triple::UClibc: ++ CmdArgs.push_back("/lib/ld64-uClibc.so.0.9.32"); ++ break; ++ default: ++ CmdArgs.push_back("/lib64/ld-linux-x86-64.so.2"); ++ break; ++ } ++ } } + + CmdArgs.push_back("-o"); diff --git a/main/llvm/llvm-musl.patch b/main/llvm/llvm-musl.patch new file mode 100644 index 0000000000..b5a1c09ed9 --- /dev/null +++ b/main/llvm/llvm-musl.patch @@ -0,0 +1,167 @@ +--- a/lib/Support/DynamicLibrary.cpp (revision 170294) ++++ b/lib/Support/DynamicLibrary.cpp (working copy) +@@ -155,7 +155,7 @@ + + // 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 + + // On linux we have a weird situation. The stderr/out/in symbols are both + // macros and global variables because of standards requirements. So, we +--- a/utils/unittest/googletest/gtest.cc (revision 170294) ++++ b/utils/unittest/googletest/gtest.cc (working copy) +@@ -120,6 +120,7 @@ + + #if GTEST_CAN_STREAM_RESULTS_ + # include <arpa/inet.h> // NOLINT ++# include <sys/socket.h> // NOLINT + # include <netdb.h> // NOLINT + #endif + +--- a/include/llvm/Target/TargetLibraryInfo.h ++++ b/include/llvm/Target/TargetLibraryInfo.h +@@ -243,8 +243,6 @@ namespace llvm { + fmodl, + /// FILE *fopen(const char *filename, const char *mode); + fopen, +- /// FILE *fopen64(const char *filename, const char *opentype) +- fopen64, + /// int fprintf(FILE *stream, const char *format, ...); + fprintf, + /// int fputc(int c, FILE *stream); +@@ -267,8 +265,6 @@ namespace llvm { + fseek, + /// int fseeko(FILE *stream, off_t offset, int whence); + fseeko, +- /// int fseeko64(FILE *stream, off64_t offset, int whence) +- fseeko64, + /// int fsetpos(FILE *stream, const fpos_t *pos); + fsetpos, + /// int fstat(int fildes, struct stat *buf); +@@ -283,8 +279,6 @@ namespace llvm { + ftell, + /// off_t ftello(FILE *stream); + ftello, +- /// off64_t ftello64(FILE *stream) +- ftello64, + /// int ftrylockfile(FILE *file); + ftrylockfile, + /// void funlockfile(FILE *file); +@@ -588,8 +582,6 @@ namespace llvm { + times, + /// FILE *tmpfile(void); + tmpfile, +- /// FILE *tmpfile64(void) +- tmpfile64, + /// int toascii(int c); + toascii, + /// double trunc(double x); + +--- a/lib/ExecutionEngine/JIT/JIT.cpp ++++ b/lib/ExecutionEngine/JIT/JIT.cpp +@@ -68,7 +68,7 @@ extern "C" void LLVMLinkInJIT() { + } + + // Determine whether we can register EH tables. +-#if (defined(__GNUC__) && !defined(__ARM_EABI__) && \ ++#if (defined(__GLIBC__) && !defined(__ARM_EABI__) && \ + !defined(__USING_SJLJ_EXCEPTIONS__)) + #define HAVE_EHTABLE_SUPPORT 1 + #else +--- a/lib/Support/Unix/Signals.inc ++++ b/lib/Support/Unix/Signals.inc +@@ -268,7 +268,7 @@ void llvm::sys::AddSignalHandler(void (*FnPtr)(void *), void *Cookie) { + // On glibc systems we have the 'backtrace' function, which works nicely, but + // doesn't demangle symbols. + void llvm::sys::PrintStackTrace(FILE *FD) { +-#if defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACES) ++#if defined(__GLIBC__) && defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACES) + static void* StackTrace[256]; + // Use backtrace() to output a backtrace on Linux systems with glibc. + int depth = backtrace(StackTrace, +--- a/lib/Target/TargetLibraryInfo.cpp ++++ b/lib/Target/TargetLibraryInfo.cpp +@@ -136,7 +136,6 @@ const char* TargetLibraryInfo::StandardNames[LibFunc::NumLibFuncs] = + "fmodf", + "fmodl", + "fopen", +- "fopen64", + "fprintf", + "fputc", + "fputs", +@@ -148,7 +147,6 @@ const char* TargetLibraryInfo::StandardNames[LibFunc::NumLibFuncs] = + "fscanf", + "fseek", + "fseeko", +- "fseeko64", + "fsetpos", + "fstat", + "fstat64", +@@ -156,7 +154,6 @@ const char* TargetLibraryInfo::StandardNames[LibFunc::NumLibFuncs] = + "fstatvfs64", + "ftell", + "ftello", +- "ftello64", + "ftrylockfile", + "funlockfile", + "fwrite", +@@ -306,7 +303,6 @@ const char* TargetLibraryInfo::StandardNames[LibFunc::NumLibFuncs] = + "tanl", + "times", + "tmpfile", +- "tmpfile64", + "toascii", + "trunc", + "truncf", +@@ -566,16 +562,12 @@ static void initialize(TargetLibraryInfo &TLI, const Triple &T, + TLI.setUnavailable(LibFunc::under_IO_getc); + TLI.setUnavailable(LibFunc::under_IO_putc); + TLI.setUnavailable(LibFunc::memalign); +- TLI.setUnavailable(LibFunc::fopen64); +- TLI.setUnavailable(LibFunc::fseeko64); + TLI.setUnavailable(LibFunc::fstat64); + TLI.setUnavailable(LibFunc::fstatvfs64); +- TLI.setUnavailable(LibFunc::ftello64); + TLI.setUnavailable(LibFunc::lstat64); + TLI.setUnavailable(LibFunc::open64); + TLI.setUnavailable(LibFunc::stat64); + TLI.setUnavailable(LibFunc::statvfs64); +- TLI.setUnavailable(LibFunc::tmpfile64); + } + } + +--- a/lib/Transforms/IPO/FunctionAttrs.cpp ++++ b/lib/Transforms/IPO/FunctionAttrs.cpp +@@ -1271,30 +1271,6 @@ bool FunctionAttrs::inferPrototypeAttributes(Function &F) { + setDoesNotCapture(F, 1); + setDoesNotCapture(F, 2); + break; +- case LibFunc::fopen64: +- if (FTy->getNumParams() != 2 || +- !FTy->getReturnType()->isPointerTy() || +- !FTy->getParamType(0)->isPointerTy() || +- !FTy->getParamType(1)->isPointerTy()) +- return false; +- setDoesNotThrow(F); +- setDoesNotAlias(F, 0); +- setDoesNotCapture(F, 1); +- setDoesNotCapture(F, 2); +- break; +- case LibFunc::fseeko64: +- case LibFunc::ftello64: +- if (FTy->getNumParams() == 0 || !FTy->getParamType(0)->isPointerTy()) +- return false; +- setDoesNotThrow(F); +- setDoesNotCapture(F, 1); +- break; +- case LibFunc::tmpfile64: +- if (!FTy->getReturnType()->isPointerTy()) +- return false; +- setDoesNotThrow(F); +- setDoesNotAlias(F, 0); +- break; + case LibFunc::fstat64: + case LibFunc::fstatvfs64: + if (FTy->getNumParams() != 2 || !FTy->getParamType(1)->isPointerTy()) + |