[llvm] [CMake] Add -Wl, -z, pack-relative-relocs if supported (PR #208217)

Alexis Engelke via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 14 12:50:00 PDT 2026


================
@@ -1153,6 +1153,25 @@ if (LLVM_USE_SPLIT_DWARF AND
   endif()
 endif()
 
+# For PIC builds, enable RELR if supported by the linker and loader.
+# glibc supports RELR since 2.36. musl supports RELR since 1.2.4, but there's
+# no easy way to detect or feature-test this.
+if (LLVM_ENABLE_PIC AND LLVM_USING_GLIBC)
----------------
aengelke wrote:

> Does LLVM_USING_GLIBC exclude musl?

musl doesn't define `__GLIBC__`. (check: `check_symbol_exists(__GLIBC__ stdio.h LLVM_USING_GLIBC)`)

I never did any productive work on a FreeBSD system, so I don't feel comfortable with doing changes there. Interested folks can do this as follow up work.

https://github.com/llvm/llvm-project/pull/208217


More information about the llvm-commits mailing list