diff options
author | Daniel Bertalan <dani@danielbertalan.dev> | 2021-08-11 16:25:02 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-12 21:10:44 +0200 |
commit | c2c12e9dc5df09622b7900e358a7ce7de9a3cebe (patch) | |
tree | 2d81c68b2b826d16f24c485c87d1e3f8d3b7589b /Userland/DynamicLoader | |
parent | b19fe744ab7dbdb66e59853d427e38890646bb14 (diff) | |
download | serenity-c2c12e9dc5df09622b7900e358a7ce7de9a3cebe.zip |
LibC+DynamicLoader: Prevent GCC from removing null checks
GCC implements `fputc`, `fputs` and `fwrite` as builtin functions, whose
`FILE*` argument is implicitly marked `__attribute__((nonnull))`. This
causes our `VERIFY(stream)` statements to be removed. This does not
happen with Clang, as they do not use the `nonnull` attribute in this
way.
Diffstat (limited to 'Userland/DynamicLoader')
-rw-r--r-- | Userland/DynamicLoader/CMakeLists.txt | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Userland/DynamicLoader/CMakeLists.txt b/Userland/DynamicLoader/CMakeLists.txt index 95d2436d69..baa0829862 100644 --- a/Userland/DynamicLoader/CMakeLists.txt +++ b/Userland/DynamicLoader/CMakeLists.txt @@ -31,6 +31,8 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti -nodefaultlibs -nostdlib -pie set_source_files_properties (../Libraries/LibC/ssp.cpp PROPERTIES COMPILE_FLAGS "-fno-stack-protector") +# Prevent GCC from removing null checks by marking the `FILE*` argument non-null +set_source_files_properties(../Libraries/LibC/stdio.cpp PROPERTIES COMPILE_FLAGS "-fno-builtin-fputc -fno-builtin-fputs -fno-builtin-fwrite") add_executable(Loader.so ${SOURCES}) |