cmake: remove the use of PROPERTY_LINKER_SCRIPT_DEFINES
The support of PROPERTY_LINKER_SCRIPT_DEFINES has been broken since
the transition to CMake in 12f8f76165
.
The intention was probably to allow users / projects to adjust
PROPERTY_LINKER_SCRIPT_DEFINES by setting a CMake cache variable.
The implementation tests for the CMake variable (local scope or cache)
PROPERTY_LINKER_SCRIPT_DEFINES, but it never uses such CMake variable.
Instead it uses a CMake global property named
PROPERTY_LINKER_SCRIPT_DEFINES. CMake variables and CMake global
properties are two very different things, and therefore the current
implementation has never worked. The fact that no one has never noticed
this flaw, means that the feature has never been used as intended.
Simplify the code by removing the use of the global CMake property and
instead set the value of the property on the linker script
pre-processing invocation.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This commit is contained in:
parent
048ceb3a64
commit
9bb0140522
7 changed files with 4 additions and 27 deletions
|
@ -30,7 +30,6 @@ macro(configure_linker_script linker_script_gen linker_pass_define)
|
|||
endif()
|
||||
|
||||
zephyr_get_include_directories_for_lang(C current_includes)
|
||||
get_property(current_defines GLOBAL PROPERTY PROPERTY_LINKER_SCRIPT_DEFINES)
|
||||
|
||||
# the command to generate linker file from template
|
||||
add_custom_command(
|
||||
|
@ -48,9 +47,9 @@ macro(configure_linker_script linker_script_gen linker_pass_define)
|
|||
-MD -MF ${linker_script_gen}.dep -MT ${linker_script_gen}
|
||||
-D_LINKER
|
||||
-D_ASMLANGUAGE
|
||||
-D__MWDT_LINKER_CMD__
|
||||
-imacros ${AUTOCONF_H}
|
||||
${current_includes}
|
||||
${current_defines}
|
||||
${template_script_defines}
|
||||
${LINKER_SCRIPT}
|
||||
-E
|
||||
|
@ -160,10 +159,6 @@ endmacro()
|
|||
|
||||
# base linker options
|
||||
macro(toolchain_ld_base)
|
||||
if(NOT PROPERTY_LINKER_SCRIPT_DEFINES)
|
||||
set_property(GLOBAL PROPERTY PROPERTY_LINKER_SCRIPT_DEFINES -D__MWDT_LINKER_CMD__)
|
||||
endif()
|
||||
|
||||
# Sort the common symbols and each input section by alignment
|
||||
# in descending order to minimize padding between these symbols.
|
||||
zephyr_ld_option_ifdef(
|
||||
|
|
|
@ -56,7 +56,6 @@ macro(configure_linker_script linker_script_gen linker_pass_define)
|
|||
endif()
|
||||
|
||||
zephyr_get_include_directories_for_lang(C current_includes)
|
||||
get_property(current_defines GLOBAL PROPERTY PROPERTY_LINKER_SCRIPT_DEFINES)
|
||||
if(DEFINED SOC_LINKER_SCRIPT)
|
||||
cmake_path(GET SOC_LINKER_SCRIPT PARENT_PATH soc_linker_script_includes)
|
||||
set(soc_linker_script_includes -I${soc_linker_script_includes})
|
||||
|
@ -76,10 +75,10 @@ macro(configure_linker_script linker_script_gen linker_pass_define)
|
|||
-MD -MF ${linker_script_gen}.dep -MT ${linker_script_gen}
|
||||
-D_LINKER
|
||||
-D_ASMLANGUAGE
|
||||
-D__GCC_LINKER_CMD__
|
||||
-imacros ${AUTOCONF_H}
|
||||
${current_includes}
|
||||
${soc_linker_script_includes}
|
||||
${current_defines}
|
||||
${template_script_defines}
|
||||
-E ${LINKER_SCRIPT}
|
||||
-P # Prevent generation of debug `#line' directives.
|
||||
|
|
|
@ -3,11 +3,6 @@
|
|||
# See root CMakeLists.txt for description and expectations of these macros
|
||||
|
||||
macro(toolchain_ld_base)
|
||||
|
||||
if(NOT PROPERTY_LINKER_SCRIPT_DEFINES)
|
||||
set_property(GLOBAL PROPERTY PROPERTY_LINKER_SCRIPT_DEFINES -D__GCC_LINKER_CMD__)
|
||||
endif()
|
||||
|
||||
# TOOLCHAIN_LD_FLAGS comes from compiler/gcc/target.cmake
|
||||
# LINKERFLAGPREFIX comes from linker/ld/target.cmake
|
||||
zephyr_ld_options(
|
||||
|
|
|
@ -30,7 +30,6 @@ macro(configure_linker_script linker_script_gen linker_pass_define)
|
|||
endif()
|
||||
|
||||
zephyr_get_include_directories_for_lang(C current_includes)
|
||||
get_property(current_defines GLOBAL PROPERTY PROPERTY_LINKER_SCRIPT_DEFINES)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${linker_script_gen}
|
||||
|
@ -45,9 +44,9 @@ macro(configure_linker_script linker_script_gen linker_pass_define)
|
|||
-MD -MF ${linker_script_gen}.dep -MT ${linker_script_gen}
|
||||
-D_LINKER
|
||||
-D_ASMLANGUAGE
|
||||
-D__LLD_LINKER_CMD__
|
||||
-imacros ${AUTOCONF_H}
|
||||
${current_includes}
|
||||
${current_defines}
|
||||
${template_script_defines}
|
||||
-E ${LINKER_SCRIPT}
|
||||
-P # Prevent generation of debug `#line' directives.
|
||||
|
|
|
@ -3,11 +3,6 @@
|
|||
# See root CMakeLists.txt for description and expectations of these macros
|
||||
|
||||
macro(toolchain_ld_base)
|
||||
|
||||
if(NOT PROPERTY_LINKER_SCRIPT_DEFINES)
|
||||
set_property(GLOBAL PROPERTY PROPERTY_LINKER_SCRIPT_DEFINES -D__LLD_LINKER_CMD__)
|
||||
endif()
|
||||
|
||||
# TOOLCHAIN_LD_FLAGS comes from compiler/clang/target.cmake
|
||||
# LINKERFLAGPREFIX comes from linker/lld/target.cmake
|
||||
zephyr_ld_options(
|
||||
|
|
|
@ -59,7 +59,6 @@ macro(configure_linker_script linker_script_gen linker_pass_define)
|
|||
endif()
|
||||
|
||||
zephyr_get_include_directories_for_lang(C current_includes)
|
||||
get_property(current_defines GLOBAL PROPERTY PROPERTY_LINKER_SCRIPT_DEFINES)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${linker_script_gen}
|
||||
|
@ -75,9 +74,9 @@ macro(configure_linker_script linker_script_gen linker_pass_define)
|
|||
-MD -MF ${linker_script_gen}.dep -MT ${linker_script_gen}
|
||||
-D_LINKER
|
||||
-D_ASMLANGUAGE
|
||||
-D__GCC_LINKER_CMD__
|
||||
-imacros ${AUTOCONF_H}
|
||||
${current_includes}
|
||||
${current_defines}
|
||||
${template_script_defines}
|
||||
-E ${LINKER_SCRIPT}
|
||||
-P # Prevent generation of debug `#line' directives.
|
||||
|
|
|
@ -3,11 +3,6 @@
|
|||
# See root CMakeLists.txt for description and expectations of these macros
|
||||
|
||||
macro(toolchain_ld_base)
|
||||
|
||||
if(NOT PROPERTY_LINKER_SCRIPT_DEFINES)
|
||||
set_property(GLOBAL PROPERTY PROPERTY_LINKER_SCRIPT_DEFINES -D__GCC_LINKER_CMD__)
|
||||
endif()
|
||||
|
||||
# TOOLCHAIN_LD_FLAGS comes from compiler/gcc/target.cmake
|
||||
# LINKERFLAGPREFIX comes from linker/xt-ld/target.cmake
|
||||
zephyr_ld_options(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue