Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .kres.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ kind: pkgfile.Build
spec:
targets:
- tools
- llvm
- tools-ca-certificates
- tools-cpio
- tools-kmod
Expand All @@ -17,7 +18,7 @@ spec:
- tools-xz
- tools-zlib-ng
- tools-zstd
reproducibleTargetName: tools
reproducibleTargetName: reproducibility
---
kind: common.Renovate
spec:
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2026-01-02T09:24:08Z by kres 8a4aebf.
# Generated on 2026-02-05T16:48:34Z by kres dc032d7.

# common variables

Expand Down Expand Up @@ -48,6 +48,7 @@ COMMON_ARGS += $(BUILD_ARGS)
# targets defines all the available targets

TARGETS = tools
TARGETS += llvm
TARGETS += tools-ca-certificates
TARGETS += tools-cpio
TARGETS += tools-kmod
Expand Down Expand Up @@ -136,7 +137,7 @@ docker-%: ## Builds the specified target defined in the Pkgfile using the docke
@$(MAKE) target-$* TARGET_ARGS="$(TARGET_ARGS)"

reproducibility-test: ## Builds the reproducibility test target
@$(MAKE) reproducibility-test-local-tools
@$(MAKE) reproducibility-test-local-reproducibility

reproducibility-test-local-%: ## Builds the specified target defined in the Pkgfile using the local output type with and without cahce. The build result will be output to the specified local destination
@rm -rf $(ARTIFACTS)/build-a $(ARTIFACTS)/build-b
Expand Down
15 changes: 15 additions & 0 deletions Pkgfile
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,21 @@ vars:
libuv_sha256: 27e55cf7083913bfb6826ca78cde9de7647cded648d35f24163f2d31bb9f51cd
libuv_sha512: cf3ca916fc3a762a194dac86718a5a7fe24f230e34172a48f9b3401ad72fbc1cf21b46ceaba956cdf6783d323e518d40f8632fff965943869819a1c26992a3c1

# renovate: datasource=github-releases extractVersion=^llvmorg-(?<version>.*)$ depName=llvm/llvm-project
llvm_version: 21.1.8
llvm_clang_sha256: 6090e3f23720d003cdd84483a47d0eec6d01adbb5e0c714ac0c8b58de546aa62
llvm_clang_sha512: 46e8bd1179540d6915ee8a722b344954200c120b9feaa9199cb70cecf358cdc27f2b5e66122894f894b1766894abd774cebd4e4313951c96032aa351bfcc7028
llvm_cmake_sha256: 85735f20fd8c81ecb0a09abb0c267018475420e93b65050cc5b7634eab744de9
llvm_cmake_sha512: 7b2a8c1792f0f2c2efb9f5813bc6acd287e782eac0438e9303791f7ceefe75fb6a49c55ea2e1a3d741b2ee935023f9273c79f9d7321250b5e659d14a05ef9e63
llvm_libunwind_sha256: 03e8adc6c3bdde657dcaedc94886ea70d1f7d551d622fcd8a36a8300e5c36cbc
llvm_libunwind_sha512: 3b78895de448a3af6d5e0d066b83ec7e4c3d4bf04fbd0c1ac378cc889b0b511ccf9c09394e8eb75d1ada88968bdf0ef1ae2d933b145bc9ea56a7e967fdf13b23
llvm_lld_sha256: d9524c5ee952500a2af92c27042a0d90ab089962af47816d4c85d0ebf76373d1
llvm_lld_sha512: 8d7a01d6e511e0da38a2e0a40a46ca6ef26f31e924349e7fe510413d1b42c9372346310660e7ae7ed733a689e2404d8d43ccb94f4107484cb7675f721e885269
llvm_sha256: d9022ddadb40a15015f6b27e6549a7144704ded8828ba036ffe4b8165707de21
llvm_sha512: f7a4887ece318939c5ac00f6dfe9f5ce4c080395f1409eaba3c65d48927e248c13648b0fc11661cc9f55fe40b3f84df5b4a3b08bd8d82b37a2ea5abb729a021f
llvm_third_party_sha256: 7fe99424384aea529ffaeec9cc9dfb8b451fd1852c03fc109e426fe208a1f1a7
llvm_third_party_sha512: 0b36b1683bac537cc54daba11a4d5fdd5ef144775f39354059a5ebc100cdc305b12b816334713e0ac6842f24e9c413680d071374cb0cf26cb4776305f6a0f8bf

