diff options
author | Timon Kruiper <timonkruiper@gmail.com> | 2023-01-30 15:16:11 +0100 |
---|---|---|
committer | Jelle Raaijmakers <jelle@gmta.nl> | 2023-02-15 22:53:19 +0100 |
commit | b2e223d2bcfe33de42cb7d7780b20957768ccc35 (patch) | |
tree | 636bfd8d2d2d19f4fa3a180e1da4962baa11c7b5 /Userland/DynamicLoader | |
parent | ecc321e099b257522df5f2c7508b8b1501fcaad5 (diff) | |
download | serenity-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')
-rw-r--r-- | Userland/DynamicLoader/CMakeLists.txt | 5 |
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 |