Skip to content

Commit da20563

Browse files
use config.json instead
1 parent 943b234 commit da20563

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

libc/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@ set(LIBC_NAMESPACE ${default_namespace}
4747
CACHE STRING "The namespace to use to enclose internal implementations. Must start with '__llvm_libc'."
4848
)
4949

50-
# Codegen options.
51-
option(LLVM_LIBC_KEEP_FRAME_POINTER "Keep frame pointers in LLVM libc" ON)
52-
option(LLVM_LIBC_ENABLE_STACK_PROTECTOR "Enable stack protector for LLVM libc" ON)
53-
5450
if(LLVM_LIBC_FULL_BUILD OR LLVM_LIBC_GPU_BUILD)
5551
if(NOT LIBC_HDRGEN_EXE)
5652
# We need to set up hdrgen first since other targets depend on it.

libc/cmake/modules/LLVMLibCCompileOptionRules.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@ function(_get_common_compile_options output_var flags)
6060
if (LIBC_CC_SUPPORTS_PATTERN_INIT)
6161
list(APPEND compile_options "-ftrivial-auto-var-init=pattern")
6262
endif()
63-
if (LLVM_LIBC_KEEP_FRAME_POINTER)
63+
if (LIBC_CONF_KEEP_FRAME_POINTER)
6464
list(APPEND compile_options "-fno-omit-frame-pointer")
6565
if (LIBC_TARGET_ARCHITECTURE_IS_X86)
6666
list(APPEND compile_options "-mno-omit-leaf-frame-pointer")
6767
endif()
6868
endif()
69-
if (LLVM_LIBC_ENABLE_STACK_PROTECTOR)
69+
if (LIBC_CONF_ENABLE_STACK_PROTECTOR)
7070
list(APPEND compile_options "-fstack-protector-strong")
7171
endif()
7272
list(APPEND compile_options "-Wall")

libc/config/config.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,15 @@
3030
"value": false,
3131
"doc": "Inserts prefetch for write instructions (PREFETCHW) for memset on x86 to recover performance when hardware prefetcher is disabled."
3232
}
33+
},
34+
"codegen": {
35+
"LIBC_CONF_KEEP_FRAME_POINTER": {
36+
"value": true,
37+
"doc": "Keep frame pointer in functions for better debugging experience."
38+
},
39+
"LIBC_CONF_ENABLE_STRONG_STACK_PROTECTOR": {
40+
"value": true,
41+
"doc": "Enable -fstack-protector-strong to defend against stack smashing attack."
42+
}
3343
}
3444
}

libc/docs/configure.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ See the main ``config/config.json``, and the platform and architecture specific
2525
overrides in ``config/<platform>/config.json`` and ``config/<platform>/<arch>/config.json,``
2626
to learn about the defaults for your platform and target.
2727

28+
* **"codegen" options**
29+
- ``LIBC_CONF_ENABLE_STRONG_STACK_PROTECTOR``: Enable -fstack-protector-strong to defend against stack smashing attack.
30+
- ``LIBC_CONF_KEEP_FRAME_POINTER``: Keep frame pointer in functions for better debugging experience.
2831
* **"printf" options**
2932
- ``LIBC_CONF_PRINTF_DISABLE_FIXED_POINT``: Disable printing fixed point values in printf and friends.
3033
- ``LIBC_CONF_PRINTF_DISABLE_FLOAT``: Disable printing floating point values in printf and friends.

0 commit comments

Comments
 (0)