Skip to content

Commit fbcea17

Browse files
mped-oticonaescolar
authored andcommitted
cmake: simplify configure_linker_script: avoid deriving define from name
Rather than associating defines within the function, let the call sites themselves pick the appropriate define. Add new argument for this. This also permits us to remove regex matching. No functional change expected. Signed-off-by: Mark Ruvald Pedersen <[email protected]>
1 parent 1073fba commit fbcea17

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

CMakeLists.txt

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -409,17 +409,9 @@ endif()
409409
configure_file(version.h.in ${PROJECT_BINARY_DIR}/include/generated/version.h)
410410

411411
# Run $LINKER_SCRIPT file through the C preprocessor, producing ${linker_script_gen}
412-
macro(configure_linker_script linker_script_gen)
412+
macro(configure_linker_script linker_script_gen linker_pass_define)
413413
set(extra_dependencies ${ARGN})
414414

415-
if (${linker_script_gen} MATCHES "^linker_pass_final.cmd$")
416-
set(linker_pass_define -DLINKER_PASS2)
417-
elseif (${linker_script_gen} MATCHES "^linker_app_smem_unaligned.cmd$")
418-
set(linker_pass_define -DLINKER_APP_SMEM_UNALIGNED)
419-
else()
420-
set(linker_pass_define "")
421-
endif()
422-
423415
# Different generators deal with depfiles differently.
424416
if(CMAKE_GENERATOR STREQUAL "Unix Makefiles")
425417
# Note that the IMPLICIT_DEPENDS option is currently supported only
@@ -731,6 +723,7 @@ endif() # CONFIG_CODE_DATA_RELOCATION
731723

732724
configure_linker_script(
733725
linker.cmd
726+
""
734727
${PRIV_STACK_DEP}
735728
${APP_SMEM_ALIGNED_DEP}
736729
${CODE_RELOCATION_DEP}
@@ -1159,6 +1152,7 @@ if(CONFIG_USERSPACE)
11591152

11601153
configure_linker_script(
11611154
linker_app_smem_unaligned.cmd
1155+
"-DLINKER_APP_SMEM_UNALIGNED"
11621156
${CODE_RELOCATION_DEP}
11631157
${APP_SMEM_UNALIGNED_DEP}
11641158
${APP_SMEM_UNALIGNED_LD}
@@ -1203,6 +1197,7 @@ endif()
12031197
if(CONFIG_USERSPACE AND CONFIG_ARM)
12041198
configure_linker_script(
12051199
linker_priv_stacks.cmd
1200+
""
12061201
${CODE_RELOCATION_DEP}
12071202
${APP_SMEM_ALIGNED_DEP}
12081203
${APP_SMEM_ALIGNED_LD}
@@ -1249,6 +1244,7 @@ else()
12491244
# file and preprocessed with the define LINKER_PASS2.
12501245
configure_linker_script(
12511246
linker_pass_final.cmd
1247+
"-DLINKER_PASS2"
12521248
${PRIV_STACK_DEP}
12531249
${CODE_RELOCATION_DEP}
12541250
${ZEPHYR_PREBUILT_EXECUTABLE}

0 commit comments

Comments
 (0)