diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2015-05-21 11:37:40 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2015-05-21 11:59:24 +0000 |
commit | eac22325a7d4cf3ca559fa4d3ee2e49f4e879ffd (patch) | |
tree | be9d3da7650e4eeb3ba22c6d0c1cca45ccb51517 /main/llvm | |
parent | 3681f34c0d3bd9b6d30a7817989a862e29ab4fe4 (diff) | |
download | aports-eac22325a7d4cf3ca559fa4d3ee2e49f4e879ffd.tar.bz2 aports-eac22325a7d4cf3ca559fa4d3ee2e49f4e879ffd.tar.xz |
main/llvm: upgrade to 3.6.0
move from testing
fixes #4068
Diffstat (limited to 'main/llvm')
19 files changed, 796 insertions, 297 deletions
diff --git a/main/llvm/APKBUILD b/main/llvm/APKBUILD index 88d4be5a6f..5f2cccae94 100644 --- a/main/llvm/APKBUILD +++ b/main/llvm/APKBUILD @@ -1,48 +1,91 @@ -# Contributor: William Pitcock <nenolod@dereferenced.org> +# Contributor: Travis Tilley <ttilley@gmail.com> # Maintainer: William Pitcock <nenolod@dereferenced.org> pkgname=llvm -pkgver=3.5.1 -pkgrel=0 +pkgver=3.6.0 +pkgrel=1 pkgdesc="low level virtual machine compiler system" -arch="x86 x86_64 armhf" +arch="x86_64 armhf" url="http://llvm.org/" license="UOI-NCSA" -depends= +depends="" depends_dev="perl" -makedepends="$depends_dev groff libffi-dev python chrpath" +makedepends="$depends_dev make flex bison groff libffi-dev zlib-dev ncurses-dev libedit-dev python chrpath" install= -subpackages="clang $pkgname-dev $pkgname-doc $pkgname-libs" +subpackages="clang-libs:clang_libs clang + $pkgname-static $pkgname-dev $pkgname-doc $pkgname-libs" source="http://llvm.org/releases/$pkgver/llvm-$pkgver.src.tar.xz http://llvm.org/releases/$pkgver/cfe-$pkgver.src.tar.xz - llvm-alpine-linux.patch - llvm-musl.patch + http://llvm.org/releases/$pkgver/compiler-rt-$pkgver.src.tar.xz + llvm-3.5-gcc-4.9.patch + llvm-3.6-musl-triple.patch + llvm-3.6-musl.patch + compiler-rt-3.6-musl-disable-sanitizers.patch + compiler-rt-3.6-musl-no-dlvsym.patch + clang-3.5-fix-stdint.patch + clang-3.6-fix-unwind-chain-inclusion.patch + clang-3.6-remove-lgcc-when-using-compiler-rt.patch + clang-3.6-add-alpine-distro.patch + clang-3.6-alpine-use-z-relro.patch + clang-3.6-alpine-hash-style-gnu.patch + clang-3.6-default-runtime-compiler-rt.patch + clang-3.6-musl-alpine-triple.patch + clang-3.6-musl-fix-dynamic-linker-paths.patch + clang-3.6-musl-use-init-array.patch + clang-3.6-musl-no-use-cxa-atexit.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 -# uClibc ABI version (as of uClibc 0.9.33.2, this is 0.9.32) increases. - _builddir="$srcdir"/build + _srcdir="$srcdir"/"$pkgname-$pkgver.src" +_srcdir_clang="$_srcdir"/tools/clang +_srcdir_compiler_rt="$_srcdir"/projects/compiler-rt +# _srcdir_clang_extra="$_srcdir_clang"/tools/extra +# _srcdir_lld="$_srcdir"/tools/lld prepare() { - msg "Preparing CLANG sources..." + msg "Preparing LLVM/CLANG sources..." mv "$srcdir"/cfe-$pkgver.src \ - "$srcdir"/$pkgname-$pkgver.src/tools/clang || return 1 + "$_srcdir_clang" || return 1 + mv "$srcdir"/compiler-rt-$pkgver.src \ + "$_srcdir_compiler_rt" || return 1 + # mv "$srcdir"/clang-tools-extra-$pkgver.src \ + # "$_srcdir_clang_extra" || return 1 + # mv "$srcdir"/lld-$pkgver.src \ + # "$_srcdir_lld" || return 1 msg "Patching LLVM core..." - cd "$srcdir"/$pkgname-$pkgver.src || return 1 + cd "$_srcdir" || return 1 update_config_sub || return 1 for i in $source; do case $i in - *.patch) + llvm*.patch) msg "Applying $i..." patch -s -p1 -N -i "$srcdir"/$i || return 1 ;; esac done - # fails to link - rm ./unittests/Support/formatted_raw_ostream_test.cpp + + msg "Patching compiler-rt..." + cd "$_srcdir_compiler_rt" || return 1 + for i in $source; do + case $i in + compiler-rt*.patch) + msg "Applying $i..." + patch -s -p1 -N -i "$srcdir"/$i || return 1 + ;; + esac + done + + msg "Patching clang..." + cd "$_srcdir_clang" || return 1 + for i in $source; do + case $i in + clang-*.patch) + msg "Applying $i..." + patch -s -p1 -N -i "$srcdir"/$i || return 1 + ;; + esac + done } build() { @@ -55,6 +98,8 @@ build() { ../$pkgname-$pkgver.src/autoconf/config.guess \ || return 1 + export CPPFLAGS="${CPPFLAGS} $(pkg-config --cflags-only-I libffi) $(pkg-config --cflags-only-I libedit)" + $_srcdir/configure \ --build=$CBUILD \ --host=$CHOST \ @@ -62,16 +107,27 @@ build() { --sysconfdir=/etc \ --mandir=/usr/share/man \ --infodir=/usr/share/info \ - --enable-ffi \ --enable-shared \ --enable-optimized \ + --enable-keep-symbols \ + --enable-libedit \ + --enable-terminfo \ + --enable-libffi \ + --enable-clang-plugin-support \ + --enable-clang-static-analyzer \ + --enable-docs \ + --enable-threads \ + --enable-zlib \ + --enable-pic \ + --enable-targets=x86,x86_64,arm,arm64,cpp,r600 \ + --enable-bindings=none \ + --disable-timestamps \ + --disable-assertions \ + --disable-expensive-checks \ + --disable-libcpp \ + --disable-werror \ || return 1 - # configure gets it wrong. We do have error_t - sed -i -e 's/.*undef HAVE_ERROR_T.*/#define HAVE_ERROR_T 1/' \ - -e '/define error_t/d' \ - ./include/llvm/Config/config.h || return 1 - make || return 1 } @@ -83,18 +139,32 @@ package() { mkdir -p "$pkgdir"/usr/share/doc mv "$pkgdir"/usr/docs/llvm "$pkgdir"/usr/share/doc/ || return 1 rmdir "$pkgdir"/usr/docs || return 1 - chrpath -d "$pkgdir"/usr/bin/* "$pkgdir"/usr/lib/*.so + chrpath -d "$pkgdir"/usr/bin/* "$pkgdir"/usr/lib/*.so || return 1 + + # remove erroneously installed example + rm "$pkgdir"/usr/lib/*LLVMHello.* || return 1 + + # remove executable bit from static libc + chmod -x "$pkgdir"/usr/lib/*.a +} + +clang_libs() { + pkgdesc="Runtime library for clang" + mkdir -p "$subpkgdir"/usr/lib + mv "$pkgdir"/usr/lib/libclang.so "$subpkgdir"/usr/lib/ } clang() { pkgdesc="A C language family front-end for LLVM" mkdir -p "$subpkgdir"/usr/bin \ - "$subpkgdir"/usr/lib "$subpkgdir"/usr/share/clang + "$subpkgdir"/usr/lib "$subpkgdir"/usr/share/clang "$subpkgdir"/usr/include mv "$pkgdir"/usr/bin/clang* "$pkgdir"/usr/bin/c-index-test \ "$subpkgdir"/usr/bin/ || return 1 mv "$pkgdir"/usr/lib/clang \ - "$pkgdir"/usr/lib/libclang.so \ "$subpkgdir"/usr/lib/ || return 1 + mv "$pkgdir"/usr/include/clang "$pkgdir"/usr/include/clang-c \ + "$subpkgdir"/usr/include/ || return 1 + cp -r "$_srcdir"/tools/clang/tools/scan-build "$subpkgdir"/usr/share/clang/scan-build cp -r "$_srcdir"/tools/clang/tools/scan-view "$subpkgdir"/usr/share/clang/scan-view @@ -102,21 +172,73 @@ clang() { ln -s /usr/share/clang/scan-view/scan-view "$subpkgdir"/usr/bin/scan-view } +static() { + pkgdesc="LLVM static libraries" + depends= + mkdir -p "$subpkgdir"/usr/lib + mv "$pkgdir"/usr/lib/*.a "$subpkgdir"/usr/lib/ +} + libs() { pkgdesc="LLVM shared libraries" mkdir -p "$subpkgdir"/usr/lib/ mv "$pkgdir"/usr/lib/*.so "$subpkgdir"/usr/lib/ } -md5sums="2d3d8004f38852aa679e5945b8ce0b14 llvm-3.5.1.src.tar.xz -93f9532f8f7e6f1d8e5c1116907051cb cfe-3.5.1.src.tar.xz -6027b00815344fe834e3e3208fc471d9 llvm-alpine-linux.patch -832e665e4972afb94fb6c976a7e35c69 llvm-musl.patch" -sha256sums="bf3275d2d7890015c8d8f5e6f4f882f8cf3bf51967297ebe74111d6d8b53be15 llvm-3.5.1.src.tar.xz -6773f3f9cf815631cc7e779ec134ddd228dc8e9a250e1ea3a910610c59eb8f5c cfe-3.5.1.src.tar.xz -789ae8672503be241ef371933795cee148cbc16c3b633c37344ea7b4aef89189 llvm-alpine-linux.patch -1e4c4d9e2d76719c2fedc6fe1ce03e59a16521bdb2562e84255a82d510a4f894 llvm-musl.patch" -sha512sums="a643ff173627e813b26077829b1af801b75daa5dcea540c4f05366ed57ef6aeafaf8b3fe4208d4c1b303a048a90ddac48a23488480c165637ae9218de140ae55 llvm-3.5.1.src.tar.xz -bd904586f6155c05d2f7ddd05b86c28feae883cdc60e2cb3b48d4ae0ce55916064bcea414a46518d0fb73618f18a3f3fca6cc4cad81083428a2221299f5c5c7f cfe-3.5.1.src.tar.xz -65a74090d6541e105220e79944181dca15aca258178a755ac42b7066277202b59836998a27856bab57cf76200a4e538124a6110ea8bcdc15b0abf2508a6e681d llvm-alpine-linux.patch -e9531f86521628a1f0b73e15da55c6d51c7283a0239bc481b89a73c5195ae605b6680e75cbcd9197b71ceab534082f86e0e4d39701edcbe9195cc01df97285b9 llvm-musl.patch" +md5sums="f1e14e949f8df3047c59816c55278cec llvm-3.6.0.src.tar.xz +e3012065543dc6ab8a9842b09616b78d cfe-3.6.0.src.tar.xz +cc36dbcafe43406083e98bc9e74f8054 compiler-rt-3.6.0.src.tar.xz +178eecb7554f893198716e35245fc3c9 llvm-3.5-gcc-4.9.patch +74f92f6719995be866f461a29a7c8112 llvm-3.6-musl-triple.patch +3068c2bc0dd0f694d002d992743401ac llvm-3.6-musl.patch +b1732677fb7641c13300a98bdd47d467 compiler-rt-3.6-musl-disable-sanitizers.patch +a56d3a3da587b5936e338d85947bd16f compiler-rt-3.6-musl-no-dlvsym.patch +be9b343bacbd220a154b0a773bcd3bd3 clang-3.5-fix-stdint.patch +02df7f41728ceb3b401dd3972531d4ec clang-3.6-fix-unwind-chain-inclusion.patch +9790d1131f498f5957e0107727489704 clang-3.6-remove-lgcc-when-using-compiler-rt.patch +74612f41b5bda8f05be5cf2e59eebd26 clang-3.6-add-alpine-distro.patch +dbf4e6686137d097768e971c0efd4a0b clang-3.6-alpine-use-z-relro.patch +7495743d3c85ad48fd7ab9ca1f674884 clang-3.6-alpine-hash-style-gnu.patch +a26e050907fae3f8ac51375826f9767c clang-3.6-default-runtime-compiler-rt.patch +bf66b2ce06519085484776e40290118a clang-3.6-musl-alpine-triple.patch +28266841c807bd3835186ad32942ac11 clang-3.6-musl-fix-dynamic-linker-paths.patch +b7e213b69c848ad1bcb98a798a2f9d1d clang-3.6-musl-use-init-array.patch +01eb6923bfa059e36ab39f44b2b6f03f clang-3.6-musl-no-use-cxa-atexit.patch" +sha256sums="b39a69e501b49e8f73ff75c9ad72313681ee58d6f430bfad4d81846fe92eb9ce llvm-3.6.0.src.tar.xz +be0e69378119fe26f0f2f74cffe82b7c26da840c9733fe522ed3c1b66b11082d cfe-3.6.0.src.tar.xz +7f49fb79e5adcdce7dddaf973f1db130228dfb19e37a99a7f5365a6948b26b11 compiler-rt-3.6.0.src.tar.xz +96851b9d89647276f4611ea7db59f84240a727b199925ee6c9599f959fc7bd05 llvm-3.5-gcc-4.9.patch +fbe1bab0aa5eb8c54ac1ed0f7d27212efd597c8eaa889599549d0defe82bc7c9 llvm-3.6-musl-triple.patch +f1ca24437533c5022d591b8b9a5ea7f0494e984a5c24ef1e5dcf71dbee0df240 llvm-3.6-musl.patch +d5aa68e35fe3fe0cb2393d3abecd80987c4876f332ca03b55f03bcd82b2b720d compiler-rt-3.6-musl-disable-sanitizers.patch +90a582ef8561ed4953feae7f19f3a30856da845174ae93e7acdb4bc088be5b78 compiler-rt-3.6-musl-no-dlvsym.patch +a41aa73b9edcf0588d61e17e9d53738e9e16209eac9c5488eaef7770ab1517d1 clang-3.5-fix-stdint.patch +2c73e2c6f3e90e2535e0662714645fc4d1189b4b1beb5a0ebb6ba1af62580d23 clang-3.6-fix-unwind-chain-inclusion.patch +dea41fd9eb16d2c3b9b73ad1ee3af2923b26f806185494835c899700ec6830f4 clang-3.6-remove-lgcc-when-using-compiler-rt.patch +4f68d475947eb35515231fdf23dc5a92f656038ca21b0d3d0ea110129b07d313 clang-3.6-add-alpine-distro.patch +ba0dd990424699b92b79c8511143cbf33766e8d2009a979928e9b8229fa3cfba clang-3.6-alpine-use-z-relro.patch +46f4c3c08bee21cc9051181108776f37acc7e9589c85f62dbd6a842b842f5a43 clang-3.6-alpine-hash-style-gnu.patch +8c8295e10453e89d8ae70d709a91f186ea5e279494ab538e28339d9d2efa3ae8 clang-3.6-default-runtime-compiler-rt.patch +da420dda54b0058140a4ade99de49e617c2533857ccb327d95bf51027bb0bcf8 clang-3.6-musl-alpine-triple.patch +03c392733933198adbb3e6cb2eb9ed95e8d01f7d013e3fe2d12a8f1001b73893 clang-3.6-musl-fix-dynamic-linker-paths.patch +03709cff62464ef2afdaa2bfaccf4dffd5d3e20eee561fb94e486a2912d8a6e6 clang-3.6-musl-use-init-array.patch +3d5c097ab1a4e4cfadeeb11aef66a90daaff11095dd3349f25832bedc317cac8 clang-3.6-musl-no-use-cxa-atexit.patch" +sha512sums="ca492b7d86333f05930dc849c7a8beff981da51ca174cd844650b516d0a592a2c3837d5a8a9b62713c0f29292b845f27ef0ec361809e325c6b60cbbcd3f20357 llvm-3.6.0.src.tar.xz +dc137bdf9c2c5adb25498c995f0b944016699267156a595cc1fe6127f6961d45162275023d194db42691d80fa8fc74f56abad9c145ef1ff492881f547ca76cfe cfe-3.6.0.src.tar.xz +2758bc2b78dcfb9b6509b83ebc4ebc86907ca3dc2a5f151f580771c674b934432cae055e342ed73096a08331b2f7b129ff65629b27932458b1877aeb554b6328 compiler-rt-3.6.0.src.tar.xz +a16f175c75893ac58350e0573012a66c1e8908e94a03197ca50b147eb492402e706e4816b80428ccdf92a112673ec8552a0d5dc699dc95250e756c161328d9f2 llvm-3.5-gcc-4.9.patch +a084b995b2ea65c19da5e000459c993d5a3396f0eb4f6d6ec29299d98f3df8ee6f23723f8d19e93ef906861bb83dbba5c05b8cf7801f92c8748b8687247e25d2 llvm-3.6-musl-triple.patch +e3f4203679c978cbf359200de0cd60c0adcc58c92611ec70b4b991c6612e0b41b67c19c9994769302284edb953e258d3717ec32d90abbd9bdeff3739aa5ffb18 llvm-3.6-musl.patch +e9cf172aac82b5e4680d4c6fb25f11e04d1db75ad4e99f7117c08631ca8a7955677fc046f58b6eef05f9e98ef0374eb9248b5674aa26b08d9f7efd30525740be compiler-rt-3.6-musl-disable-sanitizers.patch +8cde42c93a1eda14d31f8e51ffd00d031f10071e9a4ee91fa9b08ef5b8e7bf9ec32ccd102b652e35e6f75d1339d934daa68185529ca6dba74e61f979a27498f3 compiler-rt-3.6-musl-no-dlvsym.patch +764382fc79598ca85c9c500d16e02a2710025416dc9bd8a7407aad38e663dee9539e47a1ae763b45c36cd86c4ff5853c4799835cd7363a3a208191ae7a703321 clang-3.5-fix-stdint.patch +4cbabce34b7352bf5a043db3abe8931f58adce4fda80846c39b63399a025cbbac572052d3f0f598466bc9dca23b8ff88e655b10bf54b3870bc4e6f4225b6f558 clang-3.6-fix-unwind-chain-inclusion.patch +d50aa3271e9247896bd3df5a55c987da81a01892af8afbd0483cff4c0467b2dc438fa9166d1aaeaf5165555c30d4a2af68c3bdbfa8fba798c2ca124172cf2642 clang-3.6-remove-lgcc-when-using-compiler-rt.patch +f5fa5aa1b2a559215792a98806b18b32ce6b82e57afb09aa3886b22f71420c8377b784f55610b4948185e115b39aeeaf1f27625d0d91dbd3b146e4986eb29c54 clang-3.6-add-alpine-distro.patch +61d0113e2287b82d27b4d08ed98e8f2dad864a36a295f9d8a28d54b6b8516ecda2986d402ba04146976e25e35198e12d567df80979c88081369ac386fa213a0f clang-3.6-alpine-use-z-relro.patch +1982e8b84415fa314b040cbecac38640d754105b5af2c26d5aa7ca74d7ef14cc074bf7a5537dc492a7051d8f94035a1d69de2e913eabee7fcd1b50d6f6f126f7 clang-3.6-alpine-hash-style-gnu.patch +b906ff5a59c83e553d67b2574bcd3c22e7975b487ad928f9e0db0a07ffb54c5e412d4527401db63f1de94884410709b4fe637e12d36fa0c0661f69fd88f09c25 clang-3.6-default-runtime-compiler-rt.patch +d2192b615307a762d324a1643dae33bc8a97e22e6a9dd712f9a243c6d3f728c9f9f036ce34d4137c8537651d78332ad8b98fd7f325648ac68e1bda54f5f58348 clang-3.6-musl-alpine-triple.patch +d3f6c97bdfccdab056aef149413108eb1fdf68d10782cdb1a50695a8e2e53432555a73c640ae635c697d41330c7869acc864b9f0fedbb1a4cba6d13785168564 clang-3.6-musl-fix-dynamic-linker-paths.patch +4ae8409f3d03e8b30cbe33be507a43194ff6f3e6ce6467d3341ff08f08b12a22517a4c4b012f1b1029d956f8c486412353d937f316a7648a5be14549555aecae clang-3.6-musl-use-init-array.patch +20cddcf4289bb50bedac2636d32824860252617545d85c5cdc13f630a6f8be2be2a7e018401de4cec0a78bafc1f940ed8d565c2cda518b73290cf3ced4d0807e clang-3.6-musl-no-use-cxa-atexit.patch" diff --git a/main/llvm/clang-3.5-fix-stdint.patch b/main/llvm/clang-3.5-fix-stdint.patch new file mode 100644 index 0000000000..4db83d5b19 --- /dev/null +++ b/main/llvm/clang-3.5-fix-stdint.patch @@ -0,0 +1,29 @@ +diff --git a/lib/Headers/stdint.h b/lib/Headers/stdint.h +index 0303db9..8ca28df 100644 +--- a/lib/Headers/stdint.h ++++ b/lib/Headers/stdint.h +@@ -22,8 +22,6 @@ + * + \*===----------------------------------------------------------------------===*/ + +-#ifndef __CLANG_STDINT_H +-#define __CLANG_STDINT_H + + /* If we're hosted, fall back to the system's stdint.h, which might have + * additional definitions. +@@ -72,6 +70,8 @@ + # endif + + #else ++#ifndef __CLANG_STDINT_H ++#define __CLANG_STDINT_H + + /* C99 7.18.1.1 Exact-width integer types. + * C99 7.18.1.2 Minimum-width integer types. +@@ -703,5 +703,5 @@ typedef __UINTMAX_TYPE__ uintmax_t; + #define INTMAX_C(v) __INTN_C(__INTMAX_WIDTH__, v) + #define UINTMAX_C(v) __UINTN_C(__INTMAX_WIDTH__, v) + +-#endif /* __STDC_HOSTED__ */ + #endif /* __CLANG_STDINT_H */ ++#endif /* __STDC_HOSTED__ */ diff --git a/main/llvm/clang-3.6-add-alpine-distro.patch b/main/llvm/clang-3.6-add-alpine-distro.patch new file mode 100644 index 0000000000..9b959d335d --- /dev/null +++ b/main/llvm/clang-3.6-add-alpine-distro.patch @@ -0,0 +1,34 @@ +diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp +index f789fd5..6d75b4b 100644 +--- a/lib/Driver/ToolChains.cpp ++++ b/lib/Driver/ToolChains.cpp +@@ -2667,12 +2673,13 @@ Tool *Solaris::buildLinker() const { + return new tools::solaris::Link(*this); + } + + /// Distribution (very bare-bones at the moment). + + enum Distro { ++ AlpineLinux, + ArchLinux, + DebianLenny, + DebianSqueeze, + DebianWheezy, + DebianJessie, + Exherbo, +@@ -2778,12 +2785,15 @@ static Distro DetectDistro(llvm::Triple::ArchType Arch) { + if (llvm::sys::fs::exists("/etc/exherbo-release")) + return Exherbo; + + if (llvm::sys::fs::exists("/etc/arch-release")) + return ArchLinux; + ++ if (llvm::sys::fs::exists("/etc/alpine-release")) ++ return AlpineLinux; ++ + return UnknownDistro; + } + + /// \brief Get our best guess at the multiarch triple for a target. + /// + /// Debian-based systems are starting to use a multiarch setup where they use diff --git a/main/llvm/clang-3.6-alpine-hash-style-gnu.patch b/main/llvm/clang-3.6-alpine-hash-style-gnu.patch new file mode 100644 index 0000000000..ee1f7c0f31 --- /dev/null +++ b/main/llvm/clang-3.6-alpine-hash-style-gnu.patch @@ -0,0 +1,12 @@ +diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp +index efa9541..1c6a6d5 100644 +--- a/lib/Driver/ToolChains.cpp ++++ b/lib/Driver/ToolChains.cpp +@@ -2963,7 +2963,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) + // ABI requires a mapping between the GOT and the symbol table. + // Android loader does not support .gnu.hash. + if (!IsMips && !IsAndroid) { +- if (IsRedhat(Distro) || IsOpenSUSE(Distro) || ++ if (IsRedhat(Distro) || IsOpenSUSE(Distro) || Distro == AlpineLinux || + (IsUbuntu(Distro) && Distro >= UbuntuMaverick)) + ExtraOpts.push_back("--hash-style=gnu"); diff --git a/main/llvm/clang-3.6-alpine-use-z-relro.patch b/main/llvm/clang-3.6-alpine-use-z-relro.patch new file mode 100644 index 0000000000..bd7cea08c8 --- /dev/null +++ b/main/llvm/clang-3.6-alpine-use-z-relro.patch @@ -0,0 +1,19 @@ +diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp +index f789fd5..6d75b4b 100644 +--- a/lib/Driver/ToolChains.cpp ++++ b/lib/Driver/ToolChains.cpp +@@ -2930,13 +2940,13 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) + GCCInstallation.getTriple().str() + "/bin").str()); + + Linker = GetLinkerPath(); + + Distro Distro = DetectDistro(Arch); + +- if (IsOpenSUSE(Distro) || IsUbuntu(Distro)) { ++ if (IsOpenSUSE(Distro) || IsUbuntu(Distro) || Distro == AlpineLinux) { + ExtraOpts.push_back("-z"); + ExtraOpts.push_back("relro"); + } + + if (Arch == llvm::Triple::arm || Arch == llvm::Triple::thumb) + ExtraOpts.push_back("-X"); diff --git a/main/llvm/clang-3.6-default-runtime-compiler-rt.patch b/main/llvm/clang-3.6-default-runtime-compiler-rt.patch new file mode 100644 index 0000000000..f4bf20cf9b --- /dev/null +++ b/main/llvm/clang-3.6-default-runtime-compiler-rt.patch @@ -0,0 +1,27 @@ +diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp +index 1c6a6d5..7377f72 100644 +--- a/lib/Driver/ToolChains.cpp ++++ b/lib/Driver/ToolChains.cpp +@@ -3395,6 +3395,10 @ void Linux::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs, + } + } + ++ToolChain::RuntimeLibType Linux::GetDefaultRuntimeLibType() const { ++ return ToolChain::RLT_CompilerRT; ++} ++ + bool Linux::isPIEDefault() const { + return getSanitizerArgs().requiresPIE(); + } +diff --git a/lib/Driver/ToolChains.h b/lib/Driver/ToolChains.h +index 47fb10d..88aee51 100644 +--- a/lib/Driver/ToolChains.h ++++ b/lib/Driver/ToolChains.h +@@ -640,6 +640,7 @@ public: + void + AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs, + llvm::opt::ArgStringList &CC1Args) const override; ++ RuntimeLibType GetDefaultRuntimeLibType() const override; + bool isPIEDefault() const override; + + std::string Linker; diff --git a/main/llvm/clang-3.6-fix-unwind-chain-inclusion.patch b/main/llvm/clang-3.6-fix-unwind-chain-inclusion.patch new file mode 100644 index 0000000000..2ead52f0a6 --- /dev/null +++ b/main/llvm/clang-3.6-fix-unwind-chain-inclusion.patch @@ -0,0 +1,33 @@ +diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h +index 90aca16..ef96969 100644 +--- a/lib/Headers/unwind.h ++++ b/lib/Headers/unwind.h +@@ -23,9 +23,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, +@@ -53,6 +50,9 @@ + # endif + #else + ++#ifndef __CLANG_UNWIND_H ++#define __CLANG_UNWIND_H ++ + #include <stdint.h> + + #ifdef __cplusplus +@@ -277,6 +277,7 @@ _Unwind_Ptr _Unwind_GetTextRelBase(struct _Unwind_Context *); + } + #endif + ++#endif /* __CLANG_UNWIND_H */ ++ + #endif + +-#endif /* __CLANG_UNWIND_H */ diff --git a/main/llvm/clang-3.6-musl-alpine-triple.patch b/main/llvm/clang-3.6-musl-alpine-triple.patch new file mode 100644 index 0000000000..86cf2a4788 --- /dev/null +++ b/main/llvm/clang-3.6-musl-alpine-triple.patch @@ -0,0 +1,46 @@ +diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp +index f789fd5..6d75b4b 100644 +--- a/lib/Driver/ToolChains.cpp ++++ b/lib/Driver/ToolChains.cpp +@@ -1293,33 +1293,38 @@ bool Generic_GCC::GCCInstallationDetector::getBiarchSibling(Multilib &M) const { + "aarch64_be-linux-gnu" }; + + static const char *const ARMLibDirs[] = { "/lib" }; + static const char *const ARMTriples[] = { "arm-linux-gnueabi", + "arm-linux-androideabi" }; + static const char *const ARMHFTriples[] = { "arm-linux-gnueabihf", +- "armv7hl-redhat-linux-gnueabi" }; ++ "armv7hl-redhat-linux-gnueabi", ++ "armv6-alpine-linux-musleabihf", ++ "armv7-alpine-linux-musleabihf"}; + static const char *const ARMebLibDirs[] = { "/lib" }; + static const char *const ARMebTriples[] = { "armeb-linux-gnueabi", + "armeb-linux-androideabi" }; + static const char *const ARMebHFTriples[] = { "armeb-linux-gnueabihf", + "armebv7hl-redhat-linux-gnueabi" }; + + static const char *const X86_64LibDirs[] = { "/lib64", "/lib" }; + static const char *const X86_64Triples[] = { + "x86_64-linux-gnu", "x86_64-unknown-linux-gnu", "x86_64-pc-linux-gnu", + "x86_64-redhat-linux6E", "x86_64-redhat-linux", "x86_64-suse-linux", + "x86_64-manbo-linux-gnu", "x86_64-linux-gnu", "x86_64-slackware-linux", +- "x86_64-linux-android", "x86_64-unknown-linux" ++ "x86_64-linux-android", "x86_64-alpine-linux-musl", "x86_64-pc-linux-musl", ++ "x86_64-unknown-linux" + }; + static const char *const X32LibDirs[] = { "/libx32" }; + static const char *const X86LibDirs[] = { "/lib32", "/lib" }; + static const char *const X86Triples[] = { + "i686-linux-gnu", "i686-pc-linux-gnu", "i486-linux-gnu", "i386-linux-gnu", + "i386-redhat-linux6E", "i686-redhat-linux", "i586-redhat-linux", + "i386-redhat-linux", "i586-suse-linux", "i486-slackware-linux", +- "i686-montavista-linux", "i686-linux-android", "i586-linux-gnu" ++ "i686-montavista-linux", "i686-linux-android", "i586-linux-gnu", ++ "i486-alpine-linux-musl", "i486-pc-linux-musl", ++ "i686-alpine-linux-musl", "i686-pc-linux-musl" + }; + + static const char *const MIPSLibDirs[] = { "/lib" }; + static const char *const MIPSTriples[] = { "mips-linux-gnu", + "mips-mti-linux-gnu", + "mips-img-linux-gnu" }; diff --git a/main/llvm/clang-3.6-musl-fix-dynamic-linker-paths.patch b/main/llvm/clang-3.6-musl-fix-dynamic-linker-paths.patch new file mode 100644 index 0000000000..27c17728ce --- /dev/null +++ b/main/llvm/clang-3.6-musl-fix-dynamic-linker-paths.patch @@ -0,0 +1,58 @@ +diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp +index 75eef9e..3e71522 100644 +--- a/lib/Driver/Tools.cpp ++++ b/lib/Driver/Tools.cpp +@@ -7282,8 +7282,14 @@ static std::string getLinuxDynamicLinker(const ArgList &Args, + return "/system/bin/linker64"; + else + return "/system/bin/linker"; +- } else if (ToolChain.getArch() == llvm::Triple::x86 || +- ToolChain.getArch() == llvm::Triple::sparc) ++ } else if (ToolChain.getArch() == llvm::Triple::x86) { ++ switch (ToolChain.getTriple().getEnvironment()) { ++ case llvm::Triple::Musl: ++ return "/lib/ld-musl-i386.so.1"; ++ default: ++ return "/lib/ld-linux.so.2"; ++ } ++ } else if (ToolChain.getArch() == llvm::Triple::sparc) + return "/lib/ld-linux.so.2"; + else if (ToolChain.getArch() == llvm::Triple::aarch64) + return "/lib/ld-linux-aarch64.so.1"; +@@ -7291,10 +7297,17 @@ static std::string getLinuxDynamicLinker(const ArgList &Args, + return "/lib/ld-linux-aarch64_be.so.1"; + else if (ToolChain.getArch() == llvm::Triple::arm || + ToolChain.getArch() == llvm::Triple::thumb) { +- if (ToolChain.getTriple().getEnvironment() == llvm::Triple::GNUEABIHF) ++ switch (ToolChain.getTriple().getEnvironment()) { ++ case llvm::Triple::Musl: ++ case llvm::Triple::MuslEABI: ++ return "/lib/ld-musl-arm.so.3"; ++ case llvm::Triple::MuslEABIHF: ++ return "/lib/ld-musl-armhf.so.3"; ++ case llvm::Triple::GNUEABIHF: + return "/lib/ld-linux-armhf.so.3"; +- else ++ default: + return "/lib/ld-linux.so.3"; ++ } + } else if (ToolChain.getArch() == llvm::Triple::armeb || + ToolChain.getArch() == llvm::Triple::thumbeb) { + if (ToolChain.getTriple().getEnvironment() == llvm::Triple::GNUEABIHF) +@@ -7339,8 +7352,14 @@ static std::string getLinuxDynamicLinker(const ArgList &Args, + else if (ToolChain.getArch() == llvm::Triple::x86_64 && + ToolChain.getTriple().getEnvironment() == llvm::Triple::GNUX32) + return "/libx32/ld-linux-x32.so.2"; +- else +- return "/lib64/ld-linux-x86-64.so.2"; ++ else { ++ switch (ToolChain.getTriple().getEnvironment()) { ++ case llvm::Triple::Musl: ++ return "/lib/ld-musl-x86_64.so.1"; ++ default: ++ return "/lib64/ld-linux-x86-64.so.2"; ++ } ++ } + } + + static void AddRunTimeLibs(const ToolChain &TC, const Driver &D, diff --git a/main/llvm/clang-3.6-musl-no-use-cxa-atexit.patch b/main/llvm/clang-3.6-musl-no-use-cxa-atexit.patch new file mode 100644 index 0000000000..d1c23b0992 --- /dev/null +++ b/main/llvm/clang-3.6-musl-no-use-cxa-atexit.patch @@ -0,0 +1,14 @@ +diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp +index 08e4439..4e5a594 100644 +--- a/lib/Driver/Tools.cpp ++++ b/lib/Driver/Tools.cpp +@@ -3978,7 +3978,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, + options::OPT_fno_use_cxa_atexit, + !IsWindowsCygnus && !IsWindowsGNU && + getToolChain().getArch() != llvm::Triple::hexagon && +- getToolChain().getArch() != llvm::Triple::xcore) || ++ getToolChain().getArch() != llvm::Triple::xcore && ++ getToolChain().getTriple().getEnvironment() != llvm::Triple::Musl) || + KernelOrKext) + CmdArgs.push_back("-fno-use-cxa-atexit"); + diff --git a/main/llvm/clang-3.6-musl-use-init-array.patch b/main/llvm/clang-3.6-musl-use-init-array.patch new file mode 100644 index 0000000000..ae632aabf9 --- /dev/null +++ b/main/llvm/clang-3.6-musl-use-init-array.patch @@ -0,0 +1,20 @@ +diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp +index f789fd5..6d75b4b 100644 +--- a/lib/Driver/ToolChains.cpp ++++ b/lib/Driver/ToolChains.cpp +@@ -2080,13 +2085,14 @@ void Generic_ELF::addClangTargetOptions(const ArgList &DriverArgs, + const Generic_GCC::GCCVersion &V = GCCInstallation.getVersion(); + bool UseInitArrayDefault = + getTriple().getArch() == llvm::Triple::aarch64 || + getTriple().getArch() == llvm::Triple::aarch64_be || + (getTriple().getOS() == llvm::Triple::Linux && + (!V.isOlderThan(4, 7, 0) || +- getTriple().getEnvironment() == llvm::Triple::Android)); ++ getTriple().getEnvironment() == llvm::Triple::Android || ++ getTriple().getEnvironment() == llvm::Triple::Musl)); + + if (DriverArgs.hasFlag(options::OPT_fuse_init_array, + options::OPT_fno_use_init_array, + UseInitArrayDefault)) + CC1Args.push_back("-fuse-init-array"); + } diff --git a/main/llvm/clang-3.6-remove-lgcc-when-using-compiler-rt.patch b/main/llvm/clang-3.6-remove-lgcc-when-using-compiler-rt.patch new file mode 100644 index 0000000000..15cfe2f8ae --- /dev/null +++ b/main/llvm/clang-3.6-remove-lgcc-when-using-compiler-rt.patch @@ -0,0 +1,29 @@ +diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp +index 75eef9e..08e4439 100644 +--- a/lib/Driver/Tools.cpp ++++ b/lib/Driver/Tools.cpp +@@ -2154,18 +2154,18 @@ static SmallString<128> getCompilerRT(const ToolChain &TC, StringRef Component, + // FIXME: Make sure we can also emit shared objects if they're requested + // and available, check for possible errors, etc. + static void addClangRT(const ToolChain &TC, const ArgList &Args, + ArgStringList &CmdArgs) { + CmdArgs.push_back(Args.MakeArgString(getCompilerRT(TC, "builtins"))); + +- if (!TC.getTriple().isOSWindows()) { +- // FIXME: why do we link against gcc when we are using compiler-rt? +- CmdArgs.push_back("-lgcc_s"); +- if (TC.getDriver().CCCIsCXX()) +- CmdArgs.push_back("-lgcc_eh"); +- } ++ // if (!TC.getTriple().isOSWindows()) { ++ // // FIXME: why do we link against gcc when we are using compiler-rt? ++ // CmdArgs.push_back("-lgcc_s"); ++ // if (TC.getDriver().CCCIsCXX()) ++ // CmdArgs.push_back("-lgcc_eh"); ++ // } + } + + static void addProfileRT(const ToolChain &TC, const ArgList &Args, + ArgStringList &CmdArgs) { + if (!(Args.hasFlag(options::OPT_fprofile_arcs, options::OPT_fno_profile_arcs, + false) || diff --git a/main/llvm/compiler-rt-3.6-musl-disable-sanitizers.patch b/main/llvm/compiler-rt-3.6-musl-disable-sanitizers.patch new file mode 100644 index 0000000000..c37490ca3f --- /dev/null +++ b/main/llvm/compiler-rt-3.6-musl-disable-sanitizers.patch @@ -0,0 +1,34 @@ +Unfortunately, the sanitizer functionality depends on a variety of GNU +extensions and headers that simply don't exist on a musl based system. Fixing +this would be a fairly complicated task, though some inspiration could be taken +from dpkg's static 'libcompat' approach of supplying equivalent functionality +that might be missing. A task for another day perhaps. + +diff --git a/lib/Makefile.mk b/lib/Makefile.mk +index ed9690d..aacb2b1 100644 +--- a/lib/Makefile.mk ++++ b/lib/Makefile.mk +@@ -7,16 +7,16 @@ + # + #===------------------------------------------------------------------------===# + + SubDirs := + + # Add submodules. +-SubDirs += asan ++# SubDirs += asan + SubDirs += builtins +-SubDirs += dfsan ++# SubDirs += dfsan + SubDirs += interception +-SubDirs += lsan +-SubDirs += msan ++# SubDirs += lsan ++# SubDirs += msan + SubDirs += profile +-SubDirs += sanitizer_common +-SubDirs += tsan +-SubDirs += ubsan ++# SubDirs += sanitizer_common ++# SubDirs += tsan ++# SubDirs += ubsan diff --git a/main/llvm/compiler-rt-3.6-musl-no-dlvsym.patch b/main/llvm/compiler-rt-3.6-musl-no-dlvsym.patch new file mode 100644 index 0000000000..444f4e073b --- /dev/null +++ b/main/llvm/compiler-rt-3.6-musl-no-dlvsym.patch @@ -0,0 +1,19 @@ +diff --git a/lib/interception/interception_linux.cc b/lib/interception/interception_linux.cc +index 6e908ac..7fcf2a6 100644 +--- a/lib/interception/interception_linux.cc ++++ b/lib/interception/interception_linux.cc +@@ -21,13 +21,13 @@ namespace __interception { + bool GetRealFunctionAddress(const char *func_name, uptr *func_addr, + uptr real, uptr wrapper) { + *func_addr = (uptr)dlsym(RTLD_NEXT, func_name); + return real == wrapper; + } + +-#if !defined(__ANDROID__) // android does not have dlvsym ++#if 0 // !defined(__ANDROID__) // android does not have dlvsym + void *GetFuncAddrVer(const char *func_name, const char *ver) { + return dlvsym(RTLD_NEXT, func_name, ver); + } + #endif // !defined(__ANDROID__) + + } // namespace __interception diff --git a/main/llvm/llvm-3.5-gcc-4.9.patch b/main/llvm/llvm-3.5-gcc-4.9.patch new file mode 100644 index 0000000000..f60c4df723 --- /dev/null +++ b/main/llvm/llvm-3.5-gcc-4.9.patch @@ -0,0 +1,43 @@ +commit 080fb498017d17af2e4d7563608c7d8a848f20da +Author: Sanjoy Das <sanjoy at azulsystems.com> +Date: Thu Jun 19 15:38:02 2014 -0700 + + Fix the --enable-shared build. + + Currently a build configured with ./configure --enable-shared breaks + with an undefined "llvm::cl::parser<llvm::PassInfo + const*>::getOption(unsigned int) const" symbol when linking opt. This + body for this symbol gets emitted into Pass.o (along with the destructor + for PassNameParser), but gets linked into libLLVM-3.5svn.so with local + visibility, causing the link error. + + This fix uses the existing EXTERN_TEMPLATE machinery to force a globally + visible definition for the functions in parser<const PassInfo *> into + Pass.o. + +diff --git a/include/llvm/IR/LegacyPassNameParser.h b/include/llvm/IR/LegacyPassNameParser.h +index e2e4912..a07e3fd 100644 +--- a/include/llvm/IR/LegacyPassNameParser.h ++++ b/include/llvm/IR/LegacyPassNameParser.h +@@ -95,6 +95,8 @@ private: + } + }; + ++EXTERN_TEMPLATE_INSTANTIATION(class cl::parser<const PassInfo *>); ++ + ///===----------------------------------------------------------------------===// + /// FilteredPassNameParser class - Make use of the pass registration + /// mechanism to automatically add a command line argument to opt for +diff --git a/lib/IR/Pass.cpp b/lib/IR/Pass.cpp +index 91d86ae..00ce223 100644 +--- a/lib/IR/Pass.cpp ++++ b/lib/IR/Pass.cpp +@@ -234,6 +234,8 @@ PassNameParser::~PassNameParser() { + // attempting to remove the registration listener is an error. + } + ++TEMPLATE_INSTANTIATION(class cl::parser<const PassInfo *>); ++ + //===----------------------------------------------------------------------===// + // AnalysisUsage Class Implementation + // diff --git a/main/llvm/llvm-3.6-musl-triple.patch b/main/llvm/llvm-3.6-musl-triple.patch new file mode 100644 index 0000000000..08919c680e --- /dev/null +++ b/main/llvm/llvm-3.6-musl-triple.patch @@ -0,0 +1,107 @@ +diff --git a/include/llvm/ADT/Triple.h b/include/llvm/ADT/Triple.h +index 8a68599..072623c 100644 +--- a/include/llvm/ADT/Triple.h ++++ b/include/llvm/ADT/Triple.h +@@ -151,12 +151,16 @@ public: + GNUX32, + CODE16, + EABI, + EABIHF, + Android, + ++ Musl, ++ MuslEABI, ++ MuslEABIHF, ++ + MSVC, + Itanium, + Cygnus, + }; + enum ObjectFormatType { + UnknownObjectFormat, +diff --git a/lib/Support/Triple.cpp b/lib/Support/Triple.cpp +index 0838e90..4be78e5 100644 +--- a/lib/Support/Triple.cpp ++++ b/lib/Support/Triple.cpp +@@ -172,12 +172,15 @@ const char *Triple::getEnvironmentTypeName(EnvironmentType Kind) { + case GNUEABIHF: return "gnueabihf"; + case GNUEABI: return "gnueabi"; + case GNUX32: return "gnux32"; + case CODE16: return "code16"; + case EABI: return "eabi"; + case EABIHF: return "eabihf"; ++ case Musl: return "musl"; ++ case MuslEABIHF: return "musleabihf"; ++ case MuslEABI: return "musleabi"; + case Android: return "android"; + case MSVC: return "msvc"; + case Itanium: return "itanium"; + case Cygnus: return "cygnus"; + } + +@@ -372,12 +375,15 @@ static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName) { + .StartsWith("gnueabihf", Triple::GNUEABIHF) + .StartsWith("gnueabi", Triple::GNUEABI) + .StartsWith("gnux32", Triple::GNUX32) + .StartsWith("code16", Triple::CODE16) + .StartsWith("gnu", Triple::GNU) + .StartsWith("android", Triple::Android) ++ .StartsWith("musleabihf", Triple::MuslEABIHF) ++ .StartsWith("musleabi", Triple::MuslEABI) ++ .StartsWith("musl", Triple::Musl) + .StartsWith("msvc", Triple::MSVC) + .StartsWith("itanium", Triple::Itanium) + .StartsWith("cygnus", Triple::Cygnus) + .Default(Triple::UnknownEnvironment); + } + + +diff --git a/lib/Target/ARM/ARMSubtarget.h b/lib/Target/ARM/ARMSubtarget.h +index dbacd4d..c81e620 100644 +--- a/lib/Target/ARM/ARMSubtarget.h ++++ b/lib/Target/ARM/ARMSubtarget.h +@@ -366,22 +366,25 @@ public: + + // ARM Targets that support EHABI exception handling standard + // Darwin uses SjLj. Other targets might need more checks. + bool isTargetEHABICompatible() const { + return (TargetTriple.getEnvironment() == Triple::EABI || + TargetTriple.getEnvironment() == Triple::GNUEABI || ++ TargetTriple.getEnvironment() == Triple::MuslEABI || + TargetTriple.getEnvironment() == Triple::EABIHF || + TargetTriple.getEnvironment() == Triple::GNUEABIHF || ++ TargetTriple.getEnvironment() == Triple::MuslEABIHF || + TargetTriple.getEnvironment() == Triple::Android) && + !isTargetDarwin() && !isTargetWindows(); + } + + bool isTargetHardFloat() const { + // FIXME: this is invalid for WindowsCE + return TargetTriple.getEnvironment() == Triple::GNUEABIHF || + TargetTriple.getEnvironment() == Triple::EABIHF || ++ TargetTriple.getEnvironment() == Triple::MuslEABIHF || + isTargetWindows(); + } + bool isTargetAndroid() const { + return TargetTriple.getEnvironment() == Triple::Android; + } + +diff --git a/lib/Target/ARM/ARMTargetMachine.cpp b/lib/Target/ARM/ARMTargetMachine.cpp +index 7a8181b..ce5ceb9 100644 +--- a/lib/Target/ARM/ARMTargetMachine.cpp ++++ b/lib/Target/ARM/ARMTargetMachine.cpp +@@ -84,12 +84,14 @@ computeTargetABI(const Triple &TT, StringRef CPU, + switch (TT.getEnvironment()) { + case llvm::Triple::Android: + case llvm::Triple::GNUEABI: + case llvm::Triple::GNUEABIHF: + case llvm::Triple::EABIHF: + case llvm::Triple::EABI: ++ case llvm::Triple::MuslEABI: ++ case llvm::Triple::MuslEABIHF: + TargetABI = ARMBaseTargetMachine::ARM_ABI_AAPCS; + break; + case llvm::Triple::GNU: + TargetABI = ARMBaseTargetMachine::ARM_ABI_APCS; + break; + default: diff --git a/main/llvm/llvm-3.6-musl.patch b/main/llvm/llvm-3.6-musl.patch new file mode 100644 index 0000000000..ba3c49f785 --- /dev/null +++ b/main/llvm/llvm-3.6-musl.patch @@ -0,0 +1,110 @@ +diff --git a/include/llvm/Target/TargetLibraryInfo.h b/include/llvm/Target/TargetLibraryInfo.h +index 46f87b9..41ac5fd 100644 +--- a/include/llvm/Target/TargetLibraryInfo.h ++++ b/include/llvm/Target/TargetLibraryInfo.h +@@ -10,12 +10,21 @@ + #ifndef LLVM_TARGET_TARGETLIBRARYINFO_H + #define LLVM_TARGET_TARGETLIBRARYINFO_H + + #include "llvm/ADT/DenseMap.h" + #include "llvm/Pass.h" + ++#undef fopen64 ++#undef fseeko64 ++#undef fstat64 ++#undef fstatvfs64 ++#undef ftello64 ++#undef lstat64 ++#undef stat64 ++#undef tmpfile64 ++ + namespace llvm { + class Triple; + + namespace LibFunc { + enum Func { + /// int _IO_getc(_IO_FILE * __fp); +diff --git a/lib/Support/DynamicLibrary.cpp b/lib/Support/DynamicLibrary.cpp +index d2b551e..4634a13 100644 +--- a/lib/Support/DynamicLibrary.cpp ++++ b/lib/Support/DynamicLibrary.cpp +@@ -135,13 +135,13 @@ void* DynamicLibrary::SearchForAddressOfSymbol(const char *symbolName) { + + if (void *Result = llvm::SearchForAddressOfSpecialSymbol(symbolName)) + return Result; + + // 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 + // boldly use the EXPLICIT_SYMBOL macro without checking for a #define first. + #if defined(__linux__) and !defined(__ANDROID__) + { +diff --git a/lib/Support/Unix/Signals.inc b/lib/Support/Unix/Signals.inc +index e8f4643..8a320ef 100644 +--- a/lib/Support/Unix/Signals.inc ++++ b/lib/Support/Unix/Signals.inc +@@ -413,13 +413,13 @@ static bool printSymbolizedStackTrace(void **StackTrace, int Depth, FILE *FD) { + // PrintStackTrace - In the case of a program crash or fault, print out a stack + // trace so that the user has an indication of why and where we died. + // + // 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, + static_cast<int>(array_lengthof(StackTrace))); + if (printSymbolizedStackTrace(StackTrace, depth, FD)) + return; +diff --git a/lib/Target/TargetLibraryInfo.cpp b/lib/Target/TargetLibraryInfo.cpp +index c0abdbd..ed908f8 100644 +--- a/lib/Target/TargetLibraryInfo.cpp ++++ b/lib/Target/TargetLibraryInfo.cpp +@@ -661,20 +661,21 @@ static void initialize(TargetLibraryInfo &TLI, const Triple &T, + break; + default: + TLI.setUnavailable(LibFunc::ffsll); + } + + // The following functions are available on at least Linux: +- if (!T.isOSLinux()) { ++ if (!T.isOSLinux()) ++ TLI.setUnavailable(LibFunc::memalign); ++ if (1 /*!T.isGlibc()*/) { + TLI.setUnavailable(LibFunc::dunder_strdup); + TLI.setUnavailable(LibFunc::dunder_strtok_r); + TLI.setUnavailable(LibFunc::dunder_isoc99_scanf); + TLI.setUnavailable(LibFunc::dunder_isoc99_sscanf); + 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); +diff --git a/utils/unittest/googletest/src/gtest.cc b/utils/unittest/googletest/src/gtest.cc +index bf850c6..9e9088c 100644 +--- a/utils/unittest/googletest/src/gtest.cc ++++ b/utils/unittest/googletest/src/gtest.cc +@@ -117,12 +117,13 @@ + #if GTEST_HAS_EXCEPTIONS + # include <stdexcept> + #endif + + #if GTEST_CAN_STREAM_RESULTS_ + # include <arpa/inet.h> // NOLINT ++# include <sys/socket.h> // NOLINT + # include <netdb.h> // NOLINT + #endif + + // Indicates that this translation unit is part of Google Test's + // implementation. It must come before gtest-internal-inl.h is + // included, or there will be a compiler error. This trick is to diff --git a/main/llvm/llvm-alpine-linux.patch b/main/llvm/llvm-alpine-linux.patch deleted file mode 100644 index d096916731..0000000000 --- a/main/llvm/llvm-alpine-linux.patch +++ /dev/null @@ -1,182 +0,0 @@ -diff -ru llvm-3.5.0.src.orig/include/llvm/ADT/Triple.h llvm-3.5.0.src/include/llvm/ADT/Triple.h ---- llvm-3.5.0.src.orig/include/llvm/ADT/Triple.h 2014-07-18 17:28:19.000000000 -0300 -+++ llvm-3.5.0.src/include/llvm/ADT/Triple.h 2014-11-12 14:44:41.738448045 -0200 -@@ -149,6 +149,10 @@ - EABIHF, - Android, - -+ Musl, -+ MuslEABI, -+ MuslEABIHF, -+ - MSVC, - Itanium, - Cygnus, -Only in llvm-3.5.0.src/include/llvm/ADT: Triple.h.orig -diff -ru llvm-3.5.0.src.orig/lib/Support/Triple.cpp llvm-3.5.0.src/lib/Support/Triple.cpp ---- llvm-3.5.0.src.orig/lib/Support/Triple.cpp 2014-07-18 17:28:19.000000000 -0300 -+++ llvm-3.5.0.src/lib/Support/Triple.cpp 2014-11-12 14:47:06.565122146 -0200 -@@ -168,6 +168,9 @@ - case CODE16: return "code16"; - case EABI: return "eabi"; - case EABIHF: return "eabihf"; -+ case Musl: return "musl"; -+ case MuslEABI: return "musleabi"; -+ case MuslEABIHF: return "musleabihf"; - case Android: return "android"; - case MSVC: return "msvc"; - case Itanium: return "itanium"; -@@ -344,6 +347,9 @@ - .StartsWith("gnux32", Triple::GNUX32) - .StartsWith("code16", Triple::CODE16) - .StartsWith("gnu", Triple::GNU) -+ .StartsWith("musl", Triple::Musl) -+ .StartsWith("musleabi", Triple::MuslEABI) -+ .StartsWith("musleabihf", Triple::MuslEABIHF) - .StartsWith("android", Triple::Android) - .StartsWith("msvc", Triple::MSVC) - .StartsWith("itanium", Triple::Itanium) -Only in llvm-3.5.0.src/lib/Support: Triple.cpp.orig -diff -ru llvm-3.5.0.src.orig/lib/Target/ARM/ARMSubtarget.cpp llvm-3.5.0.src/lib/Target/ARM/ARMSubtarget.cpp ---- llvm-3.5.0.src.orig/lib/Target/ARM/ARMSubtarget.cpp 2014-07-16 23:13:31.000000000 -0300 -+++ llvm-3.5.0.src/lib/Target/ARM/ARMSubtarget.cpp 2014-11-12 14:50:40.025133104 -0200 -@@ -273,6 +273,8 @@ - case Triple::EABIHF: - case Triple::GNUEABI: - case Triple::GNUEABIHF: -+ case Triple::MuslEABI: -+ case Triple::MuslEABIHF: - TargetABI = ARM_ABI_AAPCS; - break; - default: -diff -ru llvm-3.5.0.src.orig/lib/Target/ARM/ARMSubtarget.h llvm-3.5.0.src/lib/Target/ARM/ARMSubtarget.h ---- llvm-3.5.0.src.orig/lib/Target/ARM/ARMSubtarget.h 2014-07-16 23:13:31.000000000 -0300 -+++ llvm-3.5.0.src/lib/Target/ARM/ARMSubtarget.h 2014-11-12 14:53:36.571808822 -0200 -@@ -372,8 +372,10 @@ - bool isTargetEHABICompatible() const { - return (TargetTriple.getEnvironment() == Triple::EABI || - TargetTriple.getEnvironment() == Triple::GNUEABI || -+ TargetTriple.getEnvironment() == Triple::MuslEABI || - TargetTriple.getEnvironment() == Triple::EABIHF || - TargetTriple.getEnvironment() == Triple::GNUEABIHF || -+ TargetTriple.getEnvironment() == Triple::MuslEABIHF || - TargetTriple.getEnvironment() == Triple::Android) && - !isTargetDarwin() && !isTargetWindows(); - } -diff -ru llvm-3.5.0.src.orig/tools/clang/lib/Driver/ToolChains.cpp llvm-3.5.0.src/tools/clang/lib/Driver/ToolChains.cpp ---- llvm-3.5.0.src.orig/tools/clang/lib/Driver/ToolChains.cpp 2014-08-27 23:07:31.000000000 -0300 -+++ llvm-3.5.0.src/tools/clang/lib/Driver/ToolChains.cpp 2014-11-12 15:09:14.805190323 -0200 -@@ -1324,7 +1324,9 @@ - static const char *const ARMTriples[] = { "arm-linux-gnueabi", - "arm-linux-androideabi" }; - 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 ARMebLibDirs[] = { "/lib" }; - static const char *const ARMebTriples[] = { "armeb-linux-gnueabi", - "armeb-linux-androideabi" }; -@@ -1336,7 +1338,7 @@ - "x86_64-linux-gnu", "x86_64-unknown-linux-gnu", "x86_64-pc-linux-gnu", - "x86_64-redhat-linux6E", "x86_64-redhat-linux", "x86_64-suse-linux", - "x86_64-manbo-linux-gnu", "x86_64-linux-gnu", "x86_64-slackware-linux", -- "x86_64-linux-android", "x86_64-unknown-linux" -+ "x86_64-linux-android", "x86_64-alpine-linux-musl", "x86_64-unknown-linux" - }; - static const char *const X32LibDirs[] = { "/libx32" }; - static const char *const X86LibDirs[] = { "/lib32", "/lib" }; -@@ -1344,7 +1346,8 @@ - "i686-linux-gnu", "i686-pc-linux-gnu", "i486-linux-gnu", "i386-linux-gnu", - "i386-redhat-linux6E", "i686-redhat-linux", "i586-redhat-linux", - "i386-redhat-linux", "i586-suse-linux", "i486-slackware-linux", -- "i686-montavista-linux", "i686-linux-android", "i586-linux-gnu" -+ "i686-montavista-linux", "i686-linux-android", "i586-linux-gnu", -+ "i486-alpine-linux-musl" - }; - - static const char *const MIPSLibDirs[] = { "/lib" }; -@@ -2777,6 +2780,7 @@ - /// Distribution (very bare-bones at the moment). - - enum Distro { -+ AlpineLinux, - ArchLinux, - DebianLenny, - DebianSqueeze, -@@ -2888,6 +2892,9 @@ - if (llvm::sys::fs::exists("/etc/arch-release")) - return ArchLinux; - -+ if (llvm::sys::fs::exists("/etc/alpine-release")) -+ return AlpineLinux; -+ - return UnknownDistro; - } - -@@ -3042,7 +3049,7 @@ - - Distro Distro = DetectDistro(Arch); - -- if (IsOpenSUSE(Distro) || IsUbuntu(Distro)) { -+ if (IsOpenSUSE(Distro) || IsUbuntu(Distro) || Distro == AlpineLinux) { - ExtraOpts.push_back("-z"); - ExtraOpts.push_back("relro"); - } -diff -ru llvm-3.5.0.src.orig/tools/clang/lib/Driver/Tools.cpp llvm-3.5.0.src/tools/clang/lib/Driver/Tools.cpp ---- llvm-3.5.0.src.orig/tools/clang/lib/Driver/Tools.cpp 2014-08-07 07:51:51.000000000 -0300 -+++ llvm-3.5.0.src/tools/clang/lib/Driver/Tools.cpp 2014-11-12 15:11:31.901864030 -0200 -@@ -7182,8 +7182,14 @@ - return "/system/bin/linker64"; - else - return "/system/bin/linker"; -- } else if (ToolChain.getArch() == llvm::Triple::x86 || -- ToolChain.getArch() == llvm::Triple::sparc) -+ } else if (ToolChain.getArch() == llvm::Triple::x86) { -+ switch (ToolChain.getTriple().getEnvironment()) { -+ case llvm::Triple::Musl: -+ return "/lib/ld-musl-i386.so.1"; -+ default: -+ return "/lib/ld-linux.so.2"; -+ } -+ } else if (ToolChain.getArch() == llvm::Triple::sparc) - return "/lib/ld-linux.so.2"; - else if (ToolChain.getArch() == llvm::Triple::aarch64 || - ToolChain.getArch() == llvm::Triple::arm64) -@@ -7193,10 +7199,17 @@ - return "/lib/ld-linux-aarch64_be.so.1"; - else if (ToolChain.getArch() == llvm::Triple::arm || - ToolChain.getArch() == llvm::Triple::thumb) { -- if (ToolChain.getTriple().getEnvironment() == llvm::Triple::GNUEABIHF) -+ switch (ToolChain.getTriple().getEnvironment()) { -+ case llvm::Triple::Musl: -+ case llvm::Triple::MuslEABI: -+ return "/lib/ld-musl-arm.so.3"; -+ case llvm::Triple::MuslEABIHF: -+ return "/lib/ld-musl-armhf.so.3"; -+ case llvm::Triple::GNUEABIHF: - return "/lib/ld-linux-armhf.so.3"; -- else -+ default: - return "/lib/ld-linux.so.3"; -+ } - } else if (ToolChain.getArch() == llvm::Triple::armeb || - ToolChain.getArch() == llvm::Triple::thumbeb) { - if (ToolChain.getTriple().getEnvironment() == llvm::Triple::GNUEABIHF) -@@ -7227,8 +7240,14 @@ - else if (ToolChain.getArch() == llvm::Triple::x86_64 && - ToolChain.getTriple().getEnvironment() == llvm::Triple::GNUX32) - return "/libx32/ld-linux-x32.so.2"; -- else -- return "/lib64/ld-linux-x86-64.so.2"; -+ else { -+ switch (ToolChain.getTriple().getEnvironment()) { -+ case llvm::Triple::Musl: -+ return "/lib/ld-musl-x86_64.so.1"; -+ default: -+ return "/lib64/ld-linux-x86-64.so.2"; -+ } -+ } - } - - static void AddRunTimeLibs(const ToolChain &TC, const Driver &D, diff --git a/main/llvm/llvm-musl.patch b/main/llvm/llvm-musl.patch deleted file mode 100644 index b6a3e216f0..0000000000 --- a/main/llvm/llvm-musl.patch +++ /dev/null @@ -1,75 +0,0 @@ -diff -ru llvm-3.5.0.src.orig/include/llvm/Target/TargetLibraryInfo.h llvm-3.5.0.src/include/llvm/Target/TargetLibraryInfo.h ---- llvm-3.5.0.src.orig/include/llvm/Target/TargetLibraryInfo.h 2014-11-13 12:51:53.341455401 +0000 -+++ llvm-3.5.0.src/include/llvm/Target/TargetLibraryInfo.h 2014-11-13 12:52:35.078889077 +0000 -@@ -13,6 +13,15 @@ - #include "llvm/ADT/DenseMap.h" - #include "llvm/Pass.h" - -+#undef fopen64 -+#undef fseeko64 -+#undef fstat64 -+#undef fstatvfs64 -+#undef ftello64 -+#undef lstat64 -+#undef stat64 -+#undef tmpfile64 -+ - namespace llvm { - class Triple; - -diff -ru llvm-3.5.0.src.orig/lib/Support/DynamicLibrary.cpp llvm-3.5.0.src/lib/Support/DynamicLibrary.cpp ---- llvm-3.5.0.src.orig/lib/Support/DynamicLibrary.cpp 2014-11-13 12:51:53.341455401 +0000 -+++ llvm-3.5.0.src/lib/Support/DynamicLibrary.cpp 2014-11-13 12:52:07.781720766 +0000 -@@ -138,7 +138,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 -diff -ru llvm-3.5.0.src.orig/lib/Support/Unix/Signals.inc llvm-3.5.0.src/lib/Support/Unix/Signals.inc ---- llvm-3.5.0.src.orig/lib/Support/Unix/Signals.inc 2014-11-13 12:51:53.341455401 +0000 -+++ llvm-3.5.0.src/lib/Support/Unix/Signals.inc 2014-11-13 12:52:07.781720766 +0000 -@@ -266,7 +266,7 @@ - // 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, -diff -ru llvm-3.5.0.src.orig/lib/Target/TargetLibraryInfo.cpp llvm-3.5.0.src/lib/Target/TargetLibraryInfo.cpp ---- llvm-3.5.0.src.orig/lib/Target/TargetLibraryInfo.cpp 2014-11-13 12:51:53.341455401 +0000 -+++ llvm-3.5.0.src/lib/Target/TargetLibraryInfo.cpp 2014-11-13 12:52:07.785054160 +0000 -@@ -653,14 +653,15 @@ - } - - // The following functions are available on at least Linux: -- if (!T.isOSLinux()) { -+ if (!T.isOSLinux()) -+ TLI.setUnavailable(LibFunc::memalign); -+ if (1 /*!T.isGlibc()*/) { - TLI.setUnavailable(LibFunc::dunder_strdup); - TLI.setUnavailable(LibFunc::dunder_strtok_r); - TLI.setUnavailable(LibFunc::dunder_isoc99_scanf); - TLI.setUnavailable(LibFunc::dunder_isoc99_sscanf); - 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); -diff -ru llvm-3.5.0.src.orig/utils/unittest/googletest/src/gtest.cc llvm-3.5.0.src/utils/unittest/googletest/src/gtest.cc ---- llvm-3.5.0.src.orig/utils/unittest/googletest/src/gtest.cc 2014-11-13 12:51:53.341455401 +0000 -+++ llvm-3.5.0.src/utils/unittest/googletest/src/gtest.cc 2014-11-13 12:52:07.785054160 +0000 -@@ -120,6 +120,7 @@ - - #if GTEST_CAN_STREAM_RESULTS_ - # include <arpa/inet.h> // NOLINT -+# include <sys/socket.h> // NOLINT - # include <netdb.h> // NOLINT - #endif - |