diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2016-03-15 14:54:01 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2016-03-22 10:21:07 +0000 |
commit | b165966a14beef9d10075f4c6010bf76e9a5c34e (patch) | |
tree | 10862bef7996831e11d742f796c07bf3f4ed5ffc /main/llvm | |
parent | 537727e3e1f91ab9be29710b2994798b145a7330 (diff) | |
download | aports-b165966a14beef9d10075f4c6010bf76e9a5c34e.tar.bz2 aports-b165966a14beef9d10075f4c6010bf76e9a5c34e.tar.xz |
main/llvm: upgrade to 3.8.0, move out clang
Diffstat (limited to 'main/llvm')
21 files changed, 235 insertions, 1089 deletions
diff --git a/main/llvm/APKBUILD b/main/llvm/APKBUILD index 55bcbc758a..a581ed90b5 100644 --- a/main/llvm/APKBUILD +++ b/main/llvm/APKBUILD @@ -1,157 +1,50 @@ # Contributor Travis Tilley <ttilley@gmail.com> # Maintainer: Travis Tilley <ttilley@gmail.com> pkgname=llvm -pkgver=3.6.2 -pkgrel=3 -use_svn="false" +pkgver=3.8.0 +pkgrel=0 pkgdesc="low level virtual machine compiler system" arch="all" url="http://llvm.org/" license="UOI-NCSA" depends="" depends_dev="perl" -makedepends="$depends_dev paxmark cmake make flex bison groff musl-dev binutils-dev isl-dev libffi-dev libxml2-dev libxml2-utils zlib-dev ncurses-dev python python-dev py-sphinx chrpath" -[ "${use_svn}" = "true" ] && makedepends="$makedepends subversion" +makedepends="$depends_dev + binutils-dev + bison + chrpath + cmake + flex + groff + isl-dev + libffi-dev + make + paxmark + py-sphinx + python + python-dev + zlib-dev + " install= -subpackages="clang clang-doc:clang_doc $pkgname-dev $pkgname-doc $pkgname-libs" +subpackages="$pkgname-static $pkgname-doc $pkgname-dev $pkgname-libs" source=" - llvm-0001-fix-shared-build.patch - llvm-0002-musl-triple.patch - llvm-0003-musl-hacks.patch - compiler-rt-0001-musl-no-dlvsym.patch - compiler-rt-0002-musl-no-sanitizers.patch - compiler-rt-0003-off_t.patch - clang-0001-fix-stdint.h.patch - clang-0002-fix-unwind-header.patch - clang-0003-add-alpine-linux-distro.patch - clang-0004-alpine-use-z-relro.patch - clang-0005-alpine-hash-style-gnu.patch - clang-0006-musl-alpine-triple.patch - clang-0007-musl-dynamic-linker-paths.patch - clang-0008-alpine-PIE-by-default.patch - clang-0009-pass-host-triple-to-compiler-rt.patch - clang-0010-alpine-use-z-now.patch - clang-0011-alpine-SSP-by-default.patch - " -if [ "${use_svn}" != "true" ]; then - source="$source - http://llvm.org/releases/$pkgver/llvm-$pkgver.src.tar.xz - http://llvm.org/releases/$pkgver/cfe-$pkgver.src.tar.xz - http://llvm.org/releases/$pkgver/clang-tools-extra-$pkgver.src.tar.xz - http://llvm.org/releases/$pkgver/compiler-rt-$pkgver.src.tar.xz - http://llvm.org/releases/$pkgver/polly-$pkgver.src.tar.xz" -fi + llvm-0001-Add-Musl-MuslEABI-and-Musl-EABIHF-triples.patch + llvm-0002-Fix-build-with-musl-libc.patch + llvm-0003-Fix-DynamicLibrary-to-build-with-musl-libc.patch + llvm-nm-workaround.patch + http://llvm.org/releases/$pkgver/llvm-$pkgver.src.tar.xz + " _builddir="$srcdir"/build -_bootstrapdir="$srcdir"/bootstrap -_cmake_flags="\ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_VERBOSE_MAKEFILE=NO \ -" - -# the binutils include directory setting appears to be necessary in order to -# build the LLVMGold plugin, even if the headers are in /usr/include and easily -# detected. -# auto-detection of both go and ocaml are explicitly disabled here, as they -# currently do not compile. _cmake_common_flags="\ - ${_cmake_flags} \ - -DLLVM_DEFAULT_TARGET_TRIPLE=$CBUILD \ - -DLLVM_HOST_TRIPLE=$CHOST \ - -DLLVM_BINUTILS_INCDIR=/usr/include \ - -DLLVM_ENABLE_ASSERTIONS=NO \ - -DLLVM_ENABLE_LIBCXX=NO \ - -DLLVM_ENABLE_PIC=YES \ - -DLLVM_ENABLE_ZLIB=YES \ - -DLLVM_ENABLE_RTTI=YES \ - -DGO_EXECUTABLE=GO_EXECUTABLE-NOTFOUND \ - -DOCAMLFIND=OCAMLFIND-NOTFOUND \ - -DCLANG_BUILD_EXAMPLES=NO \ - -DLLVM_BUILD_EXAMPLES=NO \ - -DLLVM_INCLUDE_EXAMPLES=NO \ - -DLIBXML2_INCLUDE_DIR=/usr/include/libxml2 \ -" - -# attempt to build the bootstrap compiler as quickly as is sane. unfortunately, -# there is no way to turn off ObjC support. we can, however, disable building -# ARCMT (automatic reference counting migration tool), the static analyzer, and -# documentation. also, since we're using the cmake build and not autotools, the -# tests aren't automatically built (targets for testing are emitted, just not -# built as part of the default target). -_cmake_bootstrap_flags="\ - ${_cmake_common_flags} \ - -DLLVM_TARGETS_TO_BUILD=host \ - -DBUILD_SHARED_LIBS=NO \ - -DCLANG_ENABLE_ARCMT=NO \ - -DCLANG_ENABLE_STATIC_ANALYZER=NO \ - -DCLANG_INCLUDE_DOCS=NO \ - -DCLANG_PLUGIN_SUPPORT=NO \ - -DLLVM_ENABLE_CXX1Y=NO \ - -DLLVM_ENABLE_FFI=NO \ - -DLLVM_ENABLE_SPHINX=NO \ - -DLLVM_ENABLE_TERMINFO=NO \ - -DLLVM_INCLUDE_DOCS=NO \ - -DLLVM_EXTERNAL_CLANG_TOOLS_EXTRA_BUILD=NO \ - -DLLVM_EXTERNAL_POLLY_BUILD=NO \ -" - -# setting compiler-rt to compile as if it were an external build allows it to -# use the freshly built clang to compile, rather than the bootstrap compiler. -# NOTE: there appears to be an issue building compiler-rt as an external project -# and using ninja as the build tool, so stick to good old fashioned makefiles. -_cmake_final_flags="\ - ${_cmake_common_flags} \ - -DCMAKE_INSTALL_PREFIX=/usr \ - -DLLVM_TARGETS_TO_BUILD=all \ - -DLLVM_BUILD_EXTERNAL_COMPILER_RT=YES \ - -DBUILD_SHARED_LIBS=YES \ - -DCLANG_PLUGIN_SUPPORT=YES \ - -DLINK_POLLY_INTO_TOOLS=YES \ - -DLLVM_BUILD_DOCS=YES \ - -DLLVM_BUILD_TESTS=YES \ - -DLLVM_ENABLE_CXX1Y=YES \ - -DLLVM_ENABLE_FFI=YES \ - -DLLVM_ENABLE_SPHINX=YES \ - -DLLVM_ENABLE_TERMINFO=YES \ - -DLIBCLANG_BUILD_STATIC=YES \ - -DWITH_POLLY=YES \ - -DPOLLY_ENABLE_GPGPU_CODEGEN=NO \ " _srcdir="$srcdir"/"$pkgname-$pkgver.src" -_srcdir_clang="$_srcdir"/tools/clang -_srcdir_clang_extra="$_srcdir_clang"/tools/extra -_srcdir_polly="$_srcdir"/tools/polly -_srcdir_compiler_rt="$_srcdir"/projects/compiler-rt - prepare() { - if [[ "${use_svn}" = "true" ]]; then - pkgsvnver="tags/RELEASE_${pkgver//./}/final/" - svn_source="http://llvm.org/svn/llvm-project" - cd "$srcdir" - svn co "$svn_source/llvm/$pkgsvnver" llvm-$pkgver.src - svn co "$svn_source/cfe/$pkgsvnver" cfe-$pkgver.src - svn co "$svn_source/clang-tools-extra/$pkgsvnver" clang-tools-extra-$pkgver.src - svn co "$svn_source/polly/$pkgsvnver" polly-$pkgver.src - svn co "$svn_source/compiler-rt/$pkgsvnver" compiler-rt-$pkgver.src - fi - - - msg "Preparing LLVM project sources..." - mv "$srcdir"/cfe-$pkgver.src \ - "$_srcdir_clang" || return 1 - mv "$srcdir"/clang-tools-extra-$pkgver.src \ - "$_srcdir_clang_extra" || return 1 - mv "$srcdir"/polly-$pkgver.src \ - "$_srcdir_polly" || return 1 - mv "$srcdir"/compiler-rt-$pkgver.src \ - "$_srcdir_compiler_rt" || return 1 - - msg "Patching LLVM core..." cd "$_srcdir" || return 1 update_config_sub || return 1 @@ -166,105 +59,52 @@ prepare() { ;; esac done - - msg "Patching clang..." - cd "$_srcdir_clang" || return 1 - # FIXME: I have never seen these tests pass on any system, be it vanilla clang - # or patched, musl or glibc, autoconf or cmake. It fails on alpine, gentoo, - # and ubuntu. - # TODO: The version of this test in 3.7 works just fine. Re-enable for 3.7 - rm ./test/Driver/lto.c - for i in $source; do - case $i in - clang-*.patch) - msg "Applying $i..." - patch -s -p1 -N -i "$srcdir"/$i || return 1 - ;; - esac - done - - 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 + # remove some tests that fails + rm test/tools/llvm-objdump/macho-compact-unwind-x86_64.test \ + test/tools/llvm-objdump/macho-compact-unwind-i386.test \ + test/Transforms/GlobalOpt/alias-used.ll \ + || return 1 } build() { - # cmake is funky. it uses several flag related settings in addition to picking - # up what's in the CFLAGS/CXXFLAGS env variables. to make using any abuild-set - # flags sane, we pass them in as options to cmake and unset the environment - # variables. we also back up the original flags so that we can tweak them - # without losing the original setting (see below re: -fno-devirtualize). - orig_cflags="${CFLAGS}" - orig_cxxflags="${CXXFLAGS}" - unset CFLAGS - unset CXXFLAGS - - # just in case those were set to blank strings, we _really_ want to make sure - # we're not building what will effectively be a -O0 build here... - test -z "${orig_cflags}" && orig_cflags="-O3" - test -z "${orig_cxxflags}" && orig_cxxflags="-O3" - - # -fno-devirtualize is added here because, to quote the fedora spec file, - # "gcc has scary template-related bugs". the flag is removed post-bootstrap. - # -DNDEBUG is required to disable assertions - cflags="${orig_cflags} -DNDEBUG" - cxxflags="${orig_cxxflags} -DNDEBUG -fno-devirtualize" - - # The cmake logic appears to use the result of config.guess in a few places - # even though we override the various triple settings manually. export CBUILD - # to the tweaked config.guess just to be safe. - export CBUILD + mkdir -p "$_builddir" + cd "$_builddir" - # cmake doesn't call out to pkg-config to determine the include path for FFI, - # and since alpine installs the headers to a versioned directory cmake can't # auto-detect it by guessing either. - ffi_include_dir="$(pkg-config --cflags-only-I libffi | sed 's|^-I||g')" - - mkdir -p "$_bootstrapdir" - cd "$_bootstrapdir" - 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 - - # work around parallel build issue: - make llvm-tblgen && make clang-tblgen || return 1 - make || return 1 - - paxmark m bin/llvm-rtdyld - paxmark m bin/lli - paxmark m bin/lli-child-target - - cflags="${orig_cflags} -DNDEBUG" - cxxflags="${orig_cxxflags} -DNDEBUG" - CC="${_bootstrapdir}/bin/clang" - CXX="${_bootstrapdir}/bin/clang++" - - mkdir "$_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}" \ - -DCMAKE_SHARED_LINKER_FLAGS="${LDFLAGS}" \ - -DFFI_INCLUDE_DIR="$ffi_include_dir" \ + _ffi_include_dir="$(pkg-config --cflags-only-I libffi | sed 's|^-I||g')" + + cmake -G "Unix Makefiles" -Wno-dev \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_VERBOSE_MAKEFILE=NO \ + \ + -DFFI_INCLUDE_DIR="$_ffi_include_dir" \ + -DLLVM_BINUTILS_INCDIR=/usr/include \ + -DLLVM_BUILD_DOCS=YES \ + -DLLVM_BUILD_EXAMPLES=NO \ + -DLLVM_BUILD_EXTERNAL_COMPILER_RT:BOOL=ON \ + -DLLVM_BUILD_LLVM_DYLIB:BOOL=ON \ + -DLLVM_BUILD_TESTS=YES \ + -DLLVM_DEFAULT_TARGET_TRIPLE=$CBUILD \ + -DLLVM_DYLIB_EXPORT_ALL:BOOL=ON \ + -DLLVM_ENABLE_ASSERTIONS=NO \ + -DLLVM_ENABLE_CXX1Y=YES \ + -DLLVM_ENABLE_FFI=YES \ + -DLLVM_ENABLE_LIBCXX=NO \ + -DLLVM_ENABLE_PIC=YES \ + -DLLVM_ENABLE_RTTI=YES \ + -DLLVM_ENABLE_SPHINX=YES \ + -DLLVM_ENABLE_TERMINFO=YES \ + -DLLVM_ENABLE_ZLIB=YES \ + -DLLVM_HOST_TRIPLE=$CHOST \ + -DLLVM_INCLUDE_EXAMPLES=NO \ + -DLLVM_LINK_LLVM_DYLIB:BOOL=ON \ + -DLLVM_TARGETS_TO_BUILD=all \ + \ + -DSPHINX_WARNINGS_AS_ERRORS=NO \ "${_srcdir}" || return 1 - make llvm-tblgen && make clang-tblgen || return 1 + make llvm-tblgen || return 1 make || return 1 paxmark m bin/llvm-rtdyld @@ -274,130 +114,56 @@ build() { paxmark m unittests/ExecutionEngine/MCJIT/MCJITTests paxmark m unittests/Support/SupportTests + case "$CARCH" in arm*) # ARM has few failures in test suite # that we don't care about currently ;; *) - make check-llvm || return 1 - make check-clang || return 1 - make check-compiler-rt || return 1 - make check-polly || return 1 + make check-llvm || return 1 ;; esac - - # 27 failures, all related to clang-tidy. - # clang-format/clang-modernize and friends pass their test suites - # make check-clang-tools || return 1 } package() { cd "$_builddir" make DESTDIR="$pkgdir" install - - rm "$pkgdir"/usr/lib/LLVMHello.so - file "$pkgdir"/usr/lib/*.so | awk -F: '$2~/ELF/{print $1}' | xargs -r chrpath -d file "$pkgdir"/usr/bin/* | awk -F: '$2~/ELF/{print $1}' | xargs -r chrpath -d } -clang() { - pkgdesc="A C language family front-end for LLVM" - - mkdir -p "$subpkgdir"/usr/bin \ - "$subpkgdir"/usr/lib "$subpkgdir"/usr/share/clang "$subpkgdir"/usr/include - mv "$pkgdir"/usr/bin/*clang* \ - "$subpkgdir"/usr/bin/ || return 1 - mv "$pkgdir"/usr/lib/clang \ - "$pkgdir"/usr/lib/libclang* \ - "$pkgdir"/usr/lib/libmodernize* \ - "$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 - - ln -s /usr/share/clang/scan-build/scan-build "$subpkgdir"/usr/bin/scan-build - ln -s /usr/share/clang/scan-view/scan-view "$subpkgdir"/usr/bin/scan-view +static() { + pkgdesc="LLVM static libraries" + mkdir -p "$subpkgdir"/usr/lib + mv "$pkgdir"/usr/lib/*.a "$subpkgdir"/usr/lib/ } -clang_doc() { - pkgdesc="clang documentation" - mkdir -p "$subpkgdir"/usr/share/doc/ || return 1 - mv "$pkgdir"/usr/share/doc/clang "$subpkgdir"/usr/share/doc/ || return 1 +dev() { + default_dev || return 1 + mv "$pkgdir"/usr/lib/LLVMHello.so "$subpkgdir"/usr/lib/ || return 1 + mv "$pkgdir"/usr/share "$subpkgdir"/usr/ || return 1 } libs() { - pkgdesc="LLVM shared libraries" - mkdir -p "$subpkgdir"/usr/lib/ - mv "$pkgdir"/usr/lib/*.so "$subpkgdir"/usr/lib/ + pkgdesc="LLVM runtiem libraries" + mkdir -p "$subpkgdir"/usr/lib + mv "$pkgdir"/usr/lib/libLLVM-[0-9]*.so* "$subpkgdir"/usr/lib/ } -md5sums="0947294a8c83c8d7f857dfc16204c4eb llvm-0001-fix-shared-build.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 -8bc11d4a60af51a7fc10643bd0970d3a compiler-rt-0003-off_t.patch -eab0123372fa909817ed21cfcffdbe16 clang-0001-fix-stdint.h.patch -069f5cd7a6d0b01eade62bb72aac9e8b clang-0002-fix-unwind-header.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 -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 -26831612243302f3ef964f355bf8c409 clang-0010-alpine-use-z-now.patch -308db990bb9c1c28152fdf18dddcb6eb clang-0011-alpine-SSP-by-default.patch -0c1ee3597d75280dee603bae9cbf5cc2 llvm-3.6.2.src.tar.xz -ff862793682f714bb7862325b9c06e20 cfe-3.6.2.src.tar.xz -3ebc1dc41659fcec3db1b47d81575e06 clang-tools-extra-3.6.2.src.tar.xz -e3bc4eb7ba8c39a6fe90d6c988927f3c compiler-rt-3.6.2.src.tar.xz -09dd91d06cc0832095379d00206bc3a1 polly-3.6.2.src.tar.xz" -sha256sums="4f75c2a76cf4c439d65c8e67511cd91c895edf8ccf003a5f94ffa07c29456296 llvm-0001-fix-shared-build.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 -45bcfa7d1c757e32183c5cd95703f150ec3d1ed966a9cfa68b13b648e5310e78 compiler-rt-0003-off_t.patch -516a1dbba85731a557840ee3ebc9cc82a2e5ce625cf5b37f5392bd089ef40bdc clang-0001-fix-stdint.h.patch -3be240b78d2371728280ffb15191573c969b304ed784883b79c662ff73c2bc43 clang-0002-fix-unwind-header.patch -78449c4f7c9fdfaccef3b68039c69e7e041fb34862d39c803d7e6fac17f659aa clang-0003-add-alpine-linux-distro.patch -501ab6e3fb99c9ffb82329475051a633797bf824c0dea437843266f190c062a0 clang-0004-alpine-use-z-relro.patch -1c4dbd1d474bf08de5979d6f4399aeba29de9ba8950aa0688d081d82e552d7d3 clang-0005-alpine-hash-style-gnu.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 -a34aca360fa52231b6c8663ee8b1103492f1c2600a08cc670616ce97d14e0ba9 clang-0010-alpine-use-z-now.patch -e8056b8fbf7dc0abc0c966c43642ffd72878453b04fa94c18bc7d92ee3e405f4 clang-0011-alpine-SSP-by-default.patch -f60dc158bfda6822de167e87275848969f0558b3134892ff54fced87e4667b94 llvm-3.6.2.src.tar.xz -ae9180466a23acb426d12444d866b266ff2289b266064d362462e44f8d4699f3 cfe-3.6.2.src.tar.xz -6a0ec627d398f501ddf347060f7a2ccea4802b2494f1d4fd7bda3e0442d04feb clang-tools-extra-3.6.2.src.tar.xz -0f2ff37d80a64575fecd8cf0d5c50f7ac1f837ddf700d1855412bb7547431d87 compiler-rt-3.6.2.src.tar.xz -f2a956730b76212f22a1c10f35f195795e4d027ad28c226f97ddb8c0fd16bcbc polly-3.6.2.src.tar.xz" -sha512sums="b3c0e0f74680e9b2d02f1c923a191ef5eb913be84105e4d63aae6a88b1dac758467cecad3430496a7945cebdc73ec5ee1f643dc5dc7b336fee920e3c8b6d54d2 llvm-0001-fix-shared-build.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 -effed16bed6160c1629c72960424afed87f8c1c1290bf4eccd43da5a1fcb5b350242c01fcc1cc7355b420f5ac80231ea7a33ca71cafad884ea4c756cbdfbdd59 compiler-rt-0003-off_t.patch -6ad0a3409eb9c9bd43115c696f2894b683e4659b16b7ce29c7d88c35b3f585c10870c9df224a63fa14ff78810ee829b88a60dbf426f5b36084dfce7541a0cc00 clang-0001-fix-stdint.h.patch -0e3c9fbc70a12986e0531c9c642f9fff97d9d7617fd33ee69ac81d283ee14e86b6de435f1b51478a9c304f787c1b21ebc804d39a57a1ebeedce7308362d93614 clang-0002-fix-unwind-header.patch -0b8108c96948a1704275a93f3b872572fe2c61a0cd3e7f4caf63c0ca262cc079e2424b70f41d20f4a9aebe30333e39e3c594b4240fd41f7bd9a6682e751a23d9 clang-0003-add-alpine-linux-distro.patch -ac72ea29d6f889f2b54915b97d56bc388e849da2f524b872241053fa6bb9dde4eb6b1333813070e3671115121da34c22ff1e87aa19ce82a393166143b30c7de4 clang-0004-alpine-use-z-relro.patch -0594cc85b6cf0be66e747eb7ba6af5aff401d65b4072f3da4a3e531795965f72df5a3850c7abbbe4e1fde3dc6ad583ecfc4a77429531bae02143b5ca36bed37e clang-0005-alpine-hash-style-gnu.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 -1bec07a11885b4e1b692a1df1ca2de8075016619b4086d9114553386e4de5956fbc7da5e234075f08eb635df8c01ebf51c9e2fc33aa483f02050eddbe66e38d2 clang-0010-alpine-use-z-now.patch -23940138bf5208719ce38660d9f1a1fcf498a249243951c7e02c947780444228494a1f68380dc609093a3358273fd3d520f0b61ffe198bfccbec1de6aabd7670 clang-0011-alpine-SSP-by-default.patch -42b44ce69cfb96e2dc12dc2246f0de8ff983a99741206e2c46ccf074b3248aaab9c0f22c6baad802de851d06f202f40db9dd62fe38aab4479b3f70026c936b36 llvm-3.6.2.src.tar.xz -ed837c48f38d8998efd675b56477c8681dcedfcf3f71bba65930f145501289bebb6fe6a6d9de336548f94c381d016b99f10c58e046b885449755d44ac782de03 cfe-3.6.2.src.tar.xz -1b7710a7deee30cefb6a3b4edb026a96d8935a0c6f3056ccdb7a45564d10baf01a4f6722ae853ad9a3bad17e8de32a3c0ec99c5cf6144647a5e182809d403f7a clang-tools-extra-3.6.2.src.tar.xz -7dafcc5bd4822475de649d8a84ae51af3c4ed4d0958f76b1b55ba79219638f3e78eb94a1986c6e9ba0e7f1ccf3ec834d546b5ca60e8b08083fea5880ecdf17a3 compiler-rt-3.6.2.src.tar.xz -c3b0ce2179fb441dd1b4c99e801a15bcb205e7156ab22c181e6c4f15abaeec7797ef2ce4b8f41ffd31dd90b224290a15e5d94aaf992fb88fe8444cdb55c24ce1 polly-3.6.2.src.tar.xz" + +md5sums="10904f363abd86c5c4729e5630ea319c llvm-0001-Add-Musl-MuslEABI-and-Musl-EABIHF-triples.patch +b0cd098117223159b76e96c3f884536b llvm-0002-Fix-build-with-musl-libc.patch +9cc5050619f764ca9dc842a5ab122290 llvm-0003-Fix-DynamicLibrary-to-build-with-musl-libc.patch +785147afd8ab80fa95955a5637b6582f llvm-nm-workaround.patch +07a7a74f3c6bd65de4702bf941b511a0 llvm-3.8.0.src.tar.xz" +sha256sums="708db2b21570e48e2c2e155a0c7b7969acecbb82393e306b5b69b0353ac108dd llvm-0001-Add-Musl-MuslEABI-and-Musl-EABIHF-triples.patch +e1b0fd5f6918d8c8404f3ec4b8d3ab8fbe8dadc2d6011792349b56e5e8ee51e2 llvm-0002-Fix-build-with-musl-libc.patch +fc28356bf0d5fcfe9b99e28f4abbc2f49f50d263b44e428e30f33bf5472747b4 llvm-0003-Fix-DynamicLibrary-to-build-with-musl-libc.patch +1870f910a6f5f2ba6144bd079ec55ed879fe8fd8b1b1b384935f36da43e5f114 llvm-nm-workaround.patch +555b028e9ee0f6445ff8f949ea10e9cd8be0d084840e21fbbe1d31d51fc06e46 llvm-3.8.0.src.tar.xz" +sha512sums="a97ad7a71ec4878f1a8a335dbc0c161323d957aeb95917b0c4837405c69b53b5f9718094e0e9fd7814c74f44aaa8cff3a9379202964b537c8162a53214621bc5 llvm-0001-Add-Musl-MuslEABI-and-Musl-EABIHF-triples.patch +4cb3fabbb627b596ce398ed717c66ad20bbea7092ba30751520cc5a63d38e1ac53d23e98a6ad82121ddcf2434383ba5cadbc2990f99a4528e99c6e2160c2f725 llvm-0002-Fix-build-with-musl-libc.patch +19bfb9282455d39d07dbb2b1293b03a45c57d522fbb9c5e58dac034200669628b97e7a90cd4ff5d52d9bb79acfccbef653d8a1140a7f0589ecd6f9b7c4ba0eb6 llvm-0003-Fix-DynamicLibrary-to-build-with-musl-libc.patch +11db6f3c5d697bc536c7d053530f7a5572756185e16399c32c31306861b58046ca9bc14b8d8097758c00a8c1a7026cbfb75636c0e697e59c53dda5848f93b006 llvm-nm-workaround.patch +2c76e79d803768ed20af6ca1801cf2518071bf9835c54580ea3eb6219a66cdcf8b4c575f192c15082cc18d2468b7611dacb57950b605813a2317125c2d33c138 llvm-3.8.0.src.tar.xz" diff --git a/main/llvm/clang-0001-fix-stdint.h.patch b/main/llvm/clang-0001-fix-stdint.h.patch deleted file mode 100644 index 649a9efd3c..0000000000 --- a/main/llvm/clang-0001-fix-stdint.h.patch +++ /dev/null @@ -1,31 +0,0 @@ -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__ */ --- -2.1.4 diff --git a/main/llvm/clang-0002-fix-unwind-header.patch b/main/llvm/clang-0002-fix-unwind-header.patch deleted file mode 100644 index 30bfaaef0b..0000000000 --- a/main/llvm/clang-0002-fix-unwind-header.patch +++ /dev/null @@ -1,35 +0,0 @@ -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 */ --- -2.1.4 diff --git a/main/llvm/clang-0003-add-alpine-linux-distro.patch b/main/llvm/clang-0003-add-alpine-linux-distro.patch deleted file mode 100644 index 3305ce3116..0000000000 --- a/main/llvm/clang-0003-add-alpine-linux-distro.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp -index 8bd8298..620a44a 100644 ---- a/lib/Driver/ToolChains.cpp -+++ b/lib/Driver/ToolChains.cpp -@@ -2672,6 +2672,7 @@ Tool *Solaris::buildLinker() const { - /// Distribution (very bare-bones at the moment). - - enum Distro { -+ AlpineLinux, - ArchLinux, - DebianLenny, - DebianSqueeze, -@@ -2783,6 +2784,9 @@ static Distro DetectDistro(llvm::Triple::ArchType Arch) { - if (llvm::sys::fs::exists("/etc/arch-release")) - return ArchLinux; - -+ if (llvm::sys::fs::exists("/etc/alpine-release")) -+ return AlpineLinux; -+ - return UnknownDistro; - } - --- -2.1.4 diff --git a/main/llvm/clang-0004-alpine-use-z-relro.patch b/main/llvm/clang-0004-alpine-use-z-relro.patch deleted file mode 100644 index 52a47b0302..0000000000 --- a/main/llvm/clang-0004-alpine-use-z-relro.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp -index 620a44a..006915c 100644 ---- a/lib/Driver/ToolChains.cpp -+++ b/lib/Driver/ToolChains.cpp -@@ -2939,7 +2939,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) - - Distro Distro = DetectDistro(Arch); - -- if (IsOpenSUSE(Distro) || IsUbuntu(Distro)) { -+ if (IsOpenSUSE(Distro) || IsUbuntu(Distro) || Distro == AlpineLinux) { - ExtraOpts.push_back("-z"); - ExtraOpts.push_back("relro"); - } --- -2.1.4 diff --git a/main/llvm/clang-0005-alpine-hash-style-gnu.patch b/main/llvm/clang-0005-alpine-hash-style-gnu.patch deleted file mode 100644 index ebb5fb3dc8..0000000000 --- a/main/llvm/clang-0005-alpine-hash-style-gnu.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp -index 006915c..6007a98 100644 ---- a/lib/Driver/ToolChains.cpp -+++ b/lib/Driver/ToolChains.cpp -@@ -2959,7 +2959,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"); - --- -2.1.4 diff --git a/main/llvm/clang-0006-musl-alpine-triple.patch b/main/llvm/clang-0006-musl-alpine-triple.patch deleted file mode 100644 index 8d8842fdd4..0000000000 --- a/main/llvm/clang-0006-musl-alpine-triple.patch +++ /dev/null @@ -1,215 +0,0 @@ -diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp -index 6007a98..44e929f 100644 ---- a/lib/Driver/ToolChains.cpp -+++ b/lib/Driver/ToolChains.cpp -@@ -1296,7 +1296,9 @@ bool Generic_GCC::GCCInstallationDetector::getBiarchSibling(Multilib &M) const { - 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" }; -@@ -1308,7 +1310,8 @@ bool Generic_GCC::GCCInstallationDetector::getBiarchSibling(Multilib &M) const { - "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" }; -@@ -1316,7 +1319,9 @@ bool Generic_GCC::GCCInstallationDetector::getBiarchSibling(Multilib &M) const { - "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-pc-linux-musl", "i586-pc-linux-musl", "i686-pc-linux-musl", -+ "i486-alpine-linux-musl", "i586-alpine-linux-musl", "i686-alpine-linux-musl" - }; - - 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 diff --git a/main/llvm/clang-0007-musl-dynamic-linker-paths.patch b/main/llvm/clang-0007-musl-dynamic-linker-paths.patch deleted file mode 100644 index fe04af2254..0000000000 --- a/main/llvm/clang-0007-musl-dynamic-linker-paths.patch +++ /dev/null @@ -1,60 +0,0 @@ -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.1"; -+ case llvm::Triple::MuslEABIHF: -+ return "/lib/ld-musl-armhf.so.1"; -+ 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, --- -2.1.4 diff --git a/main/llvm/clang-0008-alpine-PIE-by-default.patch b/main/llvm/clang-0008-alpine-PIE-by-default.patch deleted file mode 100644 index 7f46452751..0000000000 --- a/main/llvm/clang-0008-alpine-PIE-by-default.patch +++ /dev/null @@ -1,54 +0,0 @@ -diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp -index 44e929f..3f25a36 100644 ---- a/lib/Driver/ToolChains.cpp -+++ b/lib/Driver/ToolChains.cpp -@@ -3397,6 +3397,9 @@ void Linux::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs, - } - - bool Linux::isPIEDefault() const { -+ StringRef VendorName = Linux::getTriple().getVendorName(); -+ if (VendorName.compare("alpine") == 0) -+ return true; - return getSanitizerArgs().requiresPIE(); - } - -diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp -index 3e71522..9a0fc84 100644 ---- a/lib/Driver/Tools.cpp -+++ b/lib/Driver/Tools.cpp -@@ -7462,7 +7462,9 @@ void gnutools::Link::ConstructJob(Compilation &C, const JobAction &JA, - if (!D.SysRoot.empty()) - CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot)); - -- if (IsPIE) -+ if (Args.hasArg(options::OPT_nopie)) -+ CmdArgs.push_back("-nopie"); -+ else if (IsPIE) - CmdArgs.push_back("-pie"); - - if (Args.hasArg(options::OPT_rdynamic)) -diff --git a/test/Driver/pic.c b/test/Driver/pic.c -index a3d989c..b1a55ae 100644 ---- a/test/Driver/pic.c -+++ b/test/Driver/pic.c -@@ -225,6 +225,18 @@ - // RUN: %clang %s -target i386-pc-openbsd -nopie -### 2>&1 \ - // RUN: | FileCheck %s --check-prefix=CHECK-NOPIE-LD - // -+// On Alpine Linux, we want similar PIE-by-default behavior -+// RUN: %clang -c %s -target x86_64-alpine-linux-musl -### 2>&1 \ -+// RUN: | FileCheck %s --check-prefix=CHECK-PIE2 -+// RUN: %clang -c %s -target i686-alpine-linux-musl -### 2>&1 \ -+// RUN: | FileCheck %s --check-prefix=CHECK-PIE2 -+// RUN: %clang -c %s -target armv6-alpine-linux-musleabihf -### 2>&1 \ -+// RUN: | FileCheck %s --check-prefix=CHECK-PIE2 -+// RUN: %clang -c %s -target armv7-alpine-linux-musleabihf -### 2>&1 \ -+// RUN: | FileCheck %s --check-prefix=CHECK-PIE2 -+// RUN: %clang %s -target x86_64-alpine-linux-musl -nopie -### 2>&1 \ -+// RUN: | FileCheck %s --check-prefix=CHECK-NOPIE-LD -+// - // On Android PIC is enabled by default - // RUN: %clang -c %s -target i686-linux-android -### 2>&1 \ - // RUN: | FileCheck %s --check-prefix=CHECK-PIC2 --- -2.1.4 diff --git a/main/llvm/clang-0009-pass-host-triple-to-compiler-rt.patch b/main/llvm/clang-0009-pass-host-triple-to-compiler-rt.patch deleted file mode 100644 index 89174112b6..0000000000 --- a/main/llvm/clang-0009-pass-host-triple-to-compiler-rt.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git i/runtime/CMakeLists.txt w/runtime/CMakeLists.txt -index 9f1cd78..5b3da2e 100644 ---- i/runtime/CMakeLists.txt -+++ w/runtime/CMakeLists.txt -@@ -46,6 +46,7 @@ if(LLVM_BUILD_EXTERNAL_COMPILER_RT AND EXISTS ${COMPILER_RT_SRC_ROOT}/) - -DCOMPILER_RT_INSTALL_PATH=lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION} - -DCOMPILER_RT_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS} - -DCOMPILER_RT_ENABLE_WERROR=ON -+ -DLLVM_HOST_TRIPLE=${LLVM_HOST_TRIPLE} - INSTALL_COMMAND "" - STEP_TARGETS configure build - ) diff --git a/main/llvm/clang-0010-alpine-use-z-now.patch b/main/llvm/clang-0010-alpine-use-z-now.patch deleted file mode 100644 index 00b7a5bcdc..0000000000 --- a/main/llvm/clang-0010-alpine-use-z-now.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff --git i/lib/Driver/ToolChains.cpp w/lib/Driver/ToolChains.cpp -index 1e43b6c..ce2de18 100644 ---- i/lib/Driver/ToolChains.cpp -+++ w/lib/Driver/ToolChains.cpp -@@ -2944,6 +2944,11 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) - - Distro Distro = DetectDistro(Arch); - -+ if (Distro == AlpineLinux) { -+ ExtraOpts.push_back("-z"); -+ ExtraOpts.push_back("now"); -+ } -+ - if (IsOpenSUSE(Distro) || IsUbuntu(Distro) || Distro == AlpineLinux) { - ExtraOpts.push_back("-z"); - ExtraOpts.push_back("relro"); diff --git a/main/llvm/clang-0011-alpine-SSP-by-default.patch b/main/llvm/clang-0011-alpine-SSP-by-default.patch deleted file mode 100644 index e08efbd643..0000000000 --- a/main/llvm/clang-0011-alpine-SSP-by-default.patch +++ /dev/null @@ -1,53 +0,0 @@ -diff --git i/lib/Driver/ToolChains.cpp w/lib/Driver/ToolChains.cpp -index e3ff0d7..68ed764 100644 ---- i/lib/Driver/ToolChains.cpp -+++ w/lib/Driver/ToolChains.cpp -@@ -3408,6 +3408,13 @@ bool Linux::isPIEDefault() const { - return getSanitizerArgs().requiresPIE(); - } - -+unsigned Linux::GetDefaultStackProtectorLevel(bool KernelOrKext) const { -+ StringRef VendorName = Linux::getTriple().getVendorName(); -+ if (VendorName.compare("alpine") == 0) -+ return 2; -+ return 1; -+} -+ - /// DragonFly - DragonFly tool chain which can call as(1) and ld(1) directly. - - DragonFly::DragonFly(const Driver &D, const llvm::Triple& Triple, const ArgList &Args) -diff --git i/lib/Driver/ToolChains.h w/lib/Driver/ToolChains.h -index 47fb10d..3714a6f 100644 ---- i/lib/Driver/ToolChains.h -+++ w/lib/Driver/ToolChains.h -@@ -641,6 +641,7 @@ public: - AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs, - llvm::opt::ArgStringList &CC1Args) const override; - bool isPIEDefault() const override; -+ unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override; - - std::string Linker; - std::vector<std::string> ExtraOpts; -diff --git i/test/Driver/stack-protector.c w/test/Driver/stack-protector.c -index 7fecd1b..f29cee0 100644 ---- i/test/Driver/stack-protector.c -+++ w/test/Driver/stack-protector.c -@@ -23,3 +23,18 @@ - // RUN: %clang -fstack-protector-all -### %s 2>&1 | FileCheck %s -check-prefix=SSP-ALL - // SSP-ALL: "-stack-protector" "3" - // SSP-ALL-NOT: "-stack-protector-buffer-size" -+ -+// RUN: %clang -target x86_64-alpine-linux-musl -### %s 2>&1 | FileCheck %s -check-prefix=ALPINE -+// ALPINE: "-stack-protector" "2" -+ -+// RUN: %clang -target x86_64-alpine-linux-musl -fstack-protector -### %s 2>&1 | FileCheck %s -check-prefix=ALPINE_SPS -+// ALPINE_SPS: "-stack-protector" "2" -+ -+// RUN: %clang -target x86_64-alpine-linux-musl -fstack-protector-all -### %s 2>&1 | FileCheck %s -check-prefix=ALPINE_ALL -+// ALPINE_ALL: "-stack-protector" "3" -+// ALPINE_ALL-NOT: "-stack-protector-buffer-size" -+ -+// RUN: %clang -target x86_64-alpine-linux-musl -fno-stack-protector -### %s 2>&1 | FileCheck %s -check-prefix=ALPINE_NOSSP -+// ALPINE_NOSSP-NOT: "-stack-protector" -+// ALPINE_NOSSP-NOT: "-stack-protector-buffer-size" -+ diff --git a/main/llvm/compiler-rt-0001-musl-no-dlvsym.patch b/main/llvm/compiler-rt-0001-musl-no-dlvsym.patch deleted file mode 100644 index 1d427d93b2..0000000000 --- a/main/llvm/compiler-rt-0001-musl-no-dlvsym.patch +++ /dev/null @@ -1,15 +0,0 @@ -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 -@@ -24,7 +24,7 @@ bool GetRealFunctionAddress(const char *func_name, uptr *func_addr, - 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); - } --- -2.1.4 diff --git a/main/llvm/compiler-rt-0002-musl-no-sanitizers.patch b/main/llvm/compiler-rt-0002-musl-no-sanitizers.patch deleted file mode 100644 index 48822b3933..0000000000 --- a/main/llvm/compiler-rt-0002-musl-no-sanitizers.patch +++ /dev/null @@ -1,49 +0,0 @@ -diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake -index f6d48b3..26b6d8e 100644 ---- a/cmake/config-ix.cmake -+++ b/cmake/config-ix.cmake -@@ -186,13 +186,15 @@ filter_available_targets(PROFILE_SUPPORTED_ARCH x86_64 i386 i686 arm mips mips64 - filter_available_targets(TSAN_SUPPORTED_ARCH x86_64) - filter_available_targets(UBSAN_SUPPORTED_ARCH x86_64 i386 i686 arm aarch64 mips mipsel mips64 mips64el) - -+string(REGEX MATCH "musl[^-]*$" LLVM_ENV_MUSL ${LLVM_HOST_TRIPLE}) -+ - if(ANDROID) - set(OS_NAME "Android") - else() - set(OS_NAME "${CMAKE_SYSTEM_NAME}") - endif() - --if (SANITIZER_COMMON_SUPPORTED_ARCH AND NOT LLVM_USE_SANITIZER AND -+if (SANITIZER_COMMON_SUPPORTED_ARCH AND NOT LLVM_USE_SANITIZER AND NOT LLVM_ENV_MUSL AND - (OS_NAME MATCHES "Android|Darwin|Linux|FreeBSD" OR - (OS_NAME MATCHES "Windows" AND MSVC AND CMAKE_SIZEOF_VOID_P EQUAL 4))) - set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE) -diff --git a/lib/Makefile.mk b/lib/Makefile.mk -index ed9690d..28e17d9 100644 ---- a/lib/Makefile.mk -+++ b/lib/Makefile.mk -@@ -10,13 +10,14 @@ - 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 -+ --- -2.1.4 diff --git a/main/llvm/compiler-rt-0003-off_t.patch b/main/llvm/compiler-rt-0003-off_t.patch deleted file mode 100644 index eee8ab0626..0000000000 --- a/main/llvm/compiler-rt-0003-off_t.patch +++ /dev/null @@ -1,16 +0,0 @@ -on musl libc off_t is always 64bit - -This is needed for interception to build on 32 bit musl - ---- a/lib/sanitizer_common/sanitizer_internal_defs.h -+++ b/lib/sanitizer_common/sanitizer_internal_defs.h -@@ -87,7 +87,8 @@ - // like pread and mmap, as opposed to pread64 and mmap64. - // FreeBSD, Mac and Linux/x86-64 are special. - #if SANITIZER_FREEBSD || SANITIZER_MAC || \ -- (SANITIZER_LINUX && defined(__x86_64__)) -+ (SANITIZER_LINUX && \ -+ (defined(__x86_64__) || (!defined(__GLIBC__) && !SANITIZER_ANDROID))) - typedef u64 OFF_T; - #else - typedef uptr OFF_T; diff --git a/main/llvm/llvm-0002-musl-triple.patch b/main/llvm/llvm-0001-Add-Musl-MuslEABI-and-Musl-EABIHF-triples.patch index 6e6569fed9..c1dfc5bdf7 100644 --- a/main/llvm/llvm-0002-musl-triple.patch +++ b/main/llvm/llvm-0001-Add-Musl-MuslEABI-and-Musl-EABIHF-triples.patch @@ -1,11 +1,23 @@ +From 1cec99f6d53d442d8a8c9d2ed9f4a58f8fdc6412 Mon Sep 17 00:00:00 2001 +From: Natanael Copa <ncopa@alpinelinux.org> +Date: Thu, 18 Feb 2016 08:30:07 +0100 +Subject: [PATCH 1/3] Add Musl, MuslEABI and Musl EABIHF triples + +--- + include/llvm/ADT/Triple.h | 11 +++++++++++ + lib/Support/Triple.cpp | 7 +++++++ + lib/Target/ARM/ARMSubtarget.h | 3 +++ + lib/Target/ARM/ARMTargetMachine.cpp | 2 ++ + 4 files changed, 23 insertions(+) + diff --git a/include/llvm/ADT/Triple.h b/include/llvm/ADT/Triple.h -index 8a68599..072623c 100644 +index e01db0a..2fc4fc1 100644 --- a/include/llvm/ADT/Triple.h +++ b/include/llvm/ADT/Triple.h -@@ -154,6 +154,10 @@ public: +@@ -174,6 +174,10 @@ public: EABIHF, Android, - + + Musl, + MuslEABI, + MuslEABIHF, @@ -13,11 +25,25 @@ index 8a68599..072623c 100644 MSVC, Itanium, Cygnus, +@@ -544,6 +548,13 @@ public: + /// Tests whether the target is Android + bool isAndroid() const { return getEnvironment() == Triple::Android; } + ++ /// Tests whether the target is musl libc ++ bool isMusl() const { ++ return getEnvironment() == Triple::Musl || ++ getEnvironment() == Triple::MuslEABI || ++ getEnvironment() == Triple::MuslEABIHF; ++ } ++ + /// @} + /// @name Mutators + /// @{ diff --git a/lib/Support/Triple.cpp b/lib/Support/Triple.cpp -index 0838e90..4be78e5 100644 +index 11afcf7..d90a06a 100644 --- a/lib/Support/Triple.cpp +++ b/lib/Support/Triple.cpp -@@ -175,6 +175,9 @@ const char *Triple::getEnvironmentTypeName(EnvironmentType Kind) { +@@ -199,6 +199,9 @@ const char *Triple::getEnvironmentTypeName(EnvironmentType Kind) { case CODE16: return "code16"; case EABI: return "eabi"; case EABIHF: return "eabihf"; @@ -27,7 +53,7 @@ index 0838e90..4be78e5 100644 case Android: return "android"; case MSVC: return "msvc"; case Itanium: return "itanium"; -@@ -375,6 +378,9 @@ static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName) { +@@ -454,6 +457,9 @@ static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName) { .StartsWith("code16", Triple::CODE16) .StartsWith("gnu", Triple::GNU) .StartsWith("android", Triple::Android) @@ -37,9 +63,7 @@ index 0838e90..4be78e5 100644 .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 @@ +@@ -1431,6 +1437,7 @@ StringRef Triple::getARMCPUForArch(StringRef MArch) const { switch (getEnvironment()) { case llvm::Triple::EABIHF: case llvm::Triple::GNUEABIHF: @@ -48,33 +72,33 @@ index 0838e90..4be78e5 100644 default: return "arm7tdmi"; diff --git a/lib/Target/ARM/ARMSubtarget.h b/lib/Target/ARM/ARMSubtarget.h -index dbacd4d..b330be5 100644 +index 4d54e57..7ed7ab7 100644 --- a/lib/Target/ARM/ARMSubtarget.h +++ b/lib/Target/ARM/ARMSubtarget.h -@@ -369,8 +369,10 @@ public: +@@ -405,8 +405,10 @@ public: bool isTargetEHABICompatible() const { return (TargetTriple.getEnvironment() == Triple::EABI || TargetTriple.getEnvironment() == Triple::GNUEABI || -+ TargetTriple.getEnvironment() == Triple::MuslEABI || ++ TargetTriple.getEnvironment() == Triple::MuslEABI || TargetTriple.getEnvironment() == Triple::EABIHF || TargetTriple.getEnvironment() == Triple::GNUEABIHF || -+ TargetTriple.getEnvironment() == Triple::MuslEABIHF || - TargetTriple.getEnvironment() == Triple::Android) && ++ TargetTriple.getEnvironment() == Triple::MuslEABIHF || + isTargetAndroid()) && !isTargetDarwin() && !isTargetWindows(); } -@@ -379,6 +381,7 @@ public: +@@ -415,6 +417,7 @@ public: // FIXME: this is invalid for WindowsCE return TargetTriple.getEnvironment() == Triple::GNUEABIHF || TargetTriple.getEnvironment() == Triple::EABIHF || -+ TargetTriple.getEnvironment() == Triple::MuslEABIHF || - isTargetWindows(); ++ TargetTriple.getEnvironment() == Triple::MuslEABIHF || + isTargetWindows() || isAAPCS16_ABI(); } - bool isTargetAndroid() const { + bool isTargetAndroid() const { return TargetTriple.isAndroid(); } diff --git a/lib/Target/ARM/ARMTargetMachine.cpp b/lib/Target/ARM/ARMTargetMachine.cpp -index 7a8181b..ce5ceb9 100644 +index fca1901..25f5cf9 100644 --- a/lib/Target/ARM/ARMTargetMachine.cpp +++ b/lib/Target/ARM/ARMTargetMachine.cpp -@@ -87,6 +87,8 @@ computeTargetABI(const Triple &TT, StringRef CPU, +@@ -101,6 +101,8 @@ computeTargetABI(const Triple &TT, StringRef CPU, case llvm::Triple::GNUEABIHF: case llvm::Triple::EABIHF: case llvm::Triple::EABI: @@ -83,5 +107,6 @@ index 7a8181b..ce5ceb9 100644 TargetABI = ARMBaseTargetMachine::ARM_ABI_AAPCS; break; case llvm::Triple::GNU: --- -2.1.4 +-- +2.7.3 + diff --git a/main/llvm/llvm-0001-fix-shared-build.patch b/main/llvm/llvm-0001-fix-shared-build.patch deleted file mode 100644 index 492c4399ac..0000000000 --- a/main/llvm/llvm-0001-fix-shared-build.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 0d03d2ea17b66d8cb0f6ca5f2181237228535845 Mon Sep 17 00:00:00 2001 -From: Sanjoy Das <sanjoy at azulsystems.com> -Date: Thu Jun 19 15:38:02 2014 -0700 -Subject: 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. ---- - include/llvm/IR/LegacyPassNameParser.h | 2 ++ - lib/IR/Pass.cpp | 2 ++ - 2 files changed, 4 insertions(+) - -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 - // --- -2.1.4 diff --git a/main/llvm/llvm-0002-Fix-build-with-musl-libc.patch b/main/llvm/llvm-0002-Fix-build-with-musl-libc.patch new file mode 100644 index 0000000000..1a69080866 --- /dev/null +++ b/main/llvm/llvm-0002-Fix-build-with-musl-libc.patch @@ -0,0 +1,35 @@ +From 5c571082fdaf61f6df19d9b7137dc26d71334058 Mon Sep 17 00:00:00 2001 +From: Natanael Copa <ncopa@alpinelinux.org> +Date: Thu, 18 Feb 2016 10:33:04 +0100 +Subject: [PATCH 2/3] Fix build with musl libc + +On musl libc the fopen64 and fopen are the same thing, but for +compatibility they have a `#define fopen64 fopen`. Same applies for +fseek64, fstat64, fstatvfs64, ftello64, lstat64, stat64 and tmpfile64. +--- + include/llvm/Analysis/TargetLibraryInfo.h | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/include/llvm/Analysis/TargetLibraryInfo.h b/include/llvm/Analysis/TargetLibraryInfo.h +index 7becdf0..7f14427 100644 +--- a/include/llvm/Analysis/TargetLibraryInfo.h ++++ b/include/llvm/Analysis/TargetLibraryInfo.h +@@ -18,6 +18,15 @@ + #include "llvm/IR/Module.h" + #include "llvm/Pass.h" + ++#undef fopen64 ++#undef fseeko64 ++#undef fstat64 ++#undef fstatvfs64 ++#undef ftello64 ++#undef lstat64 ++#undef stat64 ++#undef tmpfile64 ++ + namespace llvm { + /// VecDesc - Describes a possible vectorization of a function. + /// Function 'VectorFnName' is equivalent to 'ScalarFnName' vectorized +-- +2.7.3 + diff --git a/main/llvm/llvm-0003-Fix-DynamicLibrary-to-build-with-musl-libc.patch b/main/llvm/llvm-0003-Fix-DynamicLibrary-to-build-with-musl-libc.patch new file mode 100644 index 0000000000..d5d7f07b5e --- /dev/null +++ b/main/llvm/llvm-0003-Fix-DynamicLibrary-to-build-with-musl-libc.patch @@ -0,0 +1,33 @@ +From d12ecb83d01dcb580dd94f4d57828f33d3eb4c35 Mon Sep 17 00:00:00 2001 +From: Natanael Copa <ncopa@alpinelinux.org> +Date: Thu, 18 Feb 2016 15:33:21 +0100 +Subject: [PATCH 3/3] Fix DynamicLibrary to build with musl libc + +stdin/out/err is part of the libc and not the kernel so we check for the +specific libc that does the unexpected instead of linux. + +This is needed for making it build with musl libc. +--- + lib/Support/DynamicLibrary.cpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/lib/Support/DynamicLibrary.cpp b/lib/Support/DynamicLibrary.cpp +index 9a7aeb5..0c1c8f8 100644 +--- a/lib/Support/DynamicLibrary.cpp ++++ b/lib/Support/DynamicLibrary.cpp +@@ -140,10 +140,10 @@ void* DynamicLibrary::SearchForAddressOfSymbol(const char *symbolName) { + #define EXPLICIT_SYMBOL(SYM) \ + if (!strcmp(symbolName, #SYM)) return &SYM + +-// On linux we have a weird situation. The stderr/out/in symbols are both ++// On GNU libc 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__) ++#if defined(__GLIBC__) + { + EXPLICIT_SYMBOL(stderr); + EXPLICIT_SYMBOL(stdout); +-- +2.7.3 + diff --git a/main/llvm/llvm-0003-musl-hacks.patch b/main/llvm/llvm-0003-musl-hacks.patch deleted file mode 100644 index 7d3e0a6183..0000000000 --- a/main/llvm/llvm-0003-musl-hacks.patch +++ /dev/null @@ -1,82 +0,0 @@ -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 -@@ -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 --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 -@@ -138,7 +138,7 @@ void* DynamicLibrary::SearchForAddressOfSymbol(const char *symbolName) { - - // This macro returns the address of a well-known, explicit symbol - #define EXPLICIT_SYMBOL(SYM) \ -- if (!strcmp(symbolName, #SYM)) return &SYM -+ if (!strcmp(symbolName, #SYM)) return (void *) &SYM - - // 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 --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 -@@ -416,7 +416,7 @@ static bool printSymbolizedStackTrace(void **StackTrace, int Depth, FILE *FD) { - // 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 --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 -@@ -664,14 +664,15 @@ static void initialize(TargetLibraryInfo &TLI, const Triple &T, - } - - // 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 --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 -@@ -120,6 +120,7 @@ - - #if GTEST_CAN_STREAM_RESULTS_ - # include <arpa/inet.h> // NOLINT -+# include <sys/socket.h> // NOLINT - # include <netdb.h> // NOLINT - #endif - --- -2.1.4 diff --git a/main/llvm/llvm-nm-workaround.patch b/main/llvm/llvm-nm-workaround.patch new file mode 100644 index 0000000000..5755e57ff3 --- /dev/null +++ b/main/llvm/llvm-nm-workaround.patch @@ -0,0 +1,27 @@ +From https://llvm.org/bugs/show_bug.cgi?id=24115 + +diff --git a/tools/llvm-nm/llvm-nm.cpp b/tools/llvm-nm/llvm-nm.cpp +index e7ee312..b9e4779 100644 +--- a/tools/llvm-nm/llvm-nm.cpp ++++ b/tools/llvm-nm/llvm-nm.cpp +@@ -486,7 +486,7 @@ static void sortAndPrintSymbolList(SymbolicFile &Obj, bool printName, + std::string ArchiveName, + std::string ArchitectureName) { + if (!NoSort) { +- std::function<bool(const NMSymbol &, const NMSymbol &)> Cmp; ++ bool (*Cmp)(const NMSymbol &, const NMSymbol &); + if (NumericSort) + Cmp = compareSymbolAddress; + else if (SizeSort) +@@ -495,8 +495,9 @@ static void sortAndPrintSymbolList(SymbolicFile &Obj, bool printName, + Cmp = compareSymbolName; + + if (ReverseSort) +- Cmp = [=](const NMSymbol &A, const NMSymbol &B) { return Cmp(B, A); }; +- std::sort(SymbolList.begin(), SymbolList.end(), Cmp); ++ std::sort(SymbolList.begin(), SymbolList.end(), [=](const NMSymbol &A, const NMSymbol &B) { return Cmp(B, A); }); ++ else ++ std::sort(SymbolList.begin(), SymbolList.end(), Cmp); + } + + if (!PrintFileName) { |