aboutsummaryrefslogtreecommitdiff
path: root/libc/cmake
diff options
context:
space:
mode:
authorSchrodinger ZHU Yifan <yifanzhu@rochester.edu>2024-03-29 20:17:11 -0400
committerGitHub <noreply@github.com>2024-03-29 20:17:11 -0400
commita8b0ecd2605ff23f495a8af64e06c35f86834e54 (patch)
tree3023e71dd8f8d23b68019cacb5055ad5253908b1 /libc/cmake
parent7de82ca369b5e9114636420a16e1c5d25283421d (diff)
downloadllvm-a8b0ecd2605ff23f495a8af64e06c35f86834e54.zip
llvm-a8b0ecd2605ff23f495a8af64e06c35f86834e54.tar.gz
llvm-a8b0ecd2605ff23f495a8af64e06c35f86834e54.tar.bz2
[libc] enable stack protectors and frame pointers on default (#86288)
Diffstat (limited to 'libc/cmake')
-rw-r--r--libc/cmake/modules/LLVMLibCCompileOptionRules.cmake9
1 files changed, 9 insertions, 0 deletions
diff --git a/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake b/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
index 5bc0898..40a1cfd 100644
--- a/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
+++ b/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
@@ -60,6 +60,15 @@ function(_get_common_compile_options output_var flags)
if (LIBC_CC_SUPPORTS_PATTERN_INIT)
list(APPEND compile_options "-ftrivial-auto-var-init=pattern")
endif()
+ if (LIBC_CONF_KEEP_FRAME_POINTER)
+ list(APPEND compile_options "-fno-omit-frame-pointer")
+ if (LIBC_TARGET_ARCHITECTURE_IS_X86)
+ list(APPEND compile_options "-mno-omit-leaf-frame-pointer")
+ endif()
+ endif()
+ if (LIBC_CONF_ENABLE_STACK_PROTECTOR)
+ list(APPEND compile_options "-fstack-protector-strong")
+ endif()
list(APPEND compile_options "-Wall")
list(APPEND compile_options "-Wextra")
# -DLIBC_WNO_ERROR=ON if you can't build cleanly with -Werror.