Commit f3a60920 authored by Chaoting Liu's avatar Chaoting Liu

llvm/clang stack: update to 6.0.0 (see detail)

llvm now split to different packages

- llvm, llvm-libs (in dir llvm/): the main llvm lib and functional part
- lld: (dynamic) linker of llvm
- lldb: debugger of llvm
- compiler-rt: runtime compiler lib for clang to build and run
- clang: C/C++ compiler from llvm project

they should stay in same release version
the update sequence is:
(optional ocaml group->) llvm -> lld -> compiler-rt -> clang
parent 0e2a24cd
# $Id$
# Maintainer: Evangelos Foutras <evangelos@foutrelis.com>
# Contributor: Jan "heftig" Steffens <jan.steffens@gmail.com>
pkgname=clang
pkgver=6.0.0
pkgrel=1
pkgdesc="C language family frontend for LLVM"
arch=('x86_64')
url="https://clang.llvm.org/"
license=('custom:University of Illinois/NCSA Open Source License')
depends=('llvm-libs' 'gcc' 'compiler-rt')
makedepends=('llvm' 'cmake' 'ninja' 'python3-sphinx')
optdepends=('openmp: OpenMP support in clang with -fopenmp'
'python: for git-clang-format'
'python2: for scan-view')
provides=("clang-analyzer=$pkgver" "clang-tools-extra=$pkgver")
conflicts=('clang-analyzer' 'clang-tools-extra')
replaces=('clang-analyzer' 'clang-tools-extra')
source=(https://releases.llvm.org/$pkgver/cfe-$pkgver.src.tar.xz{,.sig}
https://releases.llvm.org/$pkgver/clang-tools-extra-$pkgver.src.tar.xz{,.sig}
https://releases.llvm.org/$pkgver/llvm-$pkgver.src.tar.xz{,.sig}
enable-SSP-and-PIE-by-default.patch)
sha256sums=('e07d6dd8d9ef196cfc8e8bb131cbd6a2ed0b1caf1715f9d05b0f0eeaddb6df32'
'SKIP'
'053b424a4cd34c9335d8918734dd802a8da612d13a26bbb88fcdf524b2d989d2'
'SKIP'
'1ff53c915b4e761ef400b803f07261ade637b0c269d99569f18040f3dcee4408'
'SKIP'
'28d38b7f4bcaa0c974f8c48d732a0db309ea89ffa901c39de90725ae857946c1')
validpgpkeys+=('B6C8F98282B944E3B0D5C2530FC3042E345AD05D') # Hans Wennborg <hans@chromium.org>
validpgpkeys+=('11E521D646982372EB577A1F8F0871F202119294') # Tom Stellard <tom@stellard.net>
prepare() {
cd "$srcdir/cfe-$pkgver.src"
mkdir build
mv "$srcdir/clang-tools-extra-$pkgver.src" tools/extra
patch -Np1 -i ../enable-SSP-and-PIE-by-default.patch
}
build() {
cd "$srcdir/cfe-$pkgver.src/build"
cmake .. -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DPYTHON_EXECUTABLE=/usr/bin/python3 \
-DBUILD_SHARED_LIBS=ON \
-DLLVM_LINK_LLVM_DYLIB=ON \
-DLLVM_ENABLE_RTTI=ON \
-DLLVM_BUILD_TESTS=ON \
-DLLVM_INCLUDE_DOCS=ON \
-DLLVM_BUILD_DOCS=ON \
-DLLVM_ENABLE_SPHINX=ON \
-DSPHINX_WARNINGS_AS_ERRORS=OFF \
-DLLVM_EXTERNAL_LIT=/usr/bin/lit \
-DLLVM_MAIN_SRC_DIR="$srcdir/llvm-$pkgver.src"
ninja
}
check() {
cd "$srcdir/cfe-$pkgver.src/build"
ninja check-clang{,-tools}
}
_python2_optimize() {
python2 -m compileall "$@"
python2 -O -m compileall "$@"
}
_python3_optimize() {
python3 -m compileall "$@"
python3 -O -m compileall "$@"
python3 -OO -m compileall "$@"
}
package() {
cd "$srcdir/cfe-$pkgver.src/build"
DESTDIR="$pkgdir" ninja install
install -Dm644 ../LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
# Remove documentation sources
rm -r "$pkgdir"/usr/share/doc/clang{,-tools}/html/{_sources,.buildinfo}
# Move analyzer scripts out of /usr/libexec
mv "$pkgdir"/usr/libexec/{ccc,c++}-analyzer "$pkgdir/usr/lib/clang/"
rmdir "$pkgdir/usr/libexec"
sed -i 's|libexec|lib/clang|' "$pkgdir/usr/bin/scan-build"
# Install Python bindings
for _py in 2.7 3.6; do
install -d "$pkgdir/usr/lib/python$_py/site-packages"
cp -a ../bindings/python/clang "$pkgdir/usr/lib/python$_py/site-packages/"
_python${_py%%.*}_optimize "$pkgdir/usr/lib/python$_py"
done
# Fix shebang in Python 2 scripts
sed -i '1s|/usr/bin/env python$|&2|' \
"$pkgdir/usr/bin/scan-view" \
"$pkgdir"/usr/share/$pkgname/*.py
# Compile Python scripts
_python2_optimize "$pkgdir/usr/share"
}
# vim:set ts=2 sw=2 et:
From b0307536e769c8ce11dbfa1956d617e8fc9366a7 Mon Sep 17 00:00:00 2001
From: Evangelos Foutras <evangelos@foutrelis.com>
Date: Thu, 8 Mar 2018 18:38:53 +0200
Subject: [PATCH] Enable SSP and PIE by default
This is a minimal set of changes needed to make clang use SSP and PIE by
default on Arch Linux. Tests that were easy to adjust have been changed
accordingly; only test/Driver/linux-ld.c has been marked as "expected
failure" due to the number of changes it would require (mostly replacing
crtbegin.o with crtbeginS.o).
Doing so is needed in order to align clang with the new default GCC
behavior in Arch which generates PIE executables by default and also
defaults to -fstack-protector-strong. It is not meant to be a long term
solution, but a simple temporary fix.
Hopefully these changes will be obsoleted by the introduction upstream
of a compile-time option (https://bugs.llvm.org/show_bug.cgi?id=13410)
---
lib/Driver/ToolChains/Linux.cpp | 14 ++++++++++++--
lib/Driver/ToolChains/Linux.h | 1 +
test/Driver/cross-linux.c | 16 ++++++++--------
test/Driver/env.c | 2 +-
test/Driver/fsanitize.c | 18 ++++++++++--------
test/Driver/gcc-toolchain.cpp | 2 +-
test/Driver/hexagon-toolchain-elf.c | 2 +-
test/Driver/linux-as.c | 4 ++--
test/Driver/linux-ld.c | 2 ++
test/Driver/stack-protector.c | 4 ++--
10 files changed, 40 insertions(+), 25 deletions(-)
diff --git a/lib/Driver/ToolChains/Linux.cpp b/lib/Driver/ToolChains/Linux.cpp
index 1301cdf114..a15a722d76 100644
--- a/lib/Driver/ToolChains/Linux.cpp
+++ b/lib/Driver/ToolChains/Linux.cpp
@@ -816,8 +816,18 @@ void Linux::AddIAMCUIncludeArgs(const ArgList &DriverArgs,
}
bool Linux::isPIEDefault() const {
- return (getTriple().isAndroid() && !getTriple().isAndroidVersionLT(16)) ||
- getTriple().isMusl() || getSanitizerArgs().requiresPIE();
+ const bool IsMips = tools::isMipsArch(getTriple().getArch());
+ const bool IsAndroid = getTriple().isAndroid();
+
+ if (IsMips || IsAndroid)
+ return (getTriple().isAndroid() && !getTriple().isAndroidVersionLT(16)) ||
+ getTriple().isMusl() || getSanitizerArgs().requiresPIE();
+
+ return true;
+}
+
+unsigned Linux::GetDefaultStackProtectorLevel(bool KernelOrKext) const {
+ return 2;
}
SanitizerMask Linux::getSupportedSanitizers() const {
diff --git a/lib/Driver/ToolChains/Linux.h b/lib/Driver/ToolChains/Linux.h
index 9778c1832c..ddd46a1d58 100644
--- a/lib/Driver/ToolChains/Linux.h
+++ b/lib/Driver/ToolChains/Linux.h
@@ -36,6 +36,7 @@ public:
void AddIAMCUIncludeArgs(const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args) const override;
bool isPIEDefault() const override;
+ unsigned GetDefaultStackProtectorLevel(bool KernelOrKext) const override;
SanitizerMask getSupportedSanitizers() const override;
void addProfileRTLibs(const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs) const override;
diff --git a/test/Driver/cross-linux.c b/test/Driver/cross-linux.c
index a5ea832e77..1949c05a60 100644
--- a/test/Driver/cross-linux.c
+++ b/test/Driver/cross-linux.c
@@ -42,8 +42,8 @@
// CHECK-MULTI32-I386: "{{.*}}/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/bin{{/|\\\\}}ld"
// CHECK-MULTI32-I386: "--sysroot=[[sysroot:.*/Inputs/basic_linux_tree]]"
// CHECK-MULTI32-I386: "-m" "elf_i386"
-// CHECK-MULTI32-I386: "crti.o" "[[gcc_install:.*/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0]]{{/|\\\\}}crtbegin.o"
-// CHECK-MULTI32-I386: "-L[[gcc_install]]"
+// CHECK-MULTI32-I386: "crti.o" "crtbeginS.o"
+// CHECK-MULTI32-I386: "-L[[gcc_install:.*/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0]]"
// CHECK-MULTI32-I386: "-L[[gcc_install]]/../../../../i386-unknown-linux/lib/../lib32"
// CHECK-MULTI32-I386: "-L[[gcc_install]]/../../../../i386-unknown-linux/lib"
// CHECK-MULTI32-I386: "-L[[sysroot]]/lib"
@@ -59,8 +59,8 @@
// CHECK-MULTI32-X86-64: "{{.*}}/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/bin{{/|\\\\}}ld"
// CHECK-MULTI32-X86-64: "--sysroot=[[sysroot:.*/Inputs/basic_linux_tree]]"
// CHECK-MULTI32-X86-64: "-m" "elf_x86_64"
-// CHECK-MULTI32-X86-64: "crti.o" "[[gcc_install:.*/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0]]/64{{/|\\\\}}crtbegin.o"
-// CHECK-MULTI32-X86-64: "-L[[gcc_install]]/64"
+// CHECK-MULTI32-X86-64: "crti.o" "crtbeginS.o"
+// CHECK-MULTI32-X86-64: "-L[[gcc_install:.*/Inputs/multilib_32bit_linux_tree/usr/lib/gcc/i386-unknown-linux/4.6.0]]/64"
// CHECK-MULTI32-X86-64: "-L[[gcc_install]]/../../../../i386-unknown-linux/lib/../lib64"
// CHECK-MULTI32-X86-64: "-L[[gcc_install]]"
// CHECK-MULTI32-X86-64: "-L[[gcc_install]]/../../../../i386-unknown-linux/lib"
@@ -77,8 +77,8 @@
// CHECK-MULTI64-I386: "{{.*}}/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/bin{{/|\\\\}}ld"
// CHECK-MULTI64-I386: "--sysroot=[[sysroot:.*/Inputs/basic_linux_tree]]"
// CHECK-MULTI64-I386: "-m" "elf_i386"
-// CHECK-MULTI64-I386: "crti.o" "[[gcc_install:.*/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0]]/32{{/|\\\\}}crtbegin.o"
-// CHECK-MULTI64-I386: "-L[[gcc_install]]/32"
+// CHECK-MULTI64-I386: "crti.o" "crtbeginS.o"
+// CHECK-MULTI64-I386: "-L[[gcc_install:.*/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0]]/32"
// CHECK-MULTI64-I386: "-L[[gcc_install]]/../../../../x86_64-unknown-linux/lib/../lib32"
// CHECK-MULTI64-I386: "-L[[gcc_install]]"
// CHECK-MULTI64-I386: "-L[[gcc_install]]/../../../../x86_64-unknown-linux/lib"
@@ -95,8 +95,8 @@
// CHECK-MULTI64-X86-64: "{{.*}}/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/bin{{/|\\\\}}ld"
// CHECK-MULTI64-X86-64: "--sysroot=[[sysroot:.*/Inputs/basic_linux_tree]]"
// CHECK-MULTI64-X86-64: "-m" "elf_x86_64"
-// CHECK-MULTI64-X86-64: "crti.o" "[[gcc_install:.*/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0]]{{/|\\\\}}crtbegin.o"
-// CHECK-MULTI64-X86-64: "-L[[gcc_install]]"
+// CHECK-MULTI64-X86-64: "crti.o" "crtbeginS.o"
+// CHECK-MULTI64-X86-64: "-L[[gcc_install:.*/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0]]"
// CHECK-MULTI64-X86-64: "-L[[gcc_install]]/../../../../x86_64-unknown-linux/lib/../lib64"
// CHECK-MULTI64-X86-64: "-L[[gcc_install]]/../../../../x86_64-unknown-linux/lib"
// CHECK-MULTI64-X86-64: "-L[[sysroot]]/lib"
diff --git a/test/Driver/env.c b/test/Driver/env.c
index 0371bc91c4..ea89f52512 100644
--- a/test/Driver/env.c
+++ b/test/Driver/env.c
@@ -20,7 +20,7 @@
//
// CHECK-LD-32-NOT: warning:
// CHECK-LD-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
-// CHECK-LD-32: "{{.*}}/usr/lib/gcc/i386-unknown-linux/4.6.0{{/|\\\\}}crtbegin.o"
+// CHECK-LD-32: "crtbeginS.o"
// CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0"
// CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib"
// CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../.."
diff --git a/test/Driver/fsanitize.c b/test/Driver/fsanitize.c
index 7870f724b6..c66dd98956 100644
--- a/test/Driver/fsanitize.c
+++ b/test/Driver/fsanitize.c
@@ -208,15 +208,15 @@
// RUN: %clang -target x86_64-linux-gnu -fsanitize=vptr -fno-sanitize=vptr -fsanitize=undefined,address %s -### 2>&1
// OK
-// RUN: %clang -target x86_64-linux-gnu -fsanitize=thread %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-PIE
-// RUN: %clang -target x86_64-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-PIE
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=thread %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE
// RUN: %clang -target x86_64-unknown-freebsd -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE
// RUN: %clang -target aarch64-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE
// RUN: %clang -target arm-linux-androideabi -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIC-NO-PIE
// RUN: %clang -target arm-linux-androideabi24 -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE
// RUN: %clang -target aarch64-linux-android -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE
-// RUN: %clang -target x86_64-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-PIE
-// RUN: %clang -target i386-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-PIE
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE
+// RUN: %clang -target i386-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PIE
// CHECK-NO-PIE-NOT: "-pie"
// CHECK-NO-PIE: "-mrelocation-model" "static"
@@ -525,12 +525,12 @@
// RUN: %clang -fno-sanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NOSP
// NOSP-NOT: "-fsanitize=safe-stack"
-// RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP
-// RUN: %clang -target x86_64-linux-gnu -fsanitize=address,safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP-ASAN
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=address,safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP-ASAN
// RUN: %clang -target x86_64-linux-gnu -fstack-protector -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP
// RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -fstack-protector-all -### %s 2>&1 | FileCheck %s -check-prefix=SP
-// RUN: %clang -target arm-linux-androideabi -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP
-// RUN: %clang -target aarch64-linux-android -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP
+// RUN: %clang -target arm-linux-androideabi -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP
+// RUN: %clang -target aarch64-linux-android -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP
// RUN: %clang -target i386-contiki-unknown -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP
// NO-SP-NOT: stack-protector
// NO-SP: "-fsanitize=safe-stack"
@@ -540,6 +540,8 @@
// NO-SP-ASAN-NOT: stack-protector
// NO-SP-ASAN: "-fsanitize=address,safe-stack"
+// SP-ASAN: "-fsanitize=address,safe-stack"
+// SP-ASAN: -stack-protector
// NO-SP-ASAN-NOT: stack-protector
// RUN: %clang -target powerpc64-unknown-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s -check-prefix=CHECK-SANM
diff --git a/test/Driver/gcc-toolchain.cpp b/test/Driver/gcc-toolchain.cpp
index ca96757a2b..ae1c25e989 100644
--- a/test/Driver/gcc-toolchain.cpp
+++ b/test/Driver/gcc-toolchain.cpp
@@ -24,6 +24,6 @@
// the same precise formatting of the path as the '-internal-system' flags
// above, so we just blanket wildcard match the 'crtbegin.o'.
// CHECK: "{{[^"]*}}ld{{(.exe)?}}"
-// CHECK: "{{[^"]*}}/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5{{/|\\\\}}crtbegin.o"
+// CHECK: "crtbeginS.o"
// CHECK: "-L[[TOOLCHAIN]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5"
// CHECK: "-L[[TOOLCHAIN]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../.."
diff --git a/test/Driver/hexagon-toolchain-elf.c b/test/Driver/hexagon-toolchain-elf.c
index 7dc82f3519..140baa987a 100644
--- a/test/Driver/hexagon-toolchain-elf.c
+++ b/test/Driver/hexagon-toolchain-elf.c
@@ -457,7 +457,7 @@
// RUN: %s 2>&1 \
// RUN: | FileCheck -check-prefix=CHECK042 %s
// CHECK042: "-cc1"
-// CHECK042: "-mrelocation-model" "static"
+// CHECK042: "-mrelocation-model" "pic"
// CHECK042: "-mllvm" "-hexagon-small-data-threshold=8"
// CHECK042-NEXT: llvm-mc
// CHECK042: "-gpsize=8"
diff --git a/test/Driver/linux-as.c b/test/Driver/linux-as.c
index 68cf403d97..92b556db73 100644
--- a/test/Driver/linux-as.c
+++ b/test/Driver/linux-as.c
@@ -133,7 +133,7 @@
// CHECK-PPC-NO-MCPU-NOT: as{{.*}} "-mcpu=invalid-cpu"
//
// RUN: %clang -target sparc64-linux -mcpu=invalid-cpu -### \
-// RUN: -no-integrated-as -c %s 2>&1 \
+// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \
// RUN: | FileCheck -check-prefix=CHECK-SPARCV9 %s
// CHECK-SPARCV9: as
// CHECK-SPARCV9: -64
@@ -142,7 +142,7 @@
// CHECK-SPARCV9: -o
//
// RUN: %clang -target sparc64-linux -mcpu=invalid-cpu -### \
-// RUN: -no-integrated-as -fpic -c %s 2>&1 \
+// RUN: -no-integrated-as -c %s 2>&1 \
// RUN: | FileCheck -check-prefix=CHECK-SPARCV9PIC %s
// CHECK-SPARCV9PIC: as
// CHECK-SPARCV9PIC: -64
diff --git a/test/Driver/linux-ld.c b/test/Driver/linux-ld.c
index 662aabb867..9fa4f0569a 100644
--- a/test/Driver/linux-ld.c
+++ b/test/Driver/linux-ld.c
@@ -1,3 +1,5 @@
+// XFAIL: linux
+
// General tests that ld invocations on Linux targets sane. Note that we use
// sysroot to make these tests independent of the host system.
//
diff --git a/test/Driver/stack-protector.c b/test/Driver/stack-protector.c
index a3e40b50ee..dfffe0d6cf 100644
--- a/test/Driver/stack-protector.c
+++ b/test/Driver/stack-protector.c
@@ -3,11 +3,11 @@
// NOSSP-NOT: "-stack-protector-buffer-size"
// RUN: %clang -target i386-unknown-linux -fstack-protector -### %s 2>&1 | FileCheck %s -check-prefix=SSP
-// SSP: "-stack-protector" "1"
+// SSP: "-stack-protector" "2"
// SSP-NOT: "-stack-protector-buffer-size"
// RUN: %clang -target i386-unknown-linux -fstack-protector --param ssp-buffer-size=16 -### %s 2>&1 | FileCheck %s -check-prefix=SSP-BUF
-// SSP-BUF: "-stack-protector" "1"
+// SSP-BUF: "-stack-protector" "2"
// SSP-BUF: "-stack-protector-buffer-size" "16"
// RUN: %clang -target i386-pc-openbsd -### %s 2>&1 | FileCheck %s -check-prefix=OPENBSD
--
2.16.2
# $Id$
# Maintainer: Evangelos Foutras <evangelos@foutrelis.com>
# Contributor: Jan "heftig" Steffens <jan.steffens@gmail.com>
pkgname=compiler-rt
pkgver=6.0.0
pkgrel=1
pkgdesc="Compiler runtime libraries for clang"
arch=('x86_64')
url="https://compiler-rt.llvm.org/"
license=('custom:University of Illinois/NCSA Open Source License')
depends=('gcc-libs')
makedepends=('llvm' 'cmake' 'ninja' 'python')
# Build 32-bit compiler-rt libraries on x86_64 (FS#41911)
makedepends_x86_64=('lib32-gcc-libs')
options=('staticlibs')
source=(https://releases.llvm.org/$pkgver/$pkgname-$pkgver.src.tar.xz{,.sig})
sha256sums=('d0cc1342cf57e9a8d52f5498da47a3b28d24ac0d39cbc92308781b3ee0cea79a'
'SKIP')
validpgpkeys+=('B6C8F98282B944E3B0D5C2530FC3042E345AD05D') # Hans Wennborg <hans@chromium.org>
validpgpkeys+=('11E521D646982372EB577A1F8F0871F202119294') # Tom Stellard <tom@stellard.net>
prepare() {
cd "$srcdir/$pkgname-$pkgver.src"
mkdir build
}
build() {
cd "$srcdir/$pkgname-$pkgver.src/build"
cmake .. -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr
ninja
}
package() {
cd "$srcdir/$pkgname-$pkgver.src/build"
DESTDIR="$pkgdir" ninja install
install -Dm644 ../LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
mkdir -p "$pkgdir/usr/lib/clang/$pkgver/lib"
mv "$pkgdir"/usr/lib/{linux,clang/$pkgver/lib/}
mv "$pkgdir"/usr/{*.txt,lib/clang/$pkgver/}
}
# vim:set ts=2 sw=2 et:
# $Id$
# Maintainer: Evangelos Foutras <evangelos@foutrelis.com>
# Contributor: Jan "heftig" Steffens <jan.steffens@gmail.com>
pkgname=lld
pkgver=6.0.0
pkgrel=1
pkgdesc="Linker from the LLVM project"
arch=('x86_64')
url="https://lld.llvm.org/"
license=('custom:University of Illinois/NCSA Open Source License')
depends=(llvm-libs=$pkgver)
makedepends=("llvm=$pkgver" 'cmake' 'ninja' 'python3-sphinx' 'gtest')
source=(https://releases.llvm.org/$pkgver/$pkgname-$pkgver.src.tar.xz{,.sig})
sha256sums=('6b8c4a833cf30230c0213d78dbac01af21387b298225de90ab56032ca79c0e0b'
'SKIP')
validpgpkeys+=('B6C8F98282B944E3B0D5C2530FC3042E345AD05D') # Hans Wennborg <hans@chromium.org>
validpgpkeys+=('11E521D646982372EB577A1F8F0871F202119294') # Tom Stellard <tom@stellard.net>
prepare() {
cd "$srcdir/$pkgname-$pkgver.src"
mkdir build
}
build() {
cd "$srcdir/$pkgname-$pkgver.src/build"
cmake .. -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DPYTHON_EXECUTABLE=/usr/bin/python3 \
-DBUILD_SHARED_LIBS=ON \
-DLLVM_LINK_LLVM_DYLIB=ON \
-DLLVM_INCLUDE_TESTS=ON \
-DLLVM_BUILD_TESTS=ON \
-DLLVM_BUILD_DOCS=ON \
-DLLVM_ENABLE_SPHINX=ON \
-DLLVM_EXTERNAL_LIT=/usr/bin/lit
ninja
}
check() {
cd "$srcdir/$pkgname-$pkgver.src/build"
if [[ -e /usr/bin/lld ]]; then
# TODO(foutrelis): tests use system lld if it exists; check if it's fixable
error "Cannot run the tests while lld is installed to the system"
return 1
fi
ninja check-lld
}
package() {
cd "$srcdir/$pkgname-$pkgver.src/build"
DESTDIR="$pkgdir" ninja install
install -Dm644 ../LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
# Remove documentation sources
rm -r "$pkgdir"/usr/share/doc/$pkgname/html/{_sources,.buildinfo}
}
# vim:set ts=2 sw=2 et:
# $Id$
# Maintainer: Evangelos Foutras <evangelos@foutrelis.com>
# Contributor: Jan "heftig" Steffens <jan.steffens@gmail.com>
pkgname=lldb
pkgver=6.0.0
pkgrel=1
pkgdesc="Next generation, high-performance debugger"
arch=('x86_64')
url="https://lldb.llvm.org/"
license=('custom:University of Illinois/NCSA Open Source License')
depends=('llvm-libs' 'clang' 'python2' 'python2-six')
makedepends=('llvm' 'cmake' 'ninja' 'swig')
source=(https://releases.llvm.org/$pkgver/$pkgname-$pkgver.src.tar.xz{,.sig}
PR36630-install-lldb-SB-headers.patch
PR36687-fix-standalone-LLVM_LINK_LLVM_DYLIB-builds.patch)
sha256sums=('46f54c1d7adcd047d87c0179f7b6fa751614f339f4f87e60abceaa45f414d454'
'SKIP'
'5b765f7420bbf3fb4521a2f2022a40ba4f703ab555fe61e88a6d6617a6713921'
'1f146b2009553c6a5f76fa077b621fba66db5ef26c9790e9f64e608304d099e5')
validpgpkeys+=('B6C8F98282B944E3B0D5C2530FC3042E345AD05D') # Hans Wennborg <hans@chromium.org>
validpgpkeys+=('11E521D646982372EB577A1F8F0871F202119294') # Tom Stellard <tom@stellard.net>
prepare() {
cd "$srcdir/$pkgname-$pkgver.src"
mkdir build
# https://bugs.llvm.org/show_bug.cgi?id=36630
patch -Np1 -i ../PR36630-install-lldb-SB-headers.patch
# https://bugs.llvm.org/show_bug.cgi?id=36687
patch -Np1 -i ../PR36687-fix-standalone-LLVM_LINK_LLVM_DYLIB-builds.patch
}
build() {
cd "$srcdir/$pkgname-$pkgver.src/build"
cmake .. -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DPYTHON_EXECUTABLE=/usr/bin/python2 \
-DPYTHON_LIBRARY=/usr/lib/libpython2.7.so \
-DPYTHON_INCLUDE_DIR=/usr/include/python2.7 \
-DLLVM_LINK_LLVM_DYLIB=ON \
-DLLDB_USE_SYSTEM_SIX=1
ninja
}
package() {
cd "$srcdir/$pkgname-$pkgver.src/build"
DESTDIR="$pkgdir" ninja install
install -Dm644 ../LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
# Install possibly outdated man page; better than nothing!
install -Dm644 ../docs/lldb.1 "$pkgdir/usr/share/man/man1/lldb.1"
# Remove static libraries
rm "$pkgdir"/usr/lib/*.a
# Relocate custom readline.so module which links agaisnt libedit
mv "$pkgdir"/usr/lib/python2.7/site-packages/{,lldb/}readline.so
sed -i '2isys.path.insert(1, "/usr/lib/python2.7/site-packages/lldb")' \
"$pkgdir/usr/lib/python2.7/site-packages/lldb/embedded_interpreter.py"
# Compile Python scripts
python2 -m compileall "$pkgdir"
python2 -O -m compileall "$pkgdir"
}
# vim:set ts=2 sw=2 et:
From 8f577000b2fe2f5bf5d08e352a2f15f9421f9c82 Mon Sep 17 00:00:00 2001
From: Pavel Labath <labath@google.com>
Date: Thu, 8 Mar 2018 15:52:46 +0000
Subject: [PATCH] Install lldb's SB headers (pr36630)
These were removed in r309021 in what looks like an accidentally
committed change. This brings them back.
I also rename the header component to lldb-headers (instead of
lldb_headers) to match the llvm style and add a special
install-lldb-headers target, which installs just the headers.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@327016 91177308-0d34-0410-b5e6-96231b3b80d8
---
cmake/modules/LLDBConfig.cmake | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/cmake/modules/LLDBConfig.cmake b/cmake/modules/LLDBConfig.cmake
index 8f75880dfb..24878b5913 100644
--- a/cmake/modules/LLDBConfig.cmake
+++ b/cmake/modules/LLDBConfig.cmake
@@ -277,27 +277,31 @@ include_directories(BEFORE
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
install(DIRECTORY include/
- COMPONENT lldb_headers
+ COMPONENT lldb-headers
DESTINATION include
FILES_MATCHING
PATTERN "*.h"
PATTERN ".svn" EXCLUDE
PATTERN ".cmake" EXCLUDE
PATTERN "Config.h" EXCLUDE
- PATTERN "lldb-*.h" EXCLUDE
- PATTERN "API/*.h" EXCLUDE
)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/
- COMPONENT lldb_headers
+ COMPONENT lldb-headers
DESTINATION include
FILES_MATCHING
PATTERN "*.h"
PATTERN ".svn" EXCLUDE
PATTERN ".cmake" EXCLUDE
- PATTERN "lldb-*.h" EXCLUDE
- PATTERN "API/*.h" EXCLUDE
)
+
+ add_custom_target(lldb-headers)
+ set_target_properties(lldb-headers PROPERTIES FOLDER "Misc")
+
+ if (NOT CMAKE_CONFIGURATION_TYPES)
+ add_llvm_install_targets(install-lldb-headers
+ COMPONENT lldb-headers)
+ endif()
endif()
if (NOT LIBXML2_FOUND AND NOT (CMAKE_SYSTEM_NAME MATCHES "Windows"))
From 39c65fb3ea6ddbec92b32efa1a7fbd0fb299ce63 Mon Sep 17 00:00:00 2001
From: Pavel Labath <labath@google.com>
Date: Wed, 14 Mar 2018 10:08:21 +0000
Subject: [PATCH] [cmake] Fix standalone+LLVM_LINK_LLVM_DYLIB builds (pr36687)
Summary:
To make this build work, I needed to add detection code for the pthread
library. This is necessary, because we have direct calls to these
libraries (instead of going through llvm) and in the standalone build we
cannot rely on llvm to detect these for us. In a standalone non-dylib
build this was accidentaly working because these libraries were pulled
in as an interface dependency of the .a files, but in a dylib build
these are no longer part of the link interface, and so we need to add
them explicitly.
Reviewers: krytarowski, zturner
Subscribers: lldb-commits, mgorny
Differential Revision: https://reviews.llvm.org/D44379
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@327490 91177308-0d34-0410-b5e6-96231b3b80d8
---
cmake/modules/LLDBConfig.cmake | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/cmake/modules/LLDBConfig.cmake b/cmake/modules/LLDBConfig.cmake
index 24878b5913..32effe7737 100644
--- a/cmake/modules/LLDBConfig.cmake
+++ b/cmake/modules/LLDBConfig.cmake
@@ -346,14 +346,18 @@ else()
endif()
-if (HAVE_LIBPTHREAD)
- list(APPEND system_libs pthread)
-endif(HAVE_LIBPTHREAD)
+if( WIN32 AND NOT CYGWIN )
+ set(PURE_WINDOWS 1)
+endif()
-if (HAVE_LIBDL)
- list(APPEND system_libs ${CMAKE_DL_LIBS})
+if(NOT PURE_WINDOWS)
+ set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
+ find_package(Threads REQUIRED)
+ list(APPEND system_libs ${CMAKE_THREAD_LIBS_INIT})
endif()
+list(APPEND system_libs ${CMAKE_DL_LIBS})
+
# Figure out if lldb could use lldb-server. If so, then we'll
# ensure we build lldb-server when an lldb target is being built.
if (CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|FreeBSD|Linux|NetBSD")
From 4d613a84ce271c6225068bef67d727ae02b2e3b1 Mon Sep 17 00:00:00 2001
From: Pavel Labath <labath@google.com>
Date: Wed, 14 Mar 2018 09:28:38 +0000
Subject: [PATCH] Export LLVM_DYLIB_COMPONENTS in LLVMConfig.cmake
Summary:
This is needed so that external projects (e.g. a standalone build of
lldb) can link to the LLVM shared library via the USE_SHARED argument of
llvm_config. Without this, llvm_config would add LLVM to the link list,
but then also add the constituent static libraries, resulting in
multiply defined symbols.
Reviewers: beanz, mgorny
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D44391
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327484 91177308-0d34-0410-b5e6-96231b3b80d8
---
cmake/modules/LLVMConfig.cmake.in | 2 ++
1 file changed, 2 insertions(+)
diff --git a/cmake/modules/LLVMConfig.cmake.in b/cmake/modules/LLVMConfig.cmake.in
index fe4df5278498..e70018679846 100644
--- a/cmake/modules/LLVMConfig.cmake.in
+++ b/cmake/modules/LLVMConfig.cmake.in
@@ -13,6 +13,8 @@ set(LLVM_COMMON_DEPENDS @LLVM_COMMON_DEPENDS@)
set(LLVM_AVAILABLE_LIBS @LLVM_AVAILABLE_LIBS@)
+set(LLVM_DYLIB_COMPONENTS @LLVM_DYLIB_COMPONENTS@)
+
set(LLVM_ALL_TARGETS @LLVM_ALL_TARGETS@)
set(LLVM_TARGETS_TO_BUILD @LLVM_TARGETS_TO_BUILD@)
Index: cmake/modules/LLVM-Config.cmake
===================================================================
--- cmake/modules/LLVM-Config.cmake
+++ cmake/modules/LLVM-Config.cmake
@@ -68,7 +68,7 @@
cmake_parse_arguments(ARG "USE_SHARED" "" "" ${ARGN})
set(link_components ${ARG_UNPARSED_ARGUMENTS})
- if(USE_SHARED)
+ if(ARG_USE_SHARED)
# If USE_SHARED is specified, then we link against libLLVM,
# but also against the component libraries below. This is
# done in case libLLVM does not contain all of the components
# resynced with Arch's version from https://projects.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/llvm
# $Id$
# Maintainer: Evangelos Foutras <evangelos@foutrelis.com>
# Contributor: Jan "heftig" Steffens <jan.steffens@gmail.com>
pkgname=('llvm' 'llvm-libs' 'llvm-ocaml' 'lld' 'lldb' 'clang' 'clang-tools-extra')
pkgver=5.0.1
pkgrel=2
pkgname=('llvm' 'llvm-libs' 'llvm-ocaml')
pkgver=6.0.0
pkgrel=1
_ocaml_ver=4.05.0
arch=('x86_64')
url="http://llvm.org/"