diff --git a/CMakeLists.txt b/CMakeLists.txt index c9a6348f8bf..2bc2f7e78d7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -388,6 +388,10 @@ include(cmake/extra_flags.cmake) zephyr_cc_option(-fno-asynchronous-unwind-tables) +if(CONFIG_USERSPACE) + zephyr_compile_options($) +endif() + if(CONFIG_THREAD_LOCAL_STORAGE) # Only support local exec TLS model at this point. zephyr_cc_option(-ftls-model=local-exec) diff --git a/cmake/compiler/arcmwdt/compiler_flags.cmake b/cmake/compiler/arcmwdt/compiler_flags.cmake index 318e8c30a8d..bab3ab5c135 100644 --- a/cmake/compiler/arcmwdt/compiler_flags.cmake +++ b/cmake/compiler/arcmwdt/compiler_flags.cmake @@ -185,6 +185,8 @@ set_property(TARGET compiler-cpp PROPERTY no_threadsafe_statics "-fno-threadsafe # but it has PIE disabled by default - so no extra flags are required here. set_compiler_property(PROPERTY no_position_independent "") +set_compiler_property(PROPERTY no_global_merge "") + ################################# # This section covers asm flags # ################################# diff --git a/cmake/compiler/clang/compiler_flags.cmake b/cmake/compiler/clang/compiler_flags.cmake index bdf00e9aaad..6644459e3c9 100644 --- a/cmake/compiler/clang/compiler_flags.cmake +++ b/cmake/compiler/clang/compiler_flags.cmake @@ -108,3 +108,5 @@ set_compiler_property(PROPERTY warning_error_coding_guideline -Wconversion -Woverride-init ) + +set_compiler_property(PROPERTY no_global_merge "-mno-global-merge") diff --git a/cmake/compiler/compiler_flags_template.cmake b/cmake/compiler/compiler_flags_template.cmake index 6c020c2c475..b043bffbbfe 100644 --- a/cmake/compiler/compiler_flags_template.cmake +++ b/cmake/compiler/compiler_flags_template.cmake @@ -115,3 +115,8 @@ set_compiler_property(PROPERTY warning_no_pointer_arithmetic) # Compiler flags for disabling position independent code / executable set_compiler_property(PROPERTY no_position_independent) + +# Compiler flag to avoid combine more than one global variable into a single aggregate. +# gen_kobject_list.py is does not understand it and end up identifying objects as if +# they had the same address. +set_compiler_property(PROPERTY no_global_merge) diff --git a/cmake/compiler/gcc/compiler_flags.cmake b/cmake/compiler/gcc/compiler_flags.cmake index cfa594d4314..6d8590b7fee 100644 --- a/cmake/compiler/gcc/compiler_flags.cmake +++ b/cmake/compiler/gcc/compiler_flags.cmake @@ -201,3 +201,5 @@ set_compiler_property(PROPERTY no_position_independent -fno-pic -fno-pie ) + +set_compiler_property(PROPERTY no_global_merge "")