Commit ac5d45a0 authored by Flavio Ceolin's avatar Flavio Ceolin Committed by Anas Nashif
Browse files

build: userspace: No merge globals



Add a compiler option to not merge globals. gen_kobject_list.py
is not capable of distinguish addresses of merged objects. The script
itself does not look wrong. The dward specification says that the
attribute DW_AT_location with opcode DW_OP_addr encodes a machine
address and whose size is the size of an address on the target machine
but for merged objects the address is longer, not clear why.

Disable global merge when userspace is enabled to avoid this problem.

Signed-off-by: default avatarFlavio Ceolin <flavio.ceolin@intel.com>
parent 43781ba2
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -388,6 +388,10 @@ include(cmake/extra_flags.cmake)

zephyr_cc_option(-fno-asynchronous-unwind-tables)

if(CONFIG_USERSPACE)
  zephyr_compile_options($<TARGET_PROPERTY:compiler,no_global_merge>)
endif()

if(CONFIG_THREAD_LOCAL_STORAGE)
# Only support local exec TLS model at this point.
zephyr_cc_option(-ftls-model=local-exec)
+2 −0
Original line number Diff line number Diff line
@@ -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 #
#################################
+2 −0
Original line number Diff line number Diff line
@@ -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")
+5 −0
Original line number Diff line number Diff line
@@ -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)
+2 −0
Original line number Diff line number Diff line
@@ -201,3 +201,5 @@ set_compiler_property(PROPERTY no_position_independent
                      -fno-pic
                      -fno-pie
)

set_compiler_property(PROPERTY no_global_merge "")