mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
CMake: Enable RELR relocations for Clang OR x86-64
While LLD and mold support RELR "packed" relocations on all architectures, the BFD linker currently only implements them on x86-64 and POWER. This fixes two issues: - The Kernel had it enabled even for AArch64 + GCC, which led to the following being printed: `warning: -z pack-relative-relocs ignored`. - The userland always had it disabled, even in the supported AArch64 + Clang/mold scenarios.
This commit is contained in:
parent
11896868d6
commit
055d2b6c8a
Notes:
sideshowbarker
2024-07-18 05:37:06 +09:00
Author: https://github.com/BertalanD Commit: https://github.com/SerenityOS/serenity/commit/055d2b6c8a Pull-request: https://github.com/SerenityOS/serenity/pull/20492 Reviewed-by: https://github.com/kleinesfilmroellchen ✅
2 changed files with 9 additions and 7 deletions
|
@ -223,12 +223,11 @@ if (ENABLE_MOLD_LINKER)
|
|||
add_link_options(-fuse-ld=mold)
|
||||
endif()
|
||||
|
||||
if(NOT "${SERENITY_ARCH}" STREQUAL "aarch64")
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang$" OR ENABLE_MOLD_LINKER)
|
||||
add_link_options(LINKER:--pack-dyn-relocs=relr)
|
||||
else()
|
||||
add_link_options(LINKER:-z,pack-relative-relocs)
|
||||
endif()
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang$" OR ENABLE_MOLD_LINKER)
|
||||
add_link_options(LINKER:--pack-dyn-relocs=relr)
|
||||
elseif("${SERENITY_ARCH}" STREQUAL "x86_64")
|
||||
# The BFD linker only supports RELR relocations on x86 and POWER.
|
||||
add_link_options(LINKER:-z,pack-relative-relocs)
|
||||
endif()
|
||||
|
||||
add_subdirectory(Userland)
|
||||
|
|
|
@ -611,7 +611,10 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|||
set_source_files_properties(Library/MiniStdLib.cpp
|
||||
PROPERTIES COMPILE_FLAGS "-fno-tree-loop-distribution -fno-tree-loop-distribute-patterns")
|
||||
|
||||
add_link_options(LINKER:-z,pack-relative-relocs)
|
||||
if ("${SERENITY_ARCH}" STREQUAL "x86_64")
|
||||
# The BFD linker only supports RELR relocations on x86 and POWER.
|
||||
add_link_options(LINKER:-z,pack-relative-relocs)
|
||||
endif()
|
||||
else() # Assume Clang
|
||||
add_compile_options(-Waddress-of-packed-member)
|
||||
add_compile_options(-faligned-allocation)
|
||||
|
|
Loading…
Reference in a new issue