From 45415242565926d846c357aab2735933f52f57d2 Mon Sep 17 00:00:00 2001 From: Akos Kiss Date: Thu, 14 Jan 2021 10:31:59 +0100 Subject: [PATCH] Drop `-fno-...` compiler flags from CMakeLists (#4457) - `-fno-builtin` should not be necessary: a) by default, we assume that a libc exists on the system the project is compiled for, but b) even if the assumption does not hold, `-fno-builtin` can be passed as an external CFLAG to the build system, plus c) the use of builtins is expected to help both code size and performance. (Except when jerry-math is enabled.) - `-fno-stack-protector` should not be necessary: it is the default not to instrument code with stack protection. JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu --- CMakeLists.txt | 5 +++-- jerry-core/CMakeLists.txt | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c3a992f91..ad4157a88 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -205,8 +205,9 @@ endif() if(USING_GCC OR USING_CLANG) jerry_add_compile_flags(-std=c99 -pedantic) - # Turn off stack protector - jerry_add_compile_flags(-fno-builtin -fno-stack-protector) + if(JERRY_MATH) + jerry_add_compile_flags(-fno-builtin) + endif() jerry_add_compile_warnings(all extra format-nonliteral init-self conversion sign-conversion format-security missing-declarations shadow strict-prototypes undef old-style-definition) jerry_add_compile_flags(-Wno-stack-protector -Wno-attributes -Werror) endif() diff --git a/jerry-core/CMakeLists.txt b/jerry-core/CMakeLists.txt index 4d06a9b07..44cdba97d 100644 --- a/jerry-core/CMakeLists.txt +++ b/jerry-core/CMakeLists.txt @@ -714,7 +714,7 @@ if(JERRY_MATH) set(JERRY_CORE_PKGCONFIG_REQUIRES libjerry-math) else() if(USING_GCC OR USING_CLANG) - set(CMAKE_REQUIRED_FLAGS "-Wno-error=strict-prototypes") + set(CMAKE_REQUIRED_FLAGS "-Wno-error -Wno-error=strict-prototypes") endif() check_library_exists(m sin "" HAVE_M_LIB) if(HAVE_M_LIB)