Arm Compiler 6 support uses incorrect `CMAKE_C_LINKER_WRAPPER_FLAG`
The toolchain identification logic for Arm Compiler 6 uses armlink
over armclang
as its linker, which means that any LINKER:
link options need to be replaced with "" instead of the current "-Xlinker; ".
Here is the full chain of modifications made to the variable starting from the toolchain file:
-- The C compiler identification is ARMClang 6.14.101
-- The ASM compiler identification is ARMClang
-- Found assembler: /arm/tools/arm/armds/2020.a/sw/ARMCompiler6.14.1/bin/armclang
CMake Debug Log at /snap/cmake/549/share/cmake-3.18/Modules/Compiler/GNU.cmake:39 (set):
Variable "CMAKE_C_LINKER_WRAPPER_FLAG" was accessed using MODIFIED_ACCESS
with value "-Wl,".
Call Stack (most recent call first):
/snap/cmake/549/share/cmake-3.18/Modules/Compiler/Clang.cmake:22 (__compiler_gnu)
/snap/cmake/549/share/cmake-3.18/Modules/Compiler/Clang-C.cmake:2 (__compiler_clang)
/snap/cmake/549/share/cmake-3.18/Modules/Compiler/ARMClang-C.cmake:1 (include)
/snap/cmake/549/share/cmake-3.18/Modules/CMakeCInformation.cmake:25 (include)
CMakeLists.txt:10 (project)
CMake Debug Log at /snap/cmake/549/share/cmake-3.18/Modules/Compiler/GNU.cmake:39 (set):
Variable "CMAKE_C_LINKER_WRAPPER_FLAG" was accessed using MODIFIED_ACCESS
with value "-Wl,".
Call Stack (most recent call first):
/snap/cmake/549/share/cmake-3.18/Modules/Compiler/Clang.cmake:22 (__compiler_gnu)
/snap/cmake/549/share/cmake-3.18/Modules/Compiler/Clang-C.cmake:2 (__compiler_clang)
/snap/cmake/549/share/cmake-3.18/Modules/Compiler/ARMClang-C.cmake:1 (include)
/snap/cmake/549/share/cmake-3.18/Modules/CMakeCInformation.cmake:25 (include)
CMakeLists.txt:10 (project)
CMake Debug Log at /snap/cmake/549/share/cmake-3.18/Modules/Compiler/Clang.cmake:39 (set):
Variable "CMAKE_C_LINKER_WRAPPER_FLAG" was accessed using MODIFIED_ACCESS
with value "-Xlinker; ".
Call Stack (most recent call first):
/snap/cmake/549/share/cmake-3.18/Modules/Compiler/Clang-C.cmake:2 (__compiler_clang)
/snap/cmake/549/share/cmake-3.18/Modules/Compiler/ARMClang-C.cmake:1 (include)
/snap/cmake/549/share/cmake-3.18/Modules/CMakeCInformation.cmake:25 (include)
CMakeLists.txt:10 (project)
CMake Debug Log at /snap/cmake/549/share/cmake-3.18/Modules/Compiler/Clang.cmake:39 (set):
Variable "CMAKE_C_LINKER_WRAPPER_FLAG" was accessed using MODIFIED_ACCESS
with value "-Xlinker; ".
Call Stack (most recent call first):
/snap/cmake/549/share/cmake-3.18/Modules/Compiler/Clang-C.cmake:2 (__compiler_clang)
/snap/cmake/549/share/cmake-3.18/Modules/Compiler/ARMClang-C.cmake:1 (include)
/snap/cmake/549/share/cmake-3.18/Modules/CMakeCInformation.cmake:25 (include)
CMakeLists.txt:10 (project)
-- Detecting C compiler ABI info
CMake Debug Log at /snap/cmake/549/share/cmake-3.18/Modules/Compiler/GNU.cmake:39 (set):
Variable "CMAKE_C_LINKER_WRAPPER_FLAG" was accessed using MODIFIED_ACCESS
with value "-Wl,".
Call Stack (most recent call first):
/snap/cmake/549/share/cmake-3.18/Modules/Compiler/Clang.cmake:22 (__compiler_gnu)
/snap/cmake/549/share/cmake-3.18/Modules/Compiler/Clang-C.cmake:2 (__compiler_clang)
/snap/cmake/549/share/cmake-3.18/Modules/Compiler/ARMClang-C.cmake:1 (include)
/snap/cmake/549/share/cmake-3.18/Modules/CMakeCInformation.cmake:25 (include)
/tmp/scp-cmake/CMakeFiles/CMakeTmp/CMakeLists.txt:2 (project)
CMake Debug Log at /snap/cmake/549/share/cmake-3.18/Modules/Compiler/Clang.cmake:39 (set):
Variable "CMAKE_C_LINKER_WRAPPER_FLAG" was accessed using MODIFIED_ACCESS
with value "-Xlinker; ".
Call Stack (most recent call first):
/snap/cmake/549/share/cmake-3.18/Modules/Compiler/Clang-C.cmake:2 (__compiler_clang)
/snap/cmake/549/share/cmake-3.18/Modules/Compiler/ARMClang-C.cmake:1 (include)
/snap/cmake/549/share/cmake-3.18/Modules/CMakeCInformation.cmake:25 (include)
/tmp/scp-cmake/CMakeFiles/CMakeTmp/CMakeLists.txt:2 (project)
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /arm/tools/arm/armds/2020.a/sw/ARMCompiler6.14.1/bin/armclang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found CMSIS: /data/scp/git/cmsis found components: CORE
-- Found Git: /usr/bin/git (found version "2.17.1")
-- Configuring done
CMake Debug Log in product/sgm775/scp_romfw/CMakeLists.txt:
Variable "CMAKE_C_LINKER_WRAPPER_FLAG" was accessed using READ_ACCESS with
value "-Xlinker; ".
CMake Debug Log in product/sgm775/scp_romfw/CMakeLists.txt:
Variable "CMAKE_C_LINKER_WRAPPER_FLAG" was accessed using READ_ACCESS with
value "-Xlinker; ".
Toolchain files can work around this issue by forcing the value back to an empty string:
macro(reset_linker_wrapper_flag)
set(CMAKE_C_LINKER_WRAPPER_FLAG "")
set(CMAKE_CXX_LINKER_WRAPPER_FLAG "")
endmacro()
variable_watch(CMAKE_C_LINKER_WRAPPER_FLAG reset_linker_wrapper_flag)
variable_watch(CMAKE_CXX_LINKER_WRAPPER_FLAG reset_linker_wrapper_flag)
This applies to at least CMake v3.18.2.