Make riscv64 / ppc64le / loongarch64 sysroots PIE-ready#43
Open
nikitamikhaylov wants to merge 3 commits intomasterfrom
Open
Make riscv64 / ppc64le / loongarch64 sysroots PIE-ready#43nikitamikhaylov wants to merge 3 commits intomasterfrom
nikitamikhaylov wants to merge 3 commits intomasterfrom
Conversation
Member
nikitamikhaylov
commented
Apr 22, 2026
- riscv64: add librt.so -> librt.so.1 symlink so -lrt resolves to the shared library instead of falling back to the non-PIC librt.a, which would otherwise emit R_RISCV_HI20/LO12 errors under -pie.
- ppc64le: add Scrt1.o from Debian trixie libc6-dev-ppc64el-cross (2.41-11cross1) so linking with -pie no longer fails at 'cannot open Scrt1.o'.
- loongarch64: same, from libc6-dev-loong64-cross. Add refresh-linux-sysroot.sh so the procedure can be re-run later.
- riscv64: add librt.so -> librt.so.1 symlink so -lrt resolves to the shared library instead of falling back to the non-PIC librt.a, which would otherwise emit R_RISCV_HI20/LO12 errors under -pie. - ppc64le: add Scrt1.o from Debian trixie libc6-dev-ppc64el-cross (2.41-11cross1) so linking with -pie no longer fails at 'cannot open Scrt1.o'. - loongarch64: same, from libc6-dev-loong64-cross. Add refresh-linux-sysroot.sh so the procedure can be re-run later.
Drop Scrt1.o, crtbeginS.o, crtendS.o extracted from FreeBSD 13.5-RELEASE base.txz into each FreeBSD sysroot. Without them, linking with -pie fails at 'cannot open Scrt1.o' (and for freebsd-x86_64 also 'crtbeginS.o' / 'crtendS.o'). Also extend refresh-freebsd-sysroot.sh to copy the PIE startup objects as part of a full refresh so this doesn't regress next time the sysroot is regenerated, and bump the URL examples to 13.5-RELEASE (13.4 was removed from the mirror) with the corrected /releases/powerpc/powerpc64le/... path.
Add rcrt1.o (from Alpine musl-dev 1.2.5-r23) and crtbeginS.o / crtendS.o (from Alpine gcc-15.2.0-r2 libgcc) to linux-x86_64-musl/lib/. Combined with '-static-pie' in the ClickHouse build, this lets clang's driver pick these PIC variants instead of the non-PIC crtbeginT.o / crtend.o static-exe CRT, and lld then successfully emits a static Position-Independent Executable. The existing musl libc.a / crt1.o / crti.o / crtn.o were already PIC-clean and are used unchanged. Also extend refresh-linux-sysroot.sh with a 'x86_64-musl' target so the procedure can be re-run later.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.