summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorBrian Gianforcaro <bgianf@serenityos.org>2021-05-23 01:04:26 -0700
committerLinus Groh <mail@linusgroh.de>2021-05-23 20:17:00 +0100
commite706de8f91dc5f3401b9f0fd249a91c475c809e1 (patch)
treee991e12162168de824002dd24b469fef3c098dfb /Userland
parentd23425bfc04c75f1f56d59c58633d3fe45d23718 (diff)
downloadserenity-e706de8f91dc5f3401b9f0fd249a91c475c809e1.zip
LibM: Fix linking with LibM when compiling Userland without -O2
While playing with conditionally disabling -O2 optimization when building the Userland subdirectory, I discovered that we can no longer link errors without -O2. This happens as LibM.so doesn't link to anything else, resulting in no stack protector implementation. It appears that optimization somehow avoids this problem? To fix this inject LibC/ssp.cpp as we do with in dynamic loader.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibM/CMakeLists.txt3
1 files changed, 3 insertions, 0 deletions
diff --git a/Userland/Libraries/LibM/CMakeLists.txt b/Userland/Libraries/LibM/CMakeLists.txt
index bdb9baf78a..3990dae123 100644
--- a/Userland/Libraries/LibM/CMakeLists.txt
+++ b/Userland/Libraries/LibM/CMakeLists.txt
@@ -1,7 +1,10 @@
set(SOURCES
math.cpp
+ ../LibC/ssp.cpp
)
+set_source_files_properties (../LibC/ssp.cpp PROPERTIES COMPILE_FLAGS
+ "-fno-stack-protector")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -nostdlib")
serenity_libc(LibM m)