# renovate: datasource=git-tags extractVersion=^v(?<version>.*)$ depName=git://git.savannah.gnu.org/m4.git
m4_version: 1.4.21
m4_sha256: f25c6ab51548a73a75558742fb031e0625d6485fe5f9155949d6486a2408ab66
Expand Down
29 changes: 29 additions & 0 deletions llvm/patches/fix-memory-mf_exec-on-aarch64.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Imported from Alpine: https://gitlab.alpinelinux.org/alpine/aports/-/blob/9e8202998fa718a7be6fb2d8aba639f97a94bb6a/main/llvm21/fix-memory-mf_exec-on-aarch64.patch

Fix failures in AllocationTests/MappedMemoryTest.* on aarch64:

Failing Tests (8):
LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.AllocAndRelease/3
LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.DuplicateNear/3
LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.EnabledWrite/3
LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.MultipleAllocAndRelease/3
LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.SuccessiveNear/3
LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.UnalignedNear/3
LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroNear/3
LLVM-Unit :: Support/./SupportTests/AllocationTests/MappedMemoryTest.ZeroSizeNear/3

Upstream-Issue: https://bugs.llvm.org/show_bug.cgi?id=14278#c10

diff --git a/llvm/lib/Support/Unix/Memory.inc b/llvm/lib/Support/Unix/Memory.inc
index 4c8f6b2ea..6cddae13b 100644
--- a/llvm/lib/Support/Unix/Memory.inc
+++ b/llvm/lib/Support/Unix/Memory.inc
@@ -50,7 +50,7 @@ static int getPosixProtectionFlags(unsigned Flags) {
llvm::sys::Memory::MF_EXEC:
return PROT_READ | PROT_WRITE | PROT_EXEC;
case llvm::sys::Memory::MF_EXEC:
-#if defined(__FreeBSD__) || defined(__powerpc__)
+#if defined(__FreeBSD__) || defined(__powerpc__) || (defined(__linux__) && defined(__aarch64__))
// On PowerPC, having an executable page that has no read permission
// can have unintended consequences. The function InvalidateInstruction-
// Cache uses instructions dcbf and icbi, both of which are treated by
25 changes: 25 additions & 0 deletions llvm/patches/llvm-stack-size.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Imported from Alpine: https://gitlab.alpinelinux.org/alpine/aports/-/blob/9e8202998fa718a7be6fb2d8aba639f97a94bb6a/main/llvm21/llvm-stack-size.patch

Patch-Source: https://github.com/chimera-linux/cports/blob/8c0359f31b9d888e59ced0320e93ca8ad79ba1f9/main/llvm/patches/0010-always-set-a-larger-stack-size-explicitly.patch
From 18e09846d9333b554e3dfbbd768ada6643bf92c0 Mon Sep 17 00:00:00 2001
From: Daniel Kolesa <daniel@octaforge.org>
Date: Sat, 27 Nov 2021 01:03:28 +0100
Subject: [PATCH 10/22] always set a larger stack size explicitly

---
llvm/lib/Support/Threading.cpp | 9 ---------
1 file changed, 9 deletions(-)

diff --git a/llvm/lib/Support/Threading.cpp b/llvm/lib/Support/Threading.cpp
index 923935bbc..26594aac8 100644
--- a/llvm/lib/Support/Threading.cpp
+++ b/llvm/lib/Support/Threading.cpp
@@ -77,7 +77,7 @@ unsigned llvm::ThreadPoolStrategy::compute_thread_count() const {
// keyword.
#include "llvm/Support/thread.h"

-#if defined(__APPLE__)
+#if 1
// Darwin's default stack size for threads except the main one is only 512KB,
// which is not enough for some/many normal LLVM compilations. This implements
// the same interface as std::thread but requests the same stack size as the
90 changes: 90 additions & 0 deletions llvm/pkg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: llvm
variant: scratch
dependencies:
- stage: base
- stage: patch
- stage: cmake
- stage: curl
- stage: ninja
- stage: python3
steps:
- sources:
- url: https://github.com/llvm/llvm-project/releases/download/llvmorg-{{ .llvm_version }}/llvm-{{ .llvm_version }}.src.tar.xz
destination: llvm.tar.xz
sha256: "{{ .llvm_sha256 }}"
sha512: "{{ .llvm_sha512 }}"
- url: https://github.com/llvm/llvm-project/releases/download/llvmorg-{{ .llvm_version }}/cmake-{{ .llvm_version }}.src.tar.xz
destination: cmake.tar.xz
sha256: "{{ .llvm_cmake_sha256 }}"
sha512: "{{ .llvm_cmake_sha512 }}"
- url: https://github.com/llvm/llvm-project/releases/download/llvmorg-{{ .llvm_version }}/third-party-{{ .llvm_version }}.src.tar.xz
destination: third-party.tar.xz
sha256: "{{ .llvm_third_party_sha256 }}"
sha512: "{{ .llvm_third_party_sha512 }}"
- url: https://github.com/llvm/llvm-project/releases/download/llvmorg-{{ .llvm_version }}/clang-{{ .llvm_version }}.src.tar.xz
destination: clang.tar.xz
sha256: "{{ .llvm_clang_sha256 }}"
sha512: "{{ .llvm_clang_sha512 }}"
- url: https://github.com/llvm/llvm-project/releases/download/llvmorg-{{ .llvm_version }}/lld-{{ .llvm_version }}.src.tar.xz
destination: lld.tar.xz
sha256: "{{ .llvm_lld_sha256 }}"
sha512: "{{ .llvm_lld_sha512 }}"
- url: https://github.com/llvm/llvm-project/releases/download/llvmorg-{{ .llvm_version }}/libunwind-{{ .llvm_version }}.src.tar.xz
destination: libunwind.tar.xz
sha256: "{{ .llvm_libunwind_sha256 }}"
sha512: "{{ .llvm_libunwind_sha512 }}"
prepare:
- |
mkdir llvm
tar -xJf llvm.tar.xz --strip-components=1 -C llvm
mkdir cmake
tar -xJf cmake.tar.xz --strip-components=1 -C cmake
mkdir third-party
tar -xJf third-party.tar.xz --strip-components=1 -C third-party
mkdir clang
tar -xJf clang.tar.xz --strip-components=1 -C clang
mkdir lld
tar -xJf lld.tar.xz --strip-components=1 -C lld
mkdir libunwind
tar -xJf libunwind.tar.xz --strip-components=1 -C libunwind

patch -p1 < /pkg/patches/fix-memory-mf_exec-on-aarch64.patch
patch -p1 < /pkg/patches/llvm-stack-size.patch
- |
cmake -S llvm -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DLLVM_DEFAULT_TARGET_TRIPLE="${ARCH}-linux-musl" \
-DLLVM_HOST_TRIPLE="${ARCH}-linux-musl" \
-DLLVM_ENABLE_PROJECTS="clang;lld" \
-DLLVM_BUILD_LLVM_DYLIB=ON \
-DLLVM_LINK_LLVM_DYLIB=ON \
-DLLVM_INCLUDE_TESTS=OFF \
-DLLVM_INCLUDE_DOCS=OFF \
-DLLVM_INCLUDE_EXAMPLES=OFF \
-DLLVM_INCLUDE_BENCHMARKS=OFF \
-DLLVM_ENABLE_BINDINGS=OFF \
-DLLVM_INSTALL_UTILS=ON \
-DLLVM_TARGETS_TO_BUILD='ARM;AArch64;X86' \
-DLLVM_ENABLE_ASSERTIONS=OFF \
-DLLVM_ENABLE_LTO=ON
build:
- |
cmake --build build
install:
- |
DESTDIR=/rootfs cmake --install build
# remove LLVM development files
rm -rf /rootfs/usr/include /rootfs/usr/lib/cmake /rootfs/usr/lib/*.a
test:
- |
# Validate usrmerge symlinks from toolchain did not get overwritten
[ -L /bin ] && [ -d /bin ]
[ -L /lib ] && [ -d /lib ]
[ -L /lib64 ] && [ -d /lib64 ]
[ -L /usr/lib64 ] && [ -d /usr/lib64 ]
[ -L /sbin ] && [ -d /sbin ]
[ -L /usr/sbin ] && [ -d /usr/sbin ]
finalize:
- from: /rootfs
to: /
18 changes: 18 additions & 0 deletions reproducibility/pkg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: reproducibility
variant: scratch
dependencies:
- stage: tools
- stage: llvm
steps:
- test:
- |
# Validate usrmerge symlinks from toolchain did not get overwritten
[ -L /bin ] && [ -d /bin ]
[ -L /lib ] && [ -d /lib ]
[ -L /lib64 ] && [ -d /lib64 ]
[ -L /usr/lib64 ] && [ -d /usr/lib64 ]
[ -L /sbin ] && [ -d /sbin ]
[ -L /usr/sbin ] && [ -d /usr/sbin ]
finalize:
- from: /
to: /