Add compiler-rt as split package and other minor changes
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
name: llvm
|
||||
description: A collection of modular and reusable compiler and toolchain technologies
|
||||
version: 20.1.8
|
||||
revision: 4
|
||||
revision: 5
|
||||
url: https://llvm.org
|
||||
license: Apache2-with-llvm-exception
|
||||
architecture: any
|
||||
@@ -23,6 +23,10 @@ downloads:
|
||||
extract_to: ${BPM_SOURCE}/tools/clang
|
||||
extract_strip_components: 1
|
||||
checksum: b7a1b7b0af7b9c7596af6bd46e36d11321926eaa66a7a7dc957ab0a1375ee4b0
|
||||
- url: https://github.com/llvm/llvm-project/releases/download/llvmorg-${BPM_PKG_VERSION}/compiler-rt-${BPM_PKG_VERSION}.src.tar.xz
|
||||
extract_to: ${BPM_SOURCE}/projects/compiler-rt
|
||||
extract_strip_components: 1
|
||||
checksum: 15277402f6fd63397c0917a5c7171cda82d16d226094b828c1ed0f58f73b9c69
|
||||
- url: https://github.com/llvm/llvm-project/releases/download/llvmorg-${BPM_PKG_VERSION}/cmake-${BPM_PKG_VERSION}.src.tar.xz
|
||||
extract_to: cmake
|
||||
extract_strip_components: 1
|
||||
@@ -37,6 +41,7 @@ split_packages:
|
||||
- llvm-libs
|
||||
- perl
|
||||
- name: llvm-libs
|
||||
description: Runtime libraries for LLVM
|
||||
depends:
|
||||
- gcc-libs
|
||||
- libedit
|
||||
@@ -44,9 +49,16 @@ split_packages:
|
||||
- libxml2
|
||||
- zlib
|
||||
- zstd
|
||||
- name: compiler-rt
|
||||
description: Compiler runtime libraries for clang
|
||||
depends:
|
||||
- gcc-libs
|
||||
- name: clang
|
||||
description: C language family frontend for LLVM
|
||||
url: https://clang.llvm.org/
|
||||
depends:
|
||||
- compiler-rt
|
||||
- gcc
|
||||
- llvm-libs
|
||||
optional_depends:
|
||||
- llvm
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
From 669e0924afcedf27350469a944267cad4aabb866 Mon Sep 17 00:00:00 2001
|
||||
From: Evangelos Foutras <[email protected]>
|
||||
Date: Sun, 30 Jun 2024 08:51:20 +0000
|
||||
Subject: [PATCH] Enable -fstack-protector-strong by default
|
||||
|
||||
---
|
||||
clang/lib/Driver/ToolChains/Linux.h | 5 +++++
|
||||
clang/test/Driver/fsanitize.c | 6 +++---
|
||||
clang/test/Driver/stack-protector.c | 4 ++--
|
||||
3 files changed, 10 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/clang/lib/Driver/ToolChains/Linux.h b/clang/lib/Driver/ToolChains/Linux.h
|
||||
index 524391743090..0d4e1944118b 100644
|
||||
--- a/clang/lib/Driver/ToolChains/Linux.h
|
||||
+++ b/clang/lib/Driver/ToolChains/Linux.h
|
||||
@@ -10,6 +10,7 @@
|
||||
#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_LINUX_H
|
||||
|
||||
#include "Gnu.h"
|
||||
+#include "clang/Basic/LangOptions.h"
|
||||
#include "clang/Driver/ToolChain.h"
|
||||
|
||||
namespace clang {
|
||||
@@ -48,6 +49,10 @@ public:
|
||||
IsAArch64OutlineAtomicsDefault(const llvm::opt::ArgList &Args) const override;
|
||||
bool isPIEDefault(const llvm::opt::ArgList &Args) const override;
|
||||
bool IsMathErrnoDefault() const override;
|
||||
+ LangOptions::StackProtectorMode
|
||||
+ GetDefaultStackProtectorLevel(bool KernelOrKext) const override {
|
||||
+ return LangOptions::SSPStrong;
|
||||
+ }
|
||||
SanitizerMask getSupportedSanitizers() const override;
|
||||
void addProfileRTLibs(const llvm::opt::ArgList &Args,
|
||||
llvm::opt::ArgStringList &CmdArgs) const override;
|
||||
diff --git a/clang/test/Driver/fsanitize.c b/clang/test/Driver/fsanitize.c
|
||||
index 1671825042c3..5d8ac7009f8c 100644
|
||||
--- a/clang/test/Driver/fsanitize.c
|
||||
+++ b/clang/test/Driver/fsanitize.c
|
||||
@@ -700,12 +700,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=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=SP
|
||||
// RUN: not %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
|
||||
// NO-SP-NOT: stack-protector
|
||||
// NO-SP: "-fsanitize=safe-stack"
|
||||
// SP-ASAN: error: invalid argument '-fsanitize=safe-stack' not allowed with '-fsanitize=address'
|
||||
diff --git a/clang/test/Driver/stack-protector.c b/clang/test/Driver/stack-protector.c
|
||||
index 169376919a71..2470b7f7e39e 100644
|
||||
--- a/clang/test/Driver/stack-protector.c
|
||||
+++ b/clang/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,19 +2,28 @@
|
||||
# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE
|
||||
# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT
|
||||
|
||||
# The prepare function is executed in the root of the temp directory
|
||||
# This function is used for putting downloaded files to the correct location or applying patches
|
||||
prepare() {
|
||||
cd "$BPM_SOURCE"/tools
|
||||
patch -Np1 -i "$BPM_WORKDIR"/enable-fstack-protector-strong-by-default.patch
|
||||
}
|
||||
|
||||
# The build function is executed in the source directory
|
||||
# This function is used to compile the source code
|
||||
build() {
|
||||
export CC=gcc CXX=g++
|
||||
cmake -B build -DCMAKE_INSTALL_PREFIX=/usr \
|
||||
-DLLVM_ENABLE_FFI=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_SKIP_INSTALL_RPATH=ON \
|
||||
-DLLVM_ENABLE_FFI=ON \
|
||||
-DLLVM_BUILD_LLVM_DYLIB=ON \
|
||||
-DLLVM_LINK_LLVM_DYLIB=ON \
|
||||
-DLLVM_ENABLE_RTTI=ON \
|
||||
-DLLVM_BINUTILS_INCDIR=/usr/include \
|
||||
-DLLVM_INCLUDE_BENCHMARKS=OFF \
|
||||
-DCLANG_DEFAULT_PIE_ON_LINUX=ON \
|
||||
-DCLANG_CONFIG_FILE_SYSTEM_DIR=/etc/clang \
|
||||
-Wno-dev -G Ninja
|
||||
cmake --build build
|
||||
}
|
||||
@@ -40,6 +49,16 @@ package_llvm() {
|
||||
|
||||
cd "$BPM_OUTPUT"
|
||||
|
||||
# Move compiler-rt files into split packag
|
||||
_pick compiler-rt usr/lib/clang/${BPM_PKG_VERSION%%.*}/bin/hwasan_symbolize
|
||||
_pick compiler-rt usr/lib/clang/${BPM_PKG_VERSION%%.*}/include/fuzzer
|
||||
_pick compiler-rt usr/lib/clang/${BPM_PKG_VERSION%%.*}/include/orc
|
||||
_pick compiler-rt usr/lib/clang/${BPM_PKG_VERSION%%.*}/include/profile
|
||||
_pick compiler-rt usr/lib/clang/${BPM_PKG_VERSION%%.*}/include/sanitizer
|
||||
_pick compiler-rt usr/lib/clang/${BPM_PKG_VERSION%%.*}/include/xray
|
||||
_pick compiler-rt usr/lib/clang/${BPM_PKG_VERSION%%.*}/lib
|
||||
_pick compiler-rt usr/lib/clang/${BPM_PKG_VERSION%%.*}/share
|
||||
|
||||
# Move clang files into split package
|
||||
_pick clang usr/bin/{amdgpu-arch,analyze-build,c-index-test,diagtool,git-clang-format,hmaptool,intercept-build,nvptx-arch,scan-build,scan-build-py,scan-view}
|
||||
_pick clang usr/bin/clang*
|
||||
@@ -67,6 +86,11 @@ package_llvm-libs() {
|
||||
install -Dm644 "$BPM_SOURCE"/LICENSE.TXT "$BPM_OUTPUT"/usr/share/licenses/llvm-libs/LICENSE.TXT
|
||||
}
|
||||
|
||||
package_compiler-rt() {
|
||||
# Install package license
|
||||
install -Dm644 "$BPM_SOURCE"/LICENSE.TXT "$BPM_OUTPUT"/usr/share/licenses/compiler-rt/LICENSE.TXT
|
||||
}
|
||||
|
||||
package_clang() {
|
||||
# Install package license
|
||||
install -Dm644 "$BPM_SOURCE"/LICENSE.TXT "$BPM_OUTPUT"/usr/share/licenses/clang/LICENSE.TXT
|
||||
|
||||
Reference in New Issue
Block a user