xuxin930 commented on code in PR #12150:
URL: https://github.com/apache/nuttx/pull/12150#discussion_r1570043338


##########
arch/arm/src/cmake/Toolchain.cmake:
##########
@@ -146,44 +204,131 @@ if(CONFIG_STACK_CANARIES)
   add_compile_options(-fstack-protector-all)
 endif()
 
-if(CONFIG_ARCH_COVERAGE)
+if(CONFIG_STACK_USAGE)
+  add_compile_options(-fstack-usage)
+endif()
+if(CONFIG_STACK_USAGE_WARNING AND NOT "${CONFIG_STACK_USAGE_WARNING}" STREQUAL
+                                  "0")
+  add_compile_options(-Wstack-usage=${CONFIG_STACK_USAGE_WARNING})
+endif()
+
+if(CONFIG_ARCH_COVERAGE_ALL)
   add_compile_options(-fprofile-generate -ftest-coverage)
 endif()
 
-# Optimization of unused sections
+if(CONFIG_MM_UBSAN_ALL)
+  add_compile_options(${CONFIG_MM_UBSAN_OPTION})
+endif()
 
-if(CONFIG_DEBUG_OPT_UNUSED_SECTIONS)
-  add_link_options(-Wl,--gc-sections)
-  add_compile_options(-ffunction-sections -fdata-sections)
+if(CONFIG_MM_UBSAN_TRAP_ON_ERROR)
+  add_compile_options(-fsanitize-undefined-trap-on-error)
 endif()
 
-if(CONFIG_ENDIAN_BIG)
-  add_compile_options(-mbig-endian)
+if(CONFIG_MM_KASAN_ALL)
+  add_compile_options(-fsanitize=kernel-address)
+endif()
+
+if(CONFIG_MM_KASAN_DISABLE_READS_CHECK)
+  add_compile_options(--param asan-instrument-reads=0)
+endif()
+
+if(CONFIG_MM_KASAN_DISABLE_WRITES_CHECK)
+  add_compile_options(--param asan-instrument-writes=0)
+endif()
+
+# Instrumentation options
+
+if(CONFIG_ARCH_INSTRUMENT_ALL)
+  add_compile_options(-finstrument-functions)
+endif()
+
+if(CONFIG_UNWINDER_ARM)
+  add_compile_options(-funwind-tables -fasynchronous-unwind-tables)
 endif()
 
 # Link Time Optimization
 
 if(CONFIG_LTO_THIN)
   add_compile_options(-flto=thin)
+  if(CONFIG_ARM_TOOLCHAIN_ARMCLANG)

Review Comment:
   > Have you verified the ac6 compiler? If not, please remove all 
`CONFIG_ARM_TOOLCHAIN_ARMCLANG` logic in cmake.
   Okay, I don’t have a license, I’ll remove this
   



##########
arch/arm/src/cmake/Toolchain.cmake:
##########
@@ -146,44 +204,131 @@ if(CONFIG_STACK_CANARIES)
   add_compile_options(-fstack-protector-all)
 endif()
 
-if(CONFIG_ARCH_COVERAGE)
+if(CONFIG_STACK_USAGE)
+  add_compile_options(-fstack-usage)
+endif()
+if(CONFIG_STACK_USAGE_WARNING AND NOT "${CONFIG_STACK_USAGE_WARNING}" STREQUAL
+                                  "0")
+  add_compile_options(-Wstack-usage=${CONFIG_STACK_USAGE_WARNING})
+endif()
+
+if(CONFIG_ARCH_COVERAGE_ALL)
   add_compile_options(-fprofile-generate -ftest-coverage)
 endif()
 
-# Optimization of unused sections
+if(CONFIG_MM_UBSAN_ALL)
+  add_compile_options(${CONFIG_MM_UBSAN_OPTION})
+endif()
 
-if(CONFIG_DEBUG_OPT_UNUSED_SECTIONS)
-  add_link_options(-Wl,--gc-sections)
-  add_compile_options(-ffunction-sections -fdata-sections)
+if(CONFIG_MM_UBSAN_TRAP_ON_ERROR)
+  add_compile_options(-fsanitize-undefined-trap-on-error)
 endif()
 
-if(CONFIG_ENDIAN_BIG)
-  add_compile_options(-mbig-endian)
+if(CONFIG_MM_KASAN_ALL)
+  add_compile_options(-fsanitize=kernel-address)
+endif()
+
+if(CONFIG_MM_KASAN_DISABLE_READS_CHECK)
+  add_compile_options(--param asan-instrument-reads=0)
+endif()
+
+if(CONFIG_MM_KASAN_DISABLE_WRITES_CHECK)
+  add_compile_options(--param asan-instrument-writes=0)
+endif()
+
+# Instrumentation options
+
+if(CONFIG_ARCH_INSTRUMENT_ALL)
+  add_compile_options(-finstrument-functions)
+endif()
+
+if(CONFIG_UNWINDER_ARM)
+  add_compile_options(-funwind-tables -fasynchronous-unwind-tables)
 endif()
 
 # Link Time Optimization
 
 if(CONFIG_LTO_THIN)
   add_compile_options(-flto=thin)
+  if(CONFIG_ARM_TOOLCHAIN_ARMCLANG)

Review Comment:
   > Have you verified the ac6 compiler? If not, please remove all 
`CONFIG_ARM_TOOLCHAIN_ARMCLANG` logic in cmake.
   
   Okay, I don’t have a license, I’ll remove this
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to