summaryrefslogtreecommitdiff
path: root/Userland/DynamicLoader/CMakeLists.txt
diff options
context:
space:
mode:
authorTimon Kruiper <timonkruiper@gmail.com>2023-01-30 15:16:11 +0100
committerJelle Raaijmakers <jelle@gmta.nl>2023-02-15 22:53:19 +0100
commitb2e223d2bcfe33de42cb7d7780b20957768ccc35 (patch)
tree636bfd8d2d2d19f4fa3a180e1da4962baa11c7b5 /Userland/DynamicLoader/CMakeLists.txt
parentecc321e099b257522df5f2c7508b8b1501fcaad5 (diff)
downloadserenity-b2e223d2bcfe33de42cb7d7780b20957768ccc35.zip
DynamicLoader: Disable stack protector in some files for aarch64 build
The code would access the __stack_chk_guard variable in main.cpp and LibELF/Relocation.cpp before the loader was able to relocate itself, so this commit disable the stack protector for the aarch64 build to make sure that no accesses to __stack_chk_guard are inserted.
Diffstat (limited to 'Userland/DynamicLoader/CMakeLists.txt')
-rw-r--r--Userland/DynamicLoader/CMakeLists.txt5
1 files changed, 5 insertions, 0 deletions
diff --git a/Userland/DynamicLoader/CMakeLists.txt b/Userland/DynamicLoader/CMakeLists.txt
index 31d5af95d6..761dfbdc9e 100644
--- a/Userland/DynamicLoader/CMakeLists.txt
+++ b/Userland/DynamicLoader/CMakeLists.txt
@@ -30,6 +30,11 @@ set(SOURCES ${LOADER_SOURCES} ${AK_SOURCES} ${ELF_SOURCES} ${LIBC_SOURCES1} ${LI
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti -nostdlib -pie -fpic -DNO_TLS")
+if ("${SERENITY_ARCH}" STREQUAL "aarch64")
+ # On aarch64 the stack protector would be accessed before the Loader can relocate itself.
+ set_source_files_properties(main.cpp ../Libraries/LibELF/Relocation.cpp PROPERTIES COMPILE_FLAGS "-fno-stack-protector")
+endif()
+
set_source_files_properties(../Libraries/LibC/ssp.cpp PROPERTIES COMPILE_FLAGS "-fno-stack-protector")
set_source_files_properties(../Libraries/LibC/ssp_nonshared.cpp PROPERTIES COMPILE_FLAGS "-fno-stack-protector")
# Prevent GCC from removing null checks by marking the `FILE*` argument non-null