Skip to content
Open
5 changes: 5 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ jobs:
if: github.event_name == 'pull_request'
run: |
make
- name: Push to ttl.sh
if: github.event_name == 'pull_request'
run: |
make PUSH=true REGISTRY=ttl.sh PROGRESS=plain
continue-on-error: true
Comment on lines +77 to +81
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: drop before merging

- name: Login to registry
if: github.event_name != 'pull_request'
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # version: v3.6.0
Expand Down
3 changes: 2 additions & 1 deletion .kres.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ spec:
- tools-libcap
- tools-libselinux
- tools-libsepol
- tools-llvm
- tools-openssl
- tools-pcre2
- tools-squashfs-tools
Expand All @@ -17,7 +18,7 @@ spec:
- tools-xz
- tools-zlib-ng
- tools-zstd
reproducibleTargetName: tools
reproducibleTargetName: tools-llvm
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a new reproducibility test target merging tools and tools-llvm to test them together, but ship separately

---
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-01-05T09:37:20Z by kres 8a4aebf.

# common variables

Expand Down Expand Up @@ -54,6 +54,7 @@ TARGETS += tools-kmod
TARGETS += tools-libcap
TARGETS += tools-libselinux
TARGETS += tools-libsepol
TARGETS += tools-llvm
TARGETS += tools-openssl
TARGETS += tools-pcre2
TARGETS += tools-squashfs-tools
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-tools-llvm

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.20
m4_sha256: e236ea3a1ccf5f6c270b1c4bb60726f371fa49459a8eaaebc90b216b328daf2b
Expand Down
52 changes: 52 additions & 0 deletions clang/pkg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: clang
variant: scratch
dependencies:
- stage: base
- stage: cmake
- stage: curl
- stage: ninja
- stage: python3
- stage: llvm
steps:
- sources:
- 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 }}/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 }}"
prepare:
- |
mkdir clang
tar -xJf clang.tar.xz --strip-components=1 -C clang
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
- |
cmake -S clang -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DLLVM_INCLUDE_TESTS=OFF \
-DLLVM_ENABLE_ASSERTIONS=OFF \
-DCLANG_BUILT_STANDALONE=ON \
-DCLANG_DEFAULT_PIE_ON_LINUX=ON \
-DCLANG_LINK_CLANG_DYLIB=ON \
-DENABLE_LINKER_BUILD_ID=ON \
-DLIBCLANG_BUILD_STATIC=ON \
-DLLVM_LINK_LLVM_DYLIB=ON
build:
- |
cmake --build build
install:
- |
DESTDIR=/rootfs cmake --install build
finalize:
- from: /rootfs
to: /
29 changes: 29 additions & 0 deletions lld/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 lld/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 <[email protected]>
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
63 changes: 63 additions & 0 deletions lld/pkg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: lld
variant: scratch
dependencies:
- stage: base
- stage: cmake
- stage: curl
- stage: ninja
- stage: python3
- stage: llvm
steps:
- sources:
- 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 }}/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 }}/libunwind-{{ .llvm_version }}.src.tar.xz
destination: libunwind.tar.xz
sha256: "{{ .llvm_libunwind_sha256 }}"
sha512: "{{ .llvm_libunwind_sha512 }}"
- 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 }}"
prepare:
- |
mkdir lld
tar -xJf lld.tar.xz --strip-components=1 -C lld
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 libunwind
tar -xJf libunwind.tar.xz --strip-components=1 -C libunwind
mkdir llvm
tar -xJf llvm.tar.xz --strip-components=1 -C llvm

patch -p1 < /pkg/patches/fix-memory-mf_exec-on-aarch64.patch
patch -p1 < /pkg/patches/llvm-stack-size.patch
Comment on lines +45 to +46
Copy link

Copilot AI Jan 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This package also uses the patch command but, like llvm/pkg.yaml, does not declare a patch stage dependency. For consistency with other patched packages and to ensure patch is available in the build environment, please add - stage: patch to the dependencies.

Copilot uses AI. Check for mistakes.
- |
cmake -S lld -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DLLVM_INCLUDE_TESTS=OFF \
-DLLVM_ENABLE_ASSERTIONS=OFF \
-DLLD_BUILT_STANDALONE=ON \
-DLLVM_LINK_LLVM_DYLIB=ON
build:
- |
cmake --build build
install:
- |
DESTDIR=/rootfs cmake --install build
finalize:
- from: /rootfs
to: /
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 <[email protected]>
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
77 changes: 77 additions & 0 deletions llvm/pkg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: llvm
variant: scratch
dependencies:
- stage: base
- 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
Comment on lines +49 to +51
Copy link

Copilot AI Jan 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This package invokes patch here but does not declare a patch stage dependency in the dependencies list, unlike other packages that apply /pkg/patches (for example, fakeroot/pkg.yaml:3-9 and tools-cpio/pkg.yaml:3-7). To avoid relying on the toolchain image implicitly providing patch and to stay consistent with the rest of the repo, please add - stage: patch to the dependencies.

Copilot uses AI. Check for mistakes.
- |
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_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
# rm /rootfs/usr/lib/*.a # TODO - remove static libs from the tools image
finalize:
- from: /rootfs
to: /
Loading