mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
Meta: Enable RELR relocations
Also add a check to serenity.sh to ensure that the toolchain is new enough for this feature to work.
This commit is contained in:
parent
7ab6816b49
commit
ba5bbde7ee
Notes:
sideshowbarker
2024-07-17 19:01:09 +09:00
Author: https://github.com/BertalanD Commit: https://github.com/SerenityOS/serenity/commit/ba5bbde7ee Pull-request: https://github.com/SerenityOS/serenity/pull/12425 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/alimpfard
3 changed files with 25 additions and 1 deletions
|
@ -274,6 +274,13 @@ if(NOT "${SERENITY_ARCH}" STREQUAL "aarch64")
|
|||
if (ENABLE_MOLD_LINKER)
|
||||
add_link_options(-fuse-ld=mold)
|
||||
endif()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang$" OR USE_MOLD_LINKER)
|
||||
add_link_options(LINKER:--pack-dyn-relocs=relr)
|
||||
else()
|
||||
add_link_options(LINKER:-z,pack-relative-relocs)
|
||||
endif()
|
||||
|
||||
add_subdirectory(Userland)
|
||||
add_subdirectory(Tests)
|
||||
endif()
|
||||
|
|
|
@ -422,6 +422,8 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|||
link_directories(${TOOLCHAIN_ROOT}/lib/gcc/${SERENITY_ARCH}-pc-serenity/${GCC_VERSION}/)
|
||||
|
||||
set(TARGET_STRING "")
|
||||
|
||||
add_link_options(LINKER:-z,pack-relative-relocs)
|
||||
else() # Assume Clang
|
||||
add_compile_options(-Waddress-of-packed-member)
|
||||
add_compile_options(-faligned-allocation)
|
||||
|
@ -429,7 +431,7 @@ else() # Assume Clang
|
|||
# We need this in order to pick up the #define __serenity__, otherwise we end up including unistd.h into the linker script
|
||||
set(TARGET_STRING "--target=${CMAKE_CXX_COMPILER_TARGET}")
|
||||
|
||||
add_link_options(LINKER:--build-id=none)
|
||||
add_link_options(LINKER:--build-id=none LINKER:--pack-dyn-relocs=relr)
|
||||
endif()
|
||||
|
||||
macro (set_new_alignment alignment)
|
||||
|
|
|
@ -242,6 +242,21 @@ build_toolchain() {
|
|||
|
||||
ensure_toolchain() {
|
||||
[ -d "$TOOLCHAIN_DIR" ] || build_toolchain
|
||||
|
||||
# FIXME: Remove this check when most people have already updated their toolchain
|
||||
if [ "$TOOLCHAIN_TYPE" = "GNU" ]; then
|
||||
local ld_version
|
||||
ld_version="$("$TOOLCHAIN_DIR"/bin/"$TARGET"-pc-serenity-ld -v)"
|
||||
local expected_version="GNU ld (GNU Binutils) 2.38"
|
||||
if [ "$ld_version" != "$expected_version" ]; then
|
||||
echo "Your toolchain has an old version of binutils installed."
|
||||
echo " installed version: \"$ld_version\""
|
||||
echo " expected version: \"$expected_version\""
|
||||
echo "Please run $ARG0 rebuild-toolchain $TARGET to update it."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
delete_toolchain() {
|
||||
|
|
Loading…
Reference in a new issue