diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 45dd615..e6b803a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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 - name: Login to registry if: github.event_name != 'pull_request' uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # version: v3.6.0 diff --git a/.kres.yaml b/.kres.yaml index 066498b..f965132 100644 --- a/.kres.yaml +++ b/.kres.yaml @@ -9,6 +9,7 @@ spec: - tools-libcap - tools-libselinux - tools-libsepol + - tools-llvm - tools-openssl - tools-pcre2 - tools-squashfs-tools @@ -17,7 +18,7 @@ spec: - tools-xz - tools-zlib-ng - tools-zstd - reproducibleTargetName: tools + reproducibleTargetName: tools-llvm --- kind: common.Renovate spec: diff --git a/Makefile b/Makefile index ab7c04a..a52be4a 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -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 @@ -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 diff --git a/Pkgfile b/Pkgfile index e279dd0..3d293c7 100644 --- a/Pkgfile +++ b/Pkgfile @@ -192,6 +192,21 @@ vars: libuv_sha256: 27e55cf7083913bfb6826ca78cde9de7647cded648d35f24163f2d31bb9f51cd libuv_sha512: cf3ca916fc3a762a194dac86718a5a7fe24f230e34172a48f9b3401ad72fbc1cf21b46ceaba956cdf6783d323e518d40f8632fff965943869819a1c26992a3c1 + # renovate: datasource=github-releases extractVersion=^llvmorg-(?.*)$ 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(?.*)$ depName=git://git.savannah.gnu.org/m4.git m4_version: 1.4.20 m4_sha256: e236ea3a1ccf5f6c270b1c4bb60726f371fa49459a8eaaebc90b216b328daf2b diff --git a/clang/pkg.yaml b/clang/pkg.yaml new file mode 100644 index 0000000..0d88ea7 --- /dev/null +++ b/clang/pkg.yaml @@ -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: / diff --git a/lld/patches/fix-memory-mf_exec-on-aarch64.patch b/lld/patches/fix-memory-mf_exec-on-aarch64.patch new file mode 100644 index 0000000..211012a --- /dev/null +++ b/lld/patches/fix-memory-mf_exec-on-aarch64.patch @@ -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 diff --git a/lld/patches/llvm-stack-size.patch b/lld/patches/llvm-stack-size.patch new file mode 100644 index 0000000..9486225 --- /dev/null +++ b/lld/patches/llvm-stack-size.patch @@ -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 +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 diff --git a/lld/pkg.yaml b/lld/pkg.yaml new file mode 100644 index 0000000..b2b44e6 --- /dev/null +++ b/lld/pkg.yaml @@ -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 + - | + 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: / diff --git a/llvm/patches/fix-memory-mf_exec-on-aarch64.patch b/llvm/patches/fix-memory-mf_exec-on-aarch64.patch new file mode 100644 index 0000000..211012a --- /dev/null +++ b/llvm/patches/fix-memory-mf_exec-on-aarch64.patch @@ -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 diff --git a/llvm/patches/llvm-stack-size.patch b/llvm/patches/llvm-stack-size.patch new file mode 100644 index 0000000..9486225 --- /dev/null +++ b/llvm/patches/llvm-stack-size.patch @@ -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 +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 diff --git a/llvm/pkg.yaml b/llvm/pkg.yaml new file mode 100644 index 0000000..8dc0499 --- /dev/null +++ b/llvm/pkg.yaml @@ -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 + - | + 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: / diff --git a/tools-llvm/pkg.yaml b/tools-llvm/pkg.yaml new file mode 100644 index 0000000..0445ceb --- /dev/null +++ b/tools-llvm/pkg.yaml @@ -0,0 +1,18 @@ +name: tools-llvm +variant: scratch +dependencies: + - stage: base + - stage: llvm + to: /rootfs + # - stage: clang + # to: /rootfs + # - stage: lld + # to: /rootfs +steps: + - prepare: + - | + # remove LLVM development files + rm -rf /rootfs/usr/include /rootfs/usr/lib/cmake /rootfs/usr/lib/libLLVM*.a +finalize: + - from: /rootfs + to: /