Initial commit
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
# Ignore BPM archives and signatures
|
||||
*.bpm
|
||||
*.bpm.sig
|
||||
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Ignore this package
|
||||
echo "ignore"
|
||||
@@ -0,0 +1,66 @@
|
||||
name: llvm21
|
||||
description: A collection of modular and reusable compiler and toolchain technologies
|
||||
version: 21.1.8
|
||||
revision: 1
|
||||
url: https://llvm.org
|
||||
license: Apache2-with-llvm-exception
|
||||
maintainers:
|
||||
- [email protected]
|
||||
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: d9022ddadb40a15015f6b27e6549a7144704ded8828ba036ffe4b8165707de21
|
||||
- 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: 6090e3f23720d003cdd84483a47d0eec6d01adbb5e0c714ac0c8b58de546aa62
|
||||
- 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: dd54ae21aee1780fac59445b51ebff601ad016b31ac3a7de3b21126fd3ccb229
|
||||
- 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: 85735f20fd8c81ecb0a09abb0c267018475420e93b65050cc5b7634eab744de9
|
||||
- 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: 7fe99424384aea529ffaeec9cc9dfb8b451fd1852c03fc109e426fe208a1f1a7
|
||||
split_packages:
|
||||
- name: llvm21
|
||||
depends:
|
||||
- llvm21-libs
|
||||
- perl
|
||||
- name: llvm21-libs
|
||||
description: Runtime libraries for LLVM
|
||||
depends:
|
||||
- gcc-libs
|
||||
- libedit
|
||||
- libffi
|
||||
- libxml2
|
||||
- zlib
|
||||
- zstd
|
||||
- name: compiler-rt21
|
||||
description: Compiler runtime libraries for clang
|
||||
depends:
|
||||
- gcc-libs
|
||||
- name: clang21
|
||||
description: C language family frontend for LLVM
|
||||
url: https://clang.llvm.org/
|
||||
depends:
|
||||
- compiler-rt21
|
||||
- gcc
|
||||
- llvm21-libs
|
||||
optional_depends:
|
||||
- llvm21
|
||||
@@ -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/llvm${BPM_PKG_VERSION%%.*} \
|
||||
-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_llvm21() {
|
||||
DESTDIR="$BPM_OUTPUT" cmake --install build
|
||||
|
||||
cd "$BPM_OUTPUT"
|
||||
|
||||
# Move compiler-rt files into split package
|
||||
_pick compiler-rt${BPM_PKG_VERSION%%.*} usr/lib/llvm${BPM_PKG_VERSION%%.*}/lib/clang/${BPM_PKG_VERSION%%.*}/bin/hwasan_symbolize
|
||||
_pick compiler-rt${BPM_PKG_VERSION%%.*} usr/lib/llvm${BPM_PKG_VERSION%%.*}/lib/clang/${BPM_PKG_VERSION%%.*}/include/fuzzer
|
||||
_pick compiler-rt${BPM_PKG_VERSION%%.*} usr/lib/llvm${BPM_PKG_VERSION%%.*}/lib/clang/${BPM_PKG_VERSION%%.*}/include/orc
|
||||
_pick compiler-rt${BPM_PKG_VERSION%%.*} usr/lib/llvm${BPM_PKG_VERSION%%.*}/lib/clang/${BPM_PKG_VERSION%%.*}/include/profile
|
||||
_pick compiler-rt${BPM_PKG_VERSION%%.*} usr/lib/llvm${BPM_PKG_VERSION%%.*}/lib/clang/${BPM_PKG_VERSION%%.*}/include/sanitizer
|
||||
_pick compiler-rt${BPM_PKG_VERSION%%.*} usr/lib/llvm${BPM_PKG_VERSION%%.*}/lib/clang/${BPM_PKG_VERSION%%.*}/include/xray
|
||||
_pick compiler-rt${BPM_PKG_VERSION%%.*} usr/lib/llvm${BPM_PKG_VERSION%%.*}/lib/clang/${BPM_PKG_VERSION%%.*}/lib
|
||||
_pick compiler-rt${BPM_PKG_VERSION%%.*} usr/lib/llvm${BPM_PKG_VERSION%%.*}/lib/clang/${BPM_PKG_VERSION%%.*}/share
|
||||
|
||||
# Move clang files into split package
|
||||
_pick clang${BPM_PKG_VERSION%%.*} usr/lib/llvm${BPM_PKG_VERSION%%.*}/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${BPM_PKG_VERSION%%.*} usr/lib/llvm${BPM_PKG_VERSION%%.*}/bin/clang*
|
||||
_pick clang${BPM_PKG_VERSION%%.*} usr/lib/llvm${BPM_PKG_VERSION%%.*}/lib/libclang*
|
||||
_pick clang${BPM_PKG_VERSION%%.*} usr/lib/llvm${BPM_PKG_VERSION%%.*}/lib/cmake/clang
|
||||
_pick clang${BPM_PKG_VERSION%%.*} usr/lib/llvm${BPM_PKG_VERSION%%.*}/include/clang-c/
|
||||
_pick clang${BPM_PKG_VERSION%%.*} usr/lib/llvm${BPM_PKG_VERSION%%.*}/include/clang
|
||||
_pick clang${BPM_PKG_VERSION%%.*} usr/lib/llvm${BPM_PKG_VERSION%%.*}/lib/clang
|
||||
_pick clang${BPM_PKG_VERSION%%.*} usr/lib/llvm${BPM_PKG_VERSION%%.*}/share/clang
|
||||
_pick clang${BPM_PKG_VERSION%%.*} usr/lib/llvm${BPM_PKG_VERSION%%.*}/share/man/man1/scan-build.1
|
||||
_pick clang${BPM_PKG_VERSION%%.*} usr/lib/llvm${BPM_PKG_VERSION%%.*}/share/scan-build
|
||||
_pick clang${BPM_PKG_VERSION%%.*} usr/lib/llvm${BPM_PKG_VERSION%%.*}/share/scan-view
|
||||
|
||||
# Move runtime libraries into split package
|
||||
for lib in libLLVM libLLVM-"${BPM_PKG_VERSION%%.*}"; do
|
||||
_pick llvm${BPM_PKG_VERSION%%.*}-libs usr/lib/llvm${BPM_PKG_VERSION%%.*}/lib/"$lib".so*
|
||||
done
|
||||
|
||||
# Create versioned symlinks from /usr/bin/ to /usr/lib/llvm*/bin/
|
||||
install -d "$BPM_OUTPUT"/usr/bin
|
||||
local _binary
|
||||
for _binary in "$BPM_OUTPUT"/usr/lib/llvm${BPM_PKG_VERSION%%.*}/bin/*; do
|
||||
local _basename=${_binary##*/}
|
||||
ln -s ../lib/llvm${BPM_PKG_VERSION%%.*}/bin/"$_basename" "$BPM_OUTPUT"/usr/bin/"$_basename"-${BPM_PKG_VERSION%%.*}
|
||||
done
|
||||
|
||||
# Install package license
|
||||
install -Dm644 "$BPM_SOURCE"/LICENSE.TXT "$BPM_OUTPUT"/usr/share/licenses/llvm${BPM_PKG_VERSION%%.*}/LICENSE.TXT
|
||||
}
|
||||
|
||||
package_llvm21-libs() {
|
||||
# Symlink libraries
|
||||
for lib in libLLVM.so.${BPM_PKG_VERSION%.*} libLLVM-${BPM_PKG_VERSION%%.*}.so; do
|
||||
ln -s llvm${BPM_PKG_VERSION%%.*}/lib/"$lib" "$BPM_OUTPUT"/usr/lib/"$lib"
|
||||
done
|
||||
|
||||
# Install package license
|
||||
install -Dm644 "$BPM_SOURCE"/LICENSE.TXT "$BPM_OUTPUT"/usr/share/licenses/llvm${BPM_PKG_VERSION%%.*}-libs/LICENSE.TXT
|
||||
}
|
||||
|
||||
package_compiler-rt21() {
|
||||
# Install package license
|
||||
install -Dm644 "$BPM_SOURCE"/LICENSE.TXT "$BPM_OUTPUT"/usr/share/licenses/compiler-rt${BPM_PKG_VERSION%%.*}/LICENSE.TXT
|
||||
}
|
||||
|
||||
package_clang21() {
|
||||
# Symlink libraries
|
||||
for lib in libclang-cpp.so.${BPM_PKG_VERSION%.*} libclang.so.${BPM_PKG_VERSION%.*}; do
|
||||
ln -s llvm${BPM_PKG_VERSION%%.*}/lib/"$lib" "$BPM_OUTPUT"/usr/lib/"$lib"
|
||||
done
|
||||
|
||||
# Install package license
|
||||
install -Dm644 "$BPM_SOURCE"/LICENSE.TXT "$BPM_OUTPUT"/usr/share/licenses/clang${BPM_PKG_VERSION%%.*}/LICENSE.TXT
|
||||
}
|
||||
Reference in New Issue
Block a user