Skip to content

Commit 4378254

Browse files
SebastianBoembolivar-nordic
authored andcommitted
[nrf toup] Test: Build: Don't put host filepaths into firmware
Replace the path of tf-m-tests repo with the literal "TFM_TEST_REPO_PATH" in C preprocessor macro expansions to prevent host file path information from leaking into __FILE__ macros and breaking reproducible builds. Signed-off-by: Sebastian Bøe <[email protected]> (cherry picked from commit a9bbcff)
1 parent d342827 commit 4378254

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@ add_subdirectory(tools)
8181
add_subdirectory(secure_fw)
8282

8383
if(NS OR TFM_S_REG_TEST OR TFM_NS_REG_TEST OR TEST_BL2 OR TEST_BL1_1 OR TEST_BL1_2)
84+
# Replace the path of the tf-m-tests repo with the literal
85+
# "TFM_TEST_REPO_PATH" in C preprocessor macro expansions to
86+
# prevent host file path information from leaking into __FILE__
87+
# macros and breaking reproducible builds.
88+
add_compile_options(
89+
-fmacro-prefix-map=${TFM_TEST_REPO_PATH}=TFM_TEST_REPO_PATH
90+
)
91+
8492
add_subdirectory(${TFM_TEST_REPO_PATH} ${CMAKE_CURRENT_BINARY_DIR}/tf-m-tests)
8593
endif()
8694

0 commit comments

Comments
 (0)