diff options
author | Vladimir Still | 2016-03-20 10:09:06 +0100 |
---|---|---|
committer | Vladimir Still | 2016-03-20 13:31:40 +0100 |
commit | a4454bb39ed3ae463faaba19258234c37410475a (patch) | |
tree | d7e784c4ae665af23518f03d217cc2ea1347f5be | |
download | aur-a4454bb39ed3ae463faaba19258234c37410475a.tar.gz |
Initial version of the package.
-rw-r--r-- | .SRCINFO | 75 | ||||
-rw-r--r-- | .gitignore | 6 | ||||
-rw-r--r-- | PKGBUILD | 303 | ||||
-rw-r--r-- | clang-3.3-use-gold-linker.patch | 12 | ||||
-rw-r--r-- | clang-3.4-fstack-protector-strong.patch | 165 | ||||
-rw-r--r-- | llvm-3.4-provide-cmake-modules.patch | 319 | ||||
-rw-r--r-- | llvm-Config-config.h | 9 | ||||
-rw-r--r-- | llvm-Config-llvm-config.h | 9 |
8 files changed, 898 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..ba0058fe89cd --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,75 @@ +pkgbase = llvm34-split + pkgver = 3.4.2 + pkgrel = 1 + url = http://llvm.org/ + arch = i686 + arch = x86_64 + license = custom:University of Illinois/NCSA Open Source License + makedepends = libffi + makedepends = python2 + makedepends = ocaml + makedepends = python-sphinx + options = staticlibs + source = http://llvm.org/releases/3.4.2/llvm-3.4.2.src.tar.gz + source = http://llvm.org/releases/3.4.2/llvm-3.4.2.src.tar.gz.sig + source = http://llvm.org/releases/3.4.2/cfe-3.4.2.src.tar.gz + source = http://llvm.org/releases/3.4.2/cfe-3.4.2.src.tar.gz.sig + source = http://llvm.org/releases/3.4/clang-tools-extra-3.4.src.tar.gz + source = http://llvm.org/releases/3.4/clang-tools-extra-3.4.src.tar.gz.sig + source = http://llvm.org/releases/3.4/compiler-rt-3.4.src.tar.gz + source = http://llvm.org/releases/3.4/compiler-rt-3.4.src.tar.gz.sig + source = clang-3.3-use-gold-linker.patch + source = clang-3.4-fstack-protector-strong.patch + source = llvm-3.4-provide-cmake-modules.patch + source = llvm-Config-config.h + source = llvm-Config-llvm-config.h + validpgpkeys = 11E521D646982372EB577A1F8F0871F202119294 + validpgpkeys = 54E3BDE33185D9F69664D22455F5CD70BB5A0569 + sha256sums = 17038d47069ad0700c063caed76f0c7259628b0e79651ce2b540d506f2f1efd7 + sha256sums = SKIP + sha256sums = 5ba6f5772f8d00f445209356a7daf83c5bca2da5acd10de517ad2359ae95bc10 + sha256sums = SKIP + sha256sums = ba85187551ae97fe1c8ab569903beae5ff0900e21233e5eb5389f6ceab1028b4 + sha256sums = SKIP + sha256sums = f37c89b1383ce462d47537a0245ac798600887a9be9f63073e16b79ed536ab5c + sha256sums = SKIP + sha256sums = 8240adda155d7961eeb5d07ed50ead10cb7125f70283dff7f1c9fee9df3cea09 + sha256sums = 7a2a1ddc94f67e643c1ab74601ec07deb6d5d344d4b19ed17c900afb2f6f2863 + sha256sums = b6bb154d5ec998328e818bb09acfc6229e41367ba45cea7cc5b2dd2a7c835cf5 + sha256sums = 312574e655f9a87784ca416949c505c452b819fad3061f2cde8aced6540a19a3 + sha256sums = 597dc5968c695bbdbb0eac9e8eb5117fcd2773bc91edf5ec103ecffffab8bc48 + +pkgname = llvm34-split + pkgdesc = LLVM (installed in /usr/lib/llvm-3.4/) + depends = llvm34-libs-split=3.4.2-1 + depends = perl + +pkgname = llvm34-libs-split + pkgdesc = LLVM (runtime library, installed in /usr/lib/llvm-3.4/) + depends = gcc-libs + depends = zlib + depends = libffi + depends = ncurses + +pkgname = llvm34-ocaml-split + pkgdesc = OCaml bindings for LLVM (installed in /usr/lib/llvm-3.4/) + depends = llvm34-split=3.4.2-1 + depends = ocaml + +pkgname = clang34-split + pkgdesc = C language family frontend for LLVM (installed in /usr/lib/llvm-3.4/) + url = http://clang.llvm.org/ + depends = llvm34-split=3.4.2-1 + depends = gcc + +pkgname = clang34-analyzer-split + pkgdesc = A source code analysis framework (installed in /usr/lib/llvm-3.4/) + url = http://clang-analyzer.llvm.org/ + depends = clang34-split=3.4.2-1 + depends = python2 + +pkgname = clang34-tools-extra-split + pkgdesc = Extra tools built using Clang's tooling APIs (installed in /usr/lib/llvm-3.4/) + url = http://clang.llvm.org/ + depends = clang34-split=3.4.2-1 + diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..11e7c045025d --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +*.tar.xz +*.tar.xz.sig +*.swp +*.swo +pkg/ +src/ diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..29b39a3cbcab --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,303 @@ +# $Id$ +# Maintainer: Evangelos Foutras <evangelos@foutrelis.com> +# Contributor: Jan "heftig" Steffens <jan.steffens@gmail.com> +# Contributor: Sebastian Nowicki <sebnow@gmail.com> +# Contributor: Devin Cofer <ranguvar{AT]archlinux[DOT}us> +# Contributor: Tobias Kieslich <tobias@justdreams.de> +# Contributor: Geoffroy Carrier <geoffroy.carrier@aur.archlinux.org> +# Contributor: Tomas Lindquist Olsen <tomas@famolsen.dk> +# Contributor: Roberto Alsina <ralsina@kde.org> +# Contributor: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> + +pkgname=('llvm34-split' 'llvm34-libs-split' 'llvm34-ocaml-split' 'clang34-split' 'clang34-analyzer-split' + 'clang34-tools-extra-split') +pkgver=3.4.2 +_base_ver=3.4 +_prefix="/usr/lib/llvm-${_base_ver}/" +pkgrel=1 +arch=('i686' 'x86_64') +url="http://llvm.org/" +license=('custom:University of Illinois/NCSA Open Source License') +makedepends=('libffi' 'python2' 'ocaml' 'python-sphinx') +options=('staticlibs') +source=(http://llvm.org/releases/$pkgver/llvm-$pkgver.src.tar.gz{,.sig} + http://llvm.org/releases/$pkgver/cfe-$pkgver.src.tar.gz{,.sig} + http://llvm.org/releases/$_base_ver/clang-tools-extra-$_base_ver.src.tar.gz{,.sig} + http://llvm.org/releases/$_base_ver/compiler-rt-$_base_ver.src.tar.gz{,.sig} + clang-3.3-use-gold-linker.patch + clang-3.4-fstack-protector-strong.patch + llvm-3.4-provide-cmake-modules.patch + llvm-Config-config.h + llvm-Config-llvm-config.h) +sha256sums=('17038d47069ad0700c063caed76f0c7259628b0e79651ce2b540d506f2f1efd7' + 'SKIP' + '5ba6f5772f8d00f445209356a7daf83c5bca2da5acd10de517ad2359ae95bc10' + 'SKIP' + 'ba85187551ae97fe1c8ab569903beae5ff0900e21233e5eb5389f6ceab1028b4' + 'SKIP' + 'f37c89b1383ce462d47537a0245ac798600887a9be9f63073e16b79ed536ab5c' + 'SKIP' + '8240adda155d7961eeb5d07ed50ead10cb7125f70283dff7f1c9fee9df3cea09' + '7a2a1ddc94f67e643c1ab74601ec07deb6d5d344d4b19ed17c900afb2f6f2863' + 'b6bb154d5ec998328e818bb09acfc6229e41367ba45cea7cc5b2dd2a7c835cf5' + '312574e655f9a87784ca416949c505c452b819fad3061f2cde8aced6540a19a3' + '597dc5968c695bbdbb0eac9e8eb5117fcd2773bc91edf5ec103ecffffab8bc48') +validpgpkeys=('11E521D646982372EB577A1F8F0871F202119294' + '54E3BDE33185D9F69664D22455F5CD70BB5A0569') + +prepare() { + # Change directory names to release names so we don't need to change the + # whole PKGBUILD + mv llvm-$pkgver{.src,} + mv cfe-$pkgver.src clang-$pkgver + + cd "$srcdir/llvm-$pkgver" + + # At the present, clang must reside inside the LLVM source code tree to build + # See http://llvm.org/bugs/show_bug.cgi?id=4840 + mv "$srcdir/clang-$pkgver" tools/clang + + mv "$srcdir/clang-tools-extra-$_base_ver" tools/clang/tools/extra + + mv "$srcdir/compiler-rt-$_base_ver" projects/compiler-rt + + # Fix docs installation directory + sed -i 's:\$(PROJ_prefix)/docs/llvm:$(PROJ_prefix)/share/doc/llvm:' \ + Makefile.config.in + + # Make -flto work; use ld.gold instead of the default linker + patch -d tools/clang -Np1 -i "$srcdir/clang-3.3-use-gold-linker.patch" + + # Add command line option -fstack-protector-strong + # http://reviews.llvm.org/rL201120 + patch -d tools/clang -Np0 -i "$srcdir/clang-3.4-fstack-protector-strong.patch" + + # Provide CMake modules (FS#38705) + # http://reviews.llvm.org/rL201047 + # http://reviews.llvm.org/rL201048 + # http://reviews.llvm.org/rL201053 + patch -Np0 -i "$srcdir/llvm-3.4-provide-cmake-modules.patch" +} + +build() { + cd "$srcdir/llvm-$pkgver" + + # Apply strip option to configure + _optimized_switch="enable" + [[ $(check_option strip) == n ]] && _optimized_switch="disable" + + # Include location of libffi headers in CPPFLAGS + CPPFLAGS+=" $(pkg-config --cflags libffi)" + + # Force the use of GCC instead of clang + CC=gcc CXX=g++ \ + ./configure \ + --prefix=${_prefix} \ + --sysconfdir=/etc \ + --enable-shared \ + --enable-libffi \ + --enable-targets=all \ + --disable-expensive-checks \ + --disable-debug-runtime \ + --disable-assertions \ + --with-binutils-include=/usr/include \ + --with-python=/usr/bin/python2 \ + --$_optimized_switch-optimized + + make REQUIRES_RTTI=1 + make -C docs -f Makefile.sphinx man + make -C docs -f Makefile.sphinx html + make -C tools/clang/docs -f Makefile.sphinx html +} + +package_llvm34-split() { + pkgdesc="LLVM (installed in /usr/lib/llvm-3.4/)" + depends=("llvm34-libs-split=$pkgver-$pkgrel" 'perl') + + cd "$srcdir/llvm-$pkgver" + + # We move the clang directory out of the tree so it won't get installed and + # then we bring it back in for the clang package + mv tools/clang "$srcdir" + + # -j1 is due to race conditions during the installation of the OCaml bindings + make -j1 DESTDIR="$pkgdir" install + mv "$srcdir/clang" tools + + # The runtime library goes into llvm34-libs-split + mv "$pkgdir${_prefix}/lib/libLLVM-$pkgver.so" "$srcdir/" + mv "$pkgdir${_prefix}/lib/libLLVM-$_base_ver.so" "$srcdir/" + + # OCaml bindings go to a separate package + rm -rf "$srcdir"/{ocaml,ocamldoc} + mv "$pkgdir${_prefix}"/{lib/ocaml,share/doc/llvm/ocamldoc} "$srcdir" + + # Remove duplicate files installed by the OCaml bindings + rm "$pkgdir${_prefix}"/{lib/libllvm*,share/doc/llvm/ocamldoc.tar.gz} + + # Fix permissions of static libs + chmod -x "$pkgdir${_prefix}"/lib/*.a + + # Get rid of example Hello transformation + rm "$pkgdir${_prefix}"/lib/*LLVMHello.* + + # Symlink LLVMgold.so into /usr/lib/bfd-plugins + # (https://bugs.archlinux.org/task/28479) + install -d "$pkgdir${_prefix}/lib/bfd-plugins" + ln -s ../LLVMgold.so "$pkgdir${_prefix}/lib/bfd-plugins/LLVMgold.so" + + if [[ $CARCH == x86_64 ]]; then + # Needed for multilib (https://bugs.archlinux.org/task/29951) + # Header stubs are taken from Fedora + for _header in config llvm-config; do + mv "$pkgdir${_prefix}/include/llvm/Config/$_header"{,-64}.h + cp "$srcdir/llvm-Config-$_header.h" \ + "$pkgdir${_prefix}/include/llvm/Config/$_header.h" + done + fi + + # Install man pages + install -d "$pkgdir${_prefix}/share/man/man1" + cp docs/_build/man/*.1 "$pkgdir${_prefix}/share/man/man1/" + + # Install html docs + cp -r docs/_build/html/* "$pkgdir${_prefix}/share/doc/llvm/html/" + rm -r "$pkgdir${_prefix}/share/doc/llvm/html/_sources" + + install -Dm644 LICENSE.TXT "$pkgdir${_prefix}/share/licenses/llvm/LICENSE" +} + +package_llvm34-libs-split() { + pkgdesc="LLVM (runtime library, installed in /usr/lib/llvm-3.4/)" + depends=('gcc-libs' 'zlib' 'libffi' 'ncurses') + + install -d "$pkgdir${_prefix}/lib" + cp -P \ + "$srcdir/libLLVM-$pkgver.so" \ + "$srcdir/libLLVM-$_base_ver.so" \ + "$pkgdir${_prefix}/lib/" + + install -Dm644 "$srcdir/llvm-$pkgver/LICENSE.TXT" \ + "$pkgdir${_prefix}/share/licenses/llvm-libs/LICENSE" +} + +package_llvm34-ocaml-split() { + pkgdesc="OCaml bindings for LLVM (installed in /usr/lib/llvm-3.4/)" + depends=("llvm34-split=$pkgver-$pkgrel" 'ocaml') + + cd "$srcdir/llvm-$pkgver" + + install -d "$pkgdir${_prefix}"/{lib,share/doc/llvm} + cp -r "$srcdir/ocaml" "$pkgdir${_prefix}/lib" + cp -r "$srcdir/ocamldoc" "$pkgdir${_prefix}/share/doc/llvm" + + # Remove execute bit from static libraries + chmod -x "$pkgdir${_prefix}"/lib/ocaml/libllvm*.a + + install -Dm644 LICENSE.TXT "$pkgdir${_prefix}/share/licenses/llvm-ocaml/LICENSE" +} + +package_clang34-split() { + pkgdesc="C language family frontend for LLVM (installed in /usr/lib/llvm-3.4/)" + url="http://clang.llvm.org/" + depends=("llvm34-split=$pkgver-$pkgrel" 'gcc') + + # Fix installation path for clang docs + sed -i 's:$(PROJ_prefix)/share/doc/llvm:$(PROJ_prefix)/share/doc/clang:' \ + "$srcdir/llvm-$pkgver/Makefile.config" + + cd "$srcdir/llvm-$pkgver/tools/clang" + + # We move the extra tools directory out of the tree so it won't get + # installed and then we bring it back in for the clang-tools-extra package + mv tools/extra "$srcdir" + + make DESTDIR="$pkgdir" install + mv "$srcdir/extra" tools/ + + # Fix permissions of static libs + chmod -x "$pkgdir${_prefix}"/lib/*.a + + # Revert the path change in case we want to do a repackage later + sed -i 's:$(PROJ_prefix)/share/doc/clang:$(PROJ_prefix)/share/doc/llvm:' \ + "$srcdir/llvm-$pkgver/Makefile.config" + + # Install html docs + cp -r docs/_build/html/* "$pkgdir${_prefix}/share/doc/clang/html/" + rm -r "$pkgdir${_prefix}/share/doc/clang/html/_sources" + + # Install Python bindings + install -d "$pkgdir${_prefix}/lib/python2.7/site-packages" + cp -r bindings/python/clang "$pkgdir${_prefix}/lib/python2.7/site-packages/" + python2 -m compileall "$pkgdir${_prefix}/lib/python2.7/site-packages/clang" + python2 -O -m compileall "$pkgdir${_prefix}/lib/python2.7/site-packages/clang" + + # Install clang-format editor integration files (FS#38485) + # Destination paths are copied from clang-format/CMakeLists.txt + install -d "$pkgdir${_prefix}/share/clang" + ( + cd tools/clang-format + cp \ + clang-format-diff.py \ + clang-format-sublime.py \ + clang-format.el \ + clang-format.py \ + "$pkgdir${_prefix}/share/clang/" + cp git-clang-format "$pkgdir${_prefix}/bin/" + sed -i 's|/usr/bin/python$|&2|' "$pkgdir${_prefix}/bin/git-clang-format" + ) + + install -Dm644 LICENSE.TXT "$pkgdir${_prefix}/share/licenses/clang/LICENSE" +} + +package_clang34-analyzer-split() { + pkgdesc="A source code analysis framework (installed in /usr/lib/llvm-3.4/)" + url="http://clang-analyzer.llvm.org/" + depends=("clang34-split=$pkgver-$pkgrel" 'python2') + + cd "$srcdir/llvm-$pkgver/tools/clang" + + install -d "$pkgdir${_prefix}"/{bin,lib/clang-analyzer} + for _tool in scan-{build,view}; do + cp -r tools/$_tool "$pkgdir${_prefix}/lib/clang-analyzer/" + ln -s ${_prefix}/lib/clang-analyzer/$_tool/$_tool "$pkgdir${_prefix}/bin/" + done + + # scan-build looks for clang within the same directory + ln -s ${_prefix}/bin/clang "$pkgdir${_prefix}/lib/clang-analyzer/scan-build/" + + # Relocate man page + install -d "$pkgdir${_prefix}/share/man/man1" + mv "$pkgdir${_prefix}/lib/clang-analyzer/scan-build/scan-build.1" \ + "$pkgdir${_prefix}/share/man/man1/" + + # Use Python 2 + sed -i \ + -e 's|env python$|&2|' \ + -e 's|/usr/bin/python$|&2|' \ + "$pkgdir${_prefix}/lib/clang-analyzer/scan-view/scan-view" \ + "$pkgdir${_prefix}/lib/clang-analyzer/scan-build/set-xcode-analyzer" + + # Compile Python scripts + python2 -m compileall "$pkgdir${_prefix}/lib/clang-analyzer" + python2 -O -m compileall "$pkgdir${_prefix}/lib/clang-analyzer" + + install -Dm644 LICENSE.TXT "$pkgdir${_prefix}/share/licenses/clang-analyzer/LICENSE" +} + +package_clang34-tools-extra-split() { + pkgdesc="Extra tools built using Clang's tooling APIs (installed in /usr/lib/llvm-3.4/)" + url="http://clang.llvm.org/" + depends=("clang34-split=$pkgver-$pkgrel") + + cd "$srcdir/llvm-$pkgver/tools/clang/tools/extra" + + make DESTDIR="$pkgdir" install + + # Fix permissions of static libs + chmod -x "$pkgdir${_prefix}"/lib/*.a + + install -Dm644 LICENSE.TXT "$pkgdir${_prefix}/share/licenses/clang-tools-extra/LICENSE" +} + +# vim:set ts=2 sw=2 et: diff --git a/clang-3.3-use-gold-linker.patch b/clang-3.3-use-gold-linker.patch new file mode 100644 index 000000000000..76905a64e69b --- /dev/null +++ b/clang-3.3-use-gold-linker.patch @@ -0,0 +1,12 @@ +diff -upr cfe.src.orig/lib/Driver/ToolChains.cpp cfe.src/lib/Driver/ToolChains.cpp +--- cfe.src.orig/lib/Driver/ToolChains.cpp 2013-06-08 16:17:19.000000000 +0300 ++++ cfe.src/lib/Driver/ToolChains.cpp 2013-06-08 16:17:33.000000000 +0300 +@@ -2220,7 +2220,7 @@ Linux::Linux(const Driver &D, const llvm + PPaths.push_back(Twine(GCCInstallation.getParentLibPath() + "/../" + + GCCInstallation.getTriple().str() + "/bin").str()); + +- Linker = GetProgramPath("ld"); ++ Linker = GetProgramPath("ld.gold"); + + Distro Distro = DetectDistro(Arch); + diff --git a/clang-3.4-fstack-protector-strong.patch b/clang-3.4-fstack-protector-strong.patch new file mode 100644 index 000000000000..bda41fe1badb --- /dev/null +++ b/clang-3.4-fstack-protector-strong.patch @@ -0,0 +1,165 @@ +Index: test/Driver/stack-protector.c +=================================================================== +--- test/Driver/stack-protector.c (revision 201119) ++++ test/Driver/stack-protector.c (revision 201120) +@@ -15,3 +15,11 @@ + + // RUN: %clang -target i386-pc-openbsd -fno-stack-protector -### %s 2>&1 | FileCheck %s -check-prefix=OPENBSD_OFF + // OPENBSD_OFF-NOT: "-stack-protector" ++ ++// RUN: %clang -fstack-protector-strong -### %s 2>&1 | FileCheck %s -check-prefix=SSP-STRONG ++// SSP-STRONG: "-stack-protector" "2" ++// SSP-STRONG-NOT: "-stack-protector-buffer-size" ++ ++// 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" +Index: test/CodeGen/stack-protector.c +=================================================================== +--- test/CodeGen/stack-protector.c (revision 201119) ++++ test/CodeGen/stack-protector.c (revision 201120) +@@ -2,7 +2,9 @@ + // NOSSP: define void @test1(i8* %msg) #0 { + // RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 1 | FileCheck -check-prefix=WITHSSP %s + // WITHSSP: define void @test1(i8* %msg) #0 { +-// RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 2 | FileCheck -check-prefix=SSPREQ %s ++// RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 2 | FileCheck -check-prefix=SSPSTRONG %s ++// SSPSTRONG: define void @test1(i8* %msg) #0 { ++// RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 3 | FileCheck -check-prefix=SSPREQ %s + // SSPREQ: define void @test1(i8* %msg) #0 { + + typedef __SIZE_TYPE__ size_t; +@@ -21,4 +23,6 @@ + + // WITHSSP: attributes #{{.*}} = { nounwind ssp{{.*}} } + ++// SSPSTRONG: attributes #{{.*}} = { nounwind sspstrong{{.*}} } ++ + // SSPREQ: attributes #{{.*}} = { nounwind sspreq{{.*}} } +Index: include/clang/Basic/LangOptions.h +=================================================================== +--- include/clang/Basic/LangOptions.h (revision 201119) ++++ include/clang/Basic/LangOptions.h (revision 201120) +@@ -58,7 +58,7 @@ + typedef clang::Visibility Visibility; + + enum GCMode { NonGC, GCOnly, HybridGC }; +- enum StackProtectorMode { SSPOff, SSPOn, SSPReq }; ++ enum StackProtectorMode { SSPOff, SSPOn, SSPStrong, SSPReq }; + + enum SignedOverflowBehaviorTy { + SOB_Undefined, // Default C standard behavior. +Index: include/clang/Driver/ToolChain.h +=================================================================== +--- include/clang/Driver/ToolChain.h (revision 201119) ++++ include/clang/Driver/ToolChain.h (revision 201120) +@@ -196,7 +196,7 @@ + virtual bool UseObjCMixedDispatch() const { return false; } + + /// GetDefaultStackProtectorLevel - Get the default stack protector level for +- /// this tool chain (0=off, 1=on, 2=all). ++ /// this tool chain (0=off, 1=on, 2=strong, 3=all). + virtual unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const { + return 0; + } +Index: include/clang/Driver/Options.td +=================================================================== +--- include/clang/Driver/Options.td (revision 201119) ++++ include/clang/Driver/Options.td (revision 201120) +@@ -675,7 +675,8 @@ + Flags<[CC1Option]>, HelpText<"Do not include source location information with diagnostics">; + def fno_spell_checking : Flag<["-"], "fno-spell-checking">, Group<f_Group>, + Flags<[CC1Option]>, HelpText<"Disable spell-checking">; +-def fno_stack_protector : Flag<["-"], "fno-stack-protector">, Group<f_Group>; ++def fno_stack_protector : Flag<["-"], "fno-stack-protector">, Group<f_Group>, ++ HelpText<"Disable the use of stack protectors">; + def fno_strict_aliasing : Flag<["-"], "fno-strict-aliasing">, Group<f_Group>; + def fstruct_path_tbaa : Flag<["-"], "fstruct-path-tbaa">, Group<f_Group>; + def fno_struct_path_tbaa : Flag<["-"], "fno-struct-path-tbaa">, Group<f_Group>; +@@ -773,8 +774,12 @@ + def fno_signed_char : Flag<["-"], "fno-signed-char">, Flags<[CC1Option]>, + Group<clang_ignored_f_Group>, HelpText<"Char is unsigned">; + def fsplit_stack : Flag<["-"], "fsplit-stack">, Group<f_Group>; +-def fstack_protector_all : Flag<["-"], "fstack-protector-all">, Group<f_Group>; +-def fstack_protector : Flag<["-"], "fstack-protector">, Group<f_Group>; ++def fstack_protector_all : Flag<["-"], "fstack-protector-all">, Group<f_Group>, ++ HelpText<"Force the usage of stack protectors for all functions">; ++def fstack_protector_strong : Flag<["-"], "fstack-protector-strong">, Group<f_Group>, ++ HelpText<"Use a strong heuristic to apply stack protectors to functions">; ++def fstack_protector : Flag<["-"], "fstack-protector">, Group<f_Group>, ++ HelpText<"Enable stack protectors for functions potentially vulnerable to stack smashing">; + def fstrict_aliasing : Flag<["-"], "fstrict-aliasing">, Group<f_Group>; + def fstrict_enums : Flag<["-"], "fstrict-enums">, Group<f_Group>, Flags<[CC1Option]>, + HelpText<"Enable optimizations based on the strict definition of an enum's " +Index: lib/Frontend/CompilerInvocation.cpp +=================================================================== +--- lib/Frontend/CompilerInvocation.cpp (revision 201119) ++++ lib/Frontend/CompilerInvocation.cpp (revision 201120) +@@ -1435,7 +1435,8 @@ + break; + case 0: Opts.setStackProtector(LangOptions::SSPOff); break; + case 1: Opts.setStackProtector(LangOptions::SSPOn); break; +- case 2: Opts.setStackProtector(LangOptions::SSPReq); break; ++ case 2: Opts.setStackProtector(LangOptions::SSPStrong); break; ++ case 3: Opts.setStackProtector(LangOptions::SSPReq); break; + } + + // Parse -fsanitize= arguments. +Index: lib/Frontend/InitPreprocessor.cpp +=================================================================== +--- lib/Frontend/InitPreprocessor.cpp (revision 201119) ++++ lib/Frontend/InitPreprocessor.cpp (revision 201120) +@@ -695,8 +695,10 @@ + + if (LangOpts.getStackProtector() == LangOptions::SSPOn) + Builder.defineMacro("__SSP__"); ++ else if (LangOpts.getStackProtector() == LangOptions::SSPStrong) ++ Builder.defineMacro("__SSP_STRONG__", "2"); + else if (LangOpts.getStackProtector() == LangOptions::SSPReq) +- Builder.defineMacro("__SSP_ALL__", "2"); ++ Builder.defineMacro("__SSP_ALL__", "3"); + + if (FEOpts.ProgramAction == frontend::RewriteObjC) + Builder.defineMacro("__weak", "__attribute__((objc_gc(weak)))"); +Index: lib/Driver/Tools.cpp +=================================================================== +--- lib/Driver/Tools.cpp (revision 201119) ++++ lib/Driver/Tools.cpp (revision 201120) +@@ -10,6 +10,7 @@ + #include "Tools.h" + #include "InputInfo.h" + #include "ToolChains.h" ++#include "clang/Basic/LangOptions.h" + #include "clang/Basic/ObjCRuntime.h" + #include "clang/Basic/Version.h" + #include "clang/Driver/Action.h" +@@ -3114,11 +3115,14 @@ + unsigned StackProtectorLevel = 0; + if (Arg *A = Args.getLastArg(options::OPT_fno_stack_protector, + options::OPT_fstack_protector_all, ++ options::OPT_fstack_protector_strong, + options::OPT_fstack_protector)) { + if (A->getOption().matches(options::OPT_fstack_protector)) +- StackProtectorLevel = 1; ++ StackProtectorLevel = LangOptions::SSPOn; ++ else if (A->getOption().matches(options::OPT_fstack_protector_strong)) ++ StackProtectorLevel = LangOptions::SSPStrong; + else if (A->getOption().matches(options::OPT_fstack_protector_all)) +- StackProtectorLevel = 2; ++ StackProtectorLevel = LangOptions::SSPReq; + } else { + StackProtectorLevel = + getToolChain().GetDefaultStackProtectorLevel(KernelOrKext); +Index: lib/CodeGen/CodeGenModule.cpp +=================================================================== +--- lib/CodeGen/CodeGenModule.cpp (revision 201119) ++++ lib/CodeGen/CodeGenModule.cpp (revision 201120) +@@ -651,6 +651,8 @@ + + if (LangOpts.getStackProtector() == LangOptions::SSPOn) + B.addAttribute(llvm::Attribute::StackProtect); ++ else if (LangOpts.getStackProtector() == LangOptions::SSPStrong) ++ B.addAttribute(llvm::Attribute::StackProtectStrong); + else if (LangOpts.getStackProtector() == LangOptions::SSPReq) + B.addAttribute(llvm::Attribute::StackProtectReq); + diff --git a/llvm-3.4-provide-cmake-modules.patch b/llvm-3.4-provide-cmake-modules.patch new file mode 100644 index 000000000000..1b1244885e41 --- /dev/null +++ b/llvm-3.4-provide-cmake-modules.patch @@ -0,0 +1,319 @@ +Index: cmake/modules/LLVMConfig.cmake.in +=================================================================== +--- cmake/modules/LLVMConfig.cmake.in (revision 201046) ++++ cmake/modules/LLVMConfig.cmake.in (revision 201047) +@@ -41,16 +41,6 @@ + set(LLVM_LIBRARY_DIRS ${LLVM_INSTALL_PREFIX}/lib) + set(LLVM_DEFINITIONS "-D__STDC_LIMIT_MACROS" "-D__STDC_CONSTANT_MACROS") + +-# We try to include using the current setting of CMAKE_MODULE_PATH, +-# which suppossedly was filled by the user with the directory where +-# this file was installed: +-include( LLVM-Config OPTIONAL RESULT_VARIABLE LLVMCONFIG_INCLUDED ) +- +-# If failed, we assume that this is an un-installed build: +-if( NOT LLVMCONFIG_INCLUDED ) +- set(CMAKE_MODULE_PATH +- ${CMAKE_MODULE_PATH} +- "@LLVM_SOURCE_DIR@/cmake/modules") +- include( LLVM-Config ) +-endif() +- ++get_filename_component(_SELF_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) ++include(${_SELF_DIR}/LLVM-Config.cmake) ++unset(_SELF_DIR) +Index: cmake/modules/LLVMConfig.cmake.in +=================================================================== +--- cmake/modules/LLVMConfig.cmake.in (revision 201047) ++++ cmake/modules/LLVMConfig.cmake.in (revision 201048) +@@ -1,5 +1,7 @@ + # This file provides information and services to the final user. + ++@LLVM_CONFIG_CODE@ ++ + set(LLVM_VERSION_MAJOR @LLVM_VERSION_MAJOR@) + set(LLVM_VERSION_MINOR @LLVM_VERSION_MINOR@) + set(LLVM_PACKAGE_VERSION @PACKAGE_VERSION@) +@@ -36,11 +38,9 @@ + set(LLVM_ON_UNIX @LLVM_ON_UNIX@) + set(LLVM_ON_WIN32 @LLVM_ON_WIN32@) + +-set(LLVM_INSTALL_PREFIX "@LLVM_INSTALL_PREFIX@") +-set(LLVM_INCLUDE_DIRS ${LLVM_INSTALL_PREFIX}/include) +-set(LLVM_LIBRARY_DIRS ${LLVM_INSTALL_PREFIX}/lib) ++set(LLVM_INCLUDE_DIRS "@LLVM_CONFIG_INCLUDE_DIRS@") ++set(LLVM_LIBRARY_DIRS "@LLVM_CONFIG_LIBRARY_DIRS@") + set(LLVM_DEFINITIONS "-D__STDC_LIMIT_MACROS" "-D__STDC_CONSTANT_MACROS") ++set(LLVM_CMAKE_DIR "@LLVM_CONFIG_CMAKE_DIR@") + +-get_filename_component(_SELF_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) +-include(${_SELF_DIR}/LLVM-Config.cmake) +-unset(_SELF_DIR) ++include(${LLVM_CMAKE_DIR}/LLVM-Config.cmake) +Index: utils/llvm-build/llvmbuild/main.py +=================================================================== +--- utils/llvm-build/llvmbuild/main.py (revision 201052) ++++ utils/llvm-build/llvmbuild/main.py (revision 201053) +@@ -573,6 +573,40 @@ + + f.close() + ++ def write_cmake_exports_fragment(self, output_path): ++ """ ++ write_cmake_exports_fragment(output_path) -> None ++ ++ Generate a CMake fragment which includes LLVMBuild library ++ dependencies expressed similarly to how CMake would write ++ them via install(EXPORT). ++ """ ++ ++ dependencies = list(self.get_fragment_dependencies()) ++ ++ # Write out the CMake exports fragment. ++ make_install_dir(os.path.dirname(output_path)) ++ f = open(output_path, 'w') ++ ++ f.write("""\ ++# Explicit library dependency information. ++# ++# The following property assignments tell CMake about link ++# dependencies of libraries imported from LLVM. ++""") ++ for ci in self.ordered_component_infos: ++ # We only write the information for libraries currently. ++ if ci.type_name != 'Library': ++ continue ++ ++ f.write("""\ ++set_property(TARGET %s PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES %s)\n""" % ( ++ ci.get_prefixed_library_name(), " ".join(sorted( ++ dep.get_prefixed_library_name() ++ for dep in self.get_required_libraries_for_component(ci))))) ++ ++ f.close() ++ + def write_make_fragment(self, output_path): + """ + write_make_fragment(output_path) -> None +@@ -780,6 +814,10 @@ + dest="write_cmake_fragment", metavar="PATH", + help="Write the CMake project information to PATH", + action="store", default=None) ++ group.add_option("", "--write-cmake-exports-fragment", ++ dest="write_cmake_exports_fragment", metavar="PATH", ++ help="Write the CMake exports information to PATH", ++ action="store", default=None) + group.add_option("", "--write-make-fragment", + dest="write_make_fragment", metavar="PATH", + help="Write the Makefile project information to PATH", +@@ -861,6 +899,8 @@ + # Write out the cmake fragment, if requested. + if opts.write_cmake_fragment: + project_info.write_cmake_fragment(opts.write_cmake_fragment) ++ if opts.write_cmake_exports_fragment: ++ project_info.write_cmake_exports_fragment(opts.write_cmake_exports_fragment) + + # Configure target definition files, if requested. + if opts.configure_target_def_files: +Index: Makefile.rules +=================================================================== +--- Makefile.rules (revision 201052) ++++ Makefile.rules (revision 201053) +@@ -78,6 +78,12 @@ + + # The files we are going to generate using llvm-build. + LLVMBuildMakeFrag := $(PROJ_OBJ_ROOT)/Makefile.llvmbuild ++LLVMBuildCMakeFrag := $(PROJ_OBJ_ROOT)/LLVMBuild.cmake ++LLVMBuildCMakeExportsFrag := $(PROJ_OBJ_ROOT)/cmake/modules/LLVMBuildExports.cmake ++LLVMBuildMakeFrags := \ ++ $(LLVMBuildMakeFrag) \ ++ $(LLVMBuildCMakeFrag) \ ++ $(LLVMBuildCMakeExportsFrag) + LLVMConfigLibraryDependenciesInc := \ + $(PROJ_OBJ_ROOT)/tools/llvm-config/LibraryDependencies.inc + +@@ -94,8 +100,8 @@ + # + # We include a dependency on this Makefile to ensure that changes to the + # generation command get picked up. +-$(LLVMBuildMakeFrag): $(PROJ_SRC_ROOT)/Makefile.rules \ +- $(PROJ_OBJ_ROOT)/Makefile.config ++$(LLVMBuildMakeFrags): $(PROJ_SRC_ROOT)/Makefile.rules \ ++ $(PROJ_OBJ_ROOT)/Makefile.config + $(Echo) Constructing LLVMBuild project information. + $(Verb)$(PYTHON) $(LLVMBuildTool) \ + --native-target "$(TARGET_NATIVE_ARCH)" \ +@@ -102,10 +108,12 @@ + --enable-targets "$(TARGETS_TO_BUILD)" \ + --enable-optional-components "$(OPTIONAL_COMPONENTS)" \ + --write-library-table $(LLVMConfigLibraryDependenciesInc) \ +- --write-make-fragment $(LLVMBuildMakeFrag) ++ --write-make-fragment $(LLVMBuildMakeFrag) \ ++ --write-cmake-fragment $(LLVMBuildCMakeFrag) \ ++ --write-cmake-exports-fragment $(LLVMBuildCMakeExportsFrag) + + # For completeness, let Make know how the extra files are generated. +-$(LLVMConfigLibraryDependenciesInc): $(LLVMBuildMakeFrag) ++$(LLVMConfigLibraryDependenciesInc): $(LLVMBuildMakeFrags) + + # Include the generated Makefile fragment. + # +@@ -120,7 +128,7 @@ + + # Clean the generated makefile fragment at the top-level. + clean-local:: +- -$(Verb) $(RM) -f $(LLVMBuildMakeFrag) ++ -$(Verb) $(RM) -f $(LLVMBuildMakeFrags) + endif + -include $(LLVMBuildMakeFrag) + +Index: Makefile +=================================================================== +--- Makefile (revision 201052) ++++ Makefile (revision 201053) +@@ -15,7 +15,7 @@ + # 3. Build IR, which builds the Intrinsics.inc file used by libs. + # 4. Build libs, which are needed by llvm-config. + # 5. Build llvm-config, which determines inter-lib dependencies for tools. +-# 6. Build tools and docs. ++# 6. Build tools, docs, and cmake modules. + # + # When cross-compiling, there are some things (tablegen) that need to + # be build for the build system first. +@@ -31,7 +31,7 @@ + OPTIONAL_DIRS := tools/clang/utils/TableGen + else + DIRS := lib/Support lib/TableGen utils lib/IR lib tools/llvm-shlib \ +- tools/llvm-config tools docs unittests ++ tools/llvm-config tools docs cmake unittests + OPTIONAL_DIRS := projects bindings + endif + +Index: cmake/modules/Makefile +=================================================================== +--- cmake/modules/Makefile (revision 0) ++++ cmake/modules/Makefile (revision 201053) +@@ -0,0 +1,106 @@ ++##===- cmake/modules/Makefile ------------------------------*- Makefile -*-===## ++# ++# The LLVM Compiler Infrastructure ++# ++# This file is distributed under the University of Illinois Open Source ++# License. See LICENSE.TXT for details. ++# ++##===----------------------------------------------------------------------===## ++ ++LEVEL = ../.. ++ ++LINK_COMPONENTS := all ++ ++include $(LEVEL)/Makefile.common ++ ++PROJ_cmake := $(DESTDIR)$(PROJ_prefix)/share/llvm/cmake ++ ++OBJMODS := LLVMConfig.cmake LLVMConfigVersion.cmake LLVMExports.cmake ++ ++# TODO: Teach LLVM-Config.cmake to work without explicit terminfo libs. ++TERMINFO_LIBS := tinfo terminfo curses ncurses ncursesw ++TERMINFO_LIBS := $(filter $(TERMINFO_LIBS),$(subst -l,,$(LIBS))) ++ ++$(PROJ_OBJ_DIR)/LLVMConfig.cmake: LLVMConfig.cmake.in $(LLVMBuildCMakeFrag) ++ $(Echo) 'Generating LLVM CMake package config file' ++ $(Verb) ( \ ++ cat $< | sed \ ++ -e 's/@LLVM_CONFIG_CODE@/set(LLVM_INSTALL_PREFIX "'"$(subst /,\/,$(PROJ_prefix))"'")/' \ ++ -e 's/@LLVM_VERSION_MAJOR@/'"$(LLVM_VERSION_MAJOR)"'/' \ ++ -e 's/@LLVM_VERSION_MINOR@/'"$(LLVM_VERSION_MINOR)"'/' \ ++ -e 's/@PACKAGE_VERSION@/'"$(LLVMVersion)"'/' \ ++ -e 's/@LLVM_COMMON_DEPENDS@//' \ ++ -e 's/"@llvm_libs@"/'"$(subst -l,,$(LLVMConfigLibs))"'/' \ ++ -e 's/@LLVM_ALL_TARGETS@/'"$(ALL_TARGETS)"'/' \ ++ -e 's/@LLVM_TARGETS_TO_BUILD@/'"$(TARGETS_TO_BUILD)"'/' \ ++ -e 's/@LLVM_TARGETS_WITH_JIT@/'"$(TARGETS_WITH_JIT)"'/' \ ++ -e 's/@TARGET_TRIPLE@/'"$(TARGET_TRIPLE)"'/' \ ++ -e 's/@LLVM_ENABLE_TERMINFO@/'"$(ENABLE_TERMINFO)"'/' \ ++ -e 's/@LLVM_ENABLE_THREADS@/'"$(ENABLE_THREADS)"'/' \ ++ -e 's/@LLVM_ENABLE_ZLIB@/'"$(ENABLE_ZLIB)"'/' \ ++ -e 's/@LLVM_NATIVE_ARCH@/'"$(LLVM_NATIVE_ARCH)"'/' \ ++ -e 's/@LLVM_ENABLE_PIC@/'"$(ENABLE_PIC)"'/' \ ++ -e 's/@HAVE_TERMINFO@/'"$(HAVE_TERMINFO)"'/' \ ++ -e 's/@TERMINFO_LIBS@/'"$(TERMINFO_LIBS)"'/' \ ++ -e 's/@HAVE_LIBDL@/'"$(HAVE_DLOPEN)"'/' \ ++ -e 's/@HAVE_LIBPTHREAD@/'"$(HAVE_PTHREAD)"'/' \ ++ -e 's/@HAVE_LIBZ@/'"$(HAVE_LIBZ)"'/' \ ++ -e 's/@LLVM_ON_UNIX@/'"$(LLVM_ON_UNIX)"'/' \ ++ -e 's/@LLVM_ON_WIN32@/'"$(LLVM_ON_WIN32)"'/' \ ++ -e 's/@LLVM_CONFIG_INCLUDE_DIRS@/'"$(subst /,\/,$(PROJ_includedir))"'/' \ ++ -e 's/@LLVM_CONFIG_LIBRARY_DIRS@/'"$(subst /,\/,$(PROJ_libdir))"'/' \ ++ -e 's/@LLVM_CONFIG_CMAKE_DIR@/'"$(subst /,\/,$(PROJ_cmake))"'/' \ ++ -e 's/@LLVM_CONFIG_EXPORTS_FILE@/$${LLVM_CMAKE_DIR}\/LLVMExports.cmake/' \ ++ -e 's/@all_llvm_lib_deps@//' \ ++ && \ ++ # TODO: Teach LLVM-Config.cmake to use builtin CMake features \ ++ # for library dependencies. For now add the generated fragments. \ ++ grep '^set_property.*LLVMBUILD_LIB_DEPS_' "$(LLVMBuildCMakeFrag)" \ ++ ) > $@ ++ ++$(PROJ_OBJ_DIR)/LLVMConfigVersion.cmake: LLVMConfigVersion.cmake.in ++ $(Echo) 'Generating LLVM CMake package version file' ++ $(Verb) cat $< | sed \ ++ -e 's/@PACKAGE_VERSION@/'"$(LLVMVersion)"'/' \ ++ > $@ ++ ++$(PROJ_OBJ_DIR)/LLVMExports.cmake: $(LLVMBuildCMakeExportsFrag) ++ $(Echo) 'Generating LLVM CMake target exports file' ++ $(Verb) ( \ ++ echo '# LLVM CMake target exports. Do not include directly.' && \ ++ for lib in $(subst -l,,$(LLVMConfigLibs)); do \ ++ echo 'add_library('"$$lib"' STATIC IMPORTED)' && \ ++ echo 'set_property(TARGET '"$$lib"' PROPERTY IMPORTED_LOCATION "'"$(PROJ_libdir)/lib$$lib.a"'")' ; \ ++ done && \ ++ cat "$(LLVMBuildCMakeExportsFrag)" \ ++ ) > $@ ++ ++all-local:: $(addprefix $(PROJ_OBJ_DIR)/, $(OBJMODS)) ++ ++SKIPSRCMODS := \ ++ CheckAtomic.cmake \ ++ GetHostTriple.cmake \ ++ LLVMBuildExports.cmake \ ++ LLVMConfig.cmake \ ++ LLVMConfigVersion.cmake \ ++ LLVMExports.cmake \ ++ VersionFromVCS.cmake ++ ++SRCMODS := $(notdir $(wildcard $(PROJ_SRC_DIR)/*.cmake)) ++SRCMODS := $(filter-out $(SKIPSRCMODS),$(SRCMODS)) ++INSTSRCMODS := $(addprefix $(PROJ_cmake)/, $(SRCMODS)) ++INSTOBJMODS := $(addprefix $(PROJ_cmake)/, $(OBJMODS)) ++ ++$(PROJ_cmake): ++ $(Echo) Making install directory: $@ ++ $(Verb) $(MKDIR) $@ ++ ++$(INSTSRCMODS): $(PROJ_cmake)/%.cmake: $(PROJ_SRC_DIR)/%.cmake | $(PROJ_cmake) ++ $(Echo) Installing cmake modules: $(notdir $<) ++ $(Verb) $(DataInstall) $< $(PROJ_cmake) ++ ++$(INSTOBJMODS): $(PROJ_cmake)/%.cmake: $(PROJ_OBJ_DIR)/%.cmake | $(PROJ_cmake) ++ $(Echo) Installing cmake modules: $(notdir $<) ++ $(Verb) $(DataInstall) $< $(PROJ_cmake) ++ ++install-local:: $(INSTSRCMODS) $(INSTOBJMODS) +Index: cmake/Makefile +=================================================================== +--- cmake/Makefile (revision 0) ++++ cmake/Makefile (revision 201053) +@@ -0,0 +1,12 @@ ++##===- cmake/Makefile --------------------------------------*- Makefile -*-===## ++# ++# The LLVM Compiler Infrastructure ++# ++# This file is distributed under the University of Illinois Open Source ++# License. See LICENSE.TXT for details. ++# ++##===----------------------------------------------------------------------===## ++LEVEL = .. ++DIRS := modules ++ ++include $(LEVEL)/Makefile.common diff --git a/llvm-Config-config.h b/llvm-Config-config.h new file mode 100644 index 000000000000..c369b4551f78 --- /dev/null +++ b/llvm-Config-config.h @@ -0,0 +1,9 @@ +#include <bits/wordsize.h> + +#if __WORDSIZE == 32 +#include "config-32.h" +#elif __WORDSIZE == 64 +#include "config-64.h" +#else +#error "Unknown word size" +#endif diff --git a/llvm-Config-llvm-config.h b/llvm-Config-llvm-config.h new file mode 100644 index 000000000000..2fa08c9be696 --- /dev/null +++ b/llvm-Config-llvm-config.h @@ -0,0 +1,9 @@ +#include <bits/wordsize.h> + +#if __WORDSIZE == 32 +#include "llvm-config-32.h" +#elif __WORDSIZE == 64 +#include "llvm-config-64.h" +#else +#error "Unknown word size" +#endif |