Initial commit
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
# Exclude bpm archives
|
||||||
|
*.bpm
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Ignore this package
|
||||||
|
echo "ignore"
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
name: llvm20
|
||||||
|
description: A collection of modular and reusable compiler and toolchain technologies
|
||||||
|
version: 20.1.8
|
||||||
|
revision: 1
|
||||||
|
url: https://llvm.org
|
||||||
|
license: Apache2-with-llvm-exception
|
||||||
|
architecture: any
|
||||||
|
type: source
|
||||||
|
make_depends:
|
||||||
|
- cmake
|
||||||
|
- libffi
|
||||||
|
- ncurses
|
||||||
|
- ninja
|
||||||
|
- python3
|
||||||
|
- zlib
|
||||||
|
- zstd
|
||||||
|
downloads:
|
||||||
|
- url: https://github.com/llvm/llvm-project/releases/download/llvmorg-${BPM_PKG_VERSION}/llvm-${BPM_PKG_VERSION}.src.tar.xz
|
||||||
|
extract_to: ${BPM_SOURCE}
|
||||||
|
extract_strip_components: 1
|
||||||
|
checksum: e1363888216b455184dbb8a74a347bf5612f56a3f982369e1cba6c7e0726cde1
|
||||||
|
- url: https://github.com/llvm/llvm-project/releases/download/llvmorg-${BPM_PKG_VERSION}/clang-${BPM_PKG_VERSION}.src.tar.xz
|
||||||
|
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
|
||||||
|
checksum: 3319203cfd1172bbac50f06fa68e318af84dcb5d65353310c0586354069d6634
|
||||||
|
- url: https://github.com/llvm/llvm-project/releases/download/llvmorg-${BPM_PKG_VERSION}/third-party-${BPM_PKG_VERSION}.src.tar.xz
|
||||||
|
extract_to: third-party
|
||||||
|
extract_strip_components: 1
|
||||||
|
checksum: 9a4e452a8163732d417db067a89190fcda823cb3aa33199e834ac7c028923f4b
|
||||||
|
split_packages:
|
||||||
|
- name: llvm20
|
||||||
|
depends:
|
||||||
|
- llvm20-libs
|
||||||
|
- perl
|
||||||
|
- name: llvm20-libs
|
||||||
|
description: Runtime libraries for LLVM
|
||||||
|
depends:
|
||||||
|
- gcc-libs
|
||||||
|
- libedit
|
||||||
|
- libffi
|
||||||
|
- libxml2
|
||||||
|
- zlib
|
||||||
|
- zstd
|
||||||
|
- name: compiler-rt20
|
||||||
|
description: Compiler runtime libraries for clang
|
||||||
|
depends:
|
||||||
|
- gcc-libs
|
||||||
|
- name: clang20
|
||||||
|
description: C language family frontend for LLVM
|
||||||
|
url: https://clang.llvm.org/
|
||||||
|
depends:
|
||||||
|
- compiler-rt20
|
||||||
|
- gcc
|
||||||
|
- llvm20-libs
|
||||||
|
optional_depends:
|
||||||
|
- llvm20
|
||||||
@@ -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
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
# This is the source.sh script. It is executed by BPM in a temporary directory when compiling a source package
|
||||||
|
# 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/lib/llvm20 \
|
||||||
|
-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 \
|
||||||
|
-Wno-dev -G Ninja
|
||||||
|
cmake --build build
|
||||||
|
}
|
||||||
|
|
||||||
|
_pick() {
|
||||||
|
local p="$1" f d; shift
|
||||||
|
for f; do
|
||||||
|
[ -d "$BPM_WORKDIR"/output_"$p" ] || { echo "Split package $p not found"; exit 1; }
|
||||||
|
d="$BPM_WORKDIR"/output_"$p"/"${f#$BPM_OUTPUT}"
|
||||||
|
mkdir -p "$(dirname "$d")"
|
||||||
|
mv "$f" "$d"
|
||||||
|
rmdir -p --ignore-fail-on-non-empty "$(dirname "$f")"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# The package function is executed in the source directory
|
||||||
|
# This function is used to move the compiled files into the output directory
|
||||||
|
package_llvm20() {
|
||||||
|
DESTDIR="$BPM_OUTPUT" cmake --install build
|
||||||
|
|
||||||
|
cd "$BPM_OUTPUT"
|
||||||
|
|
||||||
|
# Move compiler-rt files into split package
|
||||||
|
_pick compiler-rt20 usr/lib/llvm20/lib/clang/${BPM_PKG_VERSION%%.*}/bin/hwasan_symbolize
|
||||||
|
_pick compiler-rt20 usr/lib/llvm20/lib/clang/${BPM_PKG_VERSION%%.*}/include/fuzzer
|
||||||
|
_pick compiler-rt20 usr/lib/llvm20/lib/clang/${BPM_PKG_VERSION%%.*}/include/orc
|
||||||
|
_pick compiler-rt20 usr/lib/llvm20/lib/clang/${BPM_PKG_VERSION%%.*}/include/profile
|
||||||
|
_pick compiler-rt20 usr/lib/llvm20/lib/clang/${BPM_PKG_VERSION%%.*}/include/sanitizer
|
||||||
|
_pick compiler-rt20 usr/lib/llvm20/lib/clang/${BPM_PKG_VERSION%%.*}/include/xray
|
||||||
|
_pick compiler-rt20 usr/lib/llvm20/lib/clang/${BPM_PKG_VERSION%%.*}/lib
|
||||||
|
_pick compiler-rt20 usr/lib/llvm20/lib/clang/${BPM_PKG_VERSION%%.*}/share
|
||||||
|
|
||||||
|
# Move clang files into split package
|
||||||
|
_pick clang20 usr/lib/llvm20/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 clang20 usr/lib/llvm20/bin/clang*
|
||||||
|
_pick clang20 usr/lib/llvm20/lib/libclang*
|
||||||
|
_pick clang20 usr/lib/llvm20/lib/cmake/clang
|
||||||
|
_pick clang20 usr/lib/llvm20/include/clang-c/
|
||||||
|
_pick clang20 usr/lib/llvm20/include/clang
|
||||||
|
_pick clang20 usr/lib/llvm20/lib/clang
|
||||||
|
_pick clang20 usr/lib/llvm20/share/clang
|
||||||
|
_pick clang20 usr/lib/llvm20/share/man/man1/scan-build.1
|
||||||
|
_pick clang20 usr/lib/llvm20/share/scan-build
|
||||||
|
_pick clang20 usr/lib/llvm20/share/scan-view
|
||||||
|
|
||||||
|
# Move runtime libraries into split package
|
||||||
|
for lib in libLLVM libLLVM-"${BPM_PKG_VERSION%%.*}"; do
|
||||||
|
_pick llvm20-libs usr/lib/llvm20/lib/"$lib".so*
|
||||||
|
done
|
||||||
|
|
||||||
|
# Create versioned symlinks from /usr/bin/ to /usr/lib/llvm20/bin/
|
||||||
|
install -d "$BPM_OUTPUT"/usr/bin
|
||||||
|
local _binary
|
||||||
|
for _binary in "$BPM_OUTPUT"/usr/lib/llvm20/bin/*; do
|
||||||
|
local _basename=${_binary##*/}
|
||||||
|
ln -s ../lib/llvm20/bin/"$_basename" "$BPM_OUTPUT"/usr/bin/"$_basename"-20
|
||||||
|
done
|
||||||
|
|
||||||
|
# Install package license
|
||||||
|
install -Dm644 "$BPM_SOURCE"/LICENSE.TXT "$BPM_OUTPUT"/usr/share/licenses/llvm20/LICENSE.TXT
|
||||||
|
}
|
||||||
|
|
||||||
|
package_llvm20-libs() {
|
||||||
|
# Symlink libraries
|
||||||
|
for lib in libLLVM.so.${BPM_PKG_VERSION%.*} libLLVM-${BPM_PKG_VERSION%%.*}.so; do
|
||||||
|
ln -s llvm20/lib/"$lib" "$BPM_OUTPUT"/usr/lib/"$lib"
|
||||||
|
done
|
||||||
|
|
||||||
|
# Install package license
|
||||||
|
install -Dm644 "$BPM_SOURCE"/LICENSE.TXT "$BPM_OUTPUT"/usr/share/licenses/llvm20-libs/LICENSE.TXT
|
||||||
|
}
|
||||||
|
|
||||||
|
package_compiler-rt20() {
|
||||||
|
# Install package license
|
||||||
|
install -Dm644 "$BPM_SOURCE"/LICENSE.TXT "$BPM_OUTPUT"/usr/share/licenses/compiler-rt20/LICENSE.TXT
|
||||||
|
}
|
||||||
|
|
||||||
|
package_clang20() {
|
||||||
|
# Symlink libraries
|
||||||
|
for lib in libclang-cpp.so.${BPM_PKG_VERSION%.*} libclang.so.${BPM_PKG_VERSION%.*}; do
|
||||||
|
ln -s llvm20/lib/"$lib" "$BPM_OUTPUT"/usr/lib/"$lib"
|
||||||
|
done
|
||||||
|
|
||||||
|
# Install package license
|
||||||
|
install -Dm644 "$BPM_SOURCE"/LICENSE.TXT "$BPM_OUTPUT"/usr/share/licenses/clang20/LICENSE.TXT
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user