From 467e4bfc9cbe649cba202085c8a888b94eaa6269 Mon Sep 17 00:00:00 2001 From: Karol Trzcinski Date: Fri, 27 Mar 2020 12:52:22 +0100 Subject: [PATCH] logger: Make CC_DESC string length indivisible by four When variable length array, filled with string will be placed in sucha manner that null terminator address will be divisible by four, then it will be lost in output binary file. It leads to troubles during scanning content of such a section. Such a problem occur in firmware and produce logger and FW debug ABI mismatch and it's why logger output is broken. After change length of XCC_TOOLS_VERSION to be none of number four multiplication problem with logger disappear. Signed-off-by: Karol Trzcinski --- scripts/cmake/xtensa-toolchain.cmake | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/cmake/xtensa-toolchain.cmake b/scripts/cmake/xtensa-toolchain.cmake index c65caa2a934e..0c3127a42425 100644 --- a/scripts/cmake/xtensa-toolchain.cmake +++ b/scripts/cmake/xtensa-toolchain.cmake @@ -81,3 +81,9 @@ if(XCC) else() string(REGEX MATCH "([^\/\\]+)$" XCC_TOOLS_VERSION "${TOOLCHAIN}") endif() + +string(LENGTH "${XCC_TOOLS_VERSION}" XCC_TOOLS_VERSION_STR_LEN) +math(EXPR XCC_TOOLS_VERSION_PADDING "(${XCC_TOOLS_VERSION_STR_LEN} + 1) % 4") +if(XCC_TOOLS_VERSION_PADDING EQUAL 0) + set(XCC_TOOLS_VERSION "<${XCC_TOOLS_VERSION}>") +endif()