mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +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,13 +223,12 @@ if (ENABLE_MOLD_LINKER)
|
||||||
add_link_options(-fuse-ld=mold)
|
add_link_options(-fuse-ld=mold)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT "${SERENITY_ARCH}" STREQUAL "aarch64")
|
|
||||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang$" OR ENABLE_MOLD_LINKER)
|
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang$" OR ENABLE_MOLD_LINKER)
|
||||||
add_link_options(LINKER:--pack-dyn-relocs=relr)
|
add_link_options(LINKER:--pack-dyn-relocs=relr)
|
||||||
else()
|
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)
|
add_link_options(LINKER:-z,pack-relative-relocs)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
|
||||||
|
|
||||||
add_subdirectory(Userland)
|
add_subdirectory(Userland)
|
||||||
add_subdirectory(Tests)
|
add_subdirectory(Tests)
|
||||||
|
|
|
@ -611,7 +611,10 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
set_source_files_properties(Library/MiniStdLib.cpp
|
set_source_files_properties(Library/MiniStdLib.cpp
|
||||||
PROPERTIES COMPILE_FLAGS "-fno-tree-loop-distribution -fno-tree-loop-distribute-patterns")
|
PROPERTIES COMPILE_FLAGS "-fno-tree-loop-distribution -fno-tree-loop-distribute-patterns")
|
||||||
|
|
||||||
|
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)
|
add_link_options(LINKER:-z,pack-relative-relocs)
|
||||||
|
endif()
|
||||||
else() # Assume Clang
|
else() # Assume Clang
|
||||||
add_compile_options(-Waddress-of-packed-member)
|
add_compile_options(-Waddress-of-packed-member)
|
||||||
add_compile_options(-faligned-allocation)
|
add_compile_options(-faligned-allocation)
|
||||||
|
|
Loading…
Reference in a new issue