Skip to content

[CMake] Add -Wl,-z,pack-relative-relocs if supported#208217

Open
aengelke wants to merge 1 commit into
llvm:mainfrom
aengelke:relr-default
Open

[CMake] Add -Wl,-z,pack-relative-relocs if supported#208217
aengelke wants to merge 1 commit into
llvm:mainfrom
aengelke:relr-default

Conversation

@aengelke

@aengelke aengelke commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

We should aim to provide a good experience by default. Enable RELR for PIC builds (which is on by default, even in non-dylib builds) if supported by the linker (feature-tested) and the libc (currently hardcoded as glibc 2.36+; musl has no easy way to determine support).

RELR substantially reduces the size of the dynamic relocations in PIE executables and shared libraries and therefore also lowers max-rss and startup time due to fewer page faults.

We should aim to provide a good experience by default. Enable RELR for
PIC builds (which is on by default, even in non-dylib builds) if
supported by the linker (feature-tested) and the libc (currently
hardcoded as glibc 2.36+; musl has no easy way to determine support).

Reviewers: MaskRay
@aengelke aengelke requested a review from MaskRay July 8, 2026 13:21
@llvmorg-github-actions llvmorg-github-actions Bot added the cmake Build system in general and CMake in particular label Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cmake Build system in general and CMake in particular

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant