diff --git a/cmake/compiler/clang/target.cmake b/cmake/compiler/clang/target.cmake index afc061541f2..db7e85a1795 100644 --- a/cmake/compiler/clang/target.cmake +++ b/cmake/compiler/clang/target.cmake @@ -33,6 +33,7 @@ foreach(isystem_include_dir ${NOSTDINC}) list(APPEND isystem_include_flags -isystem ${isystem_include_dir}) endforeach() +# This libgcc code is partially duplicated in compiler/*/target.cmake execute_process( COMMAND ${CMAKE_C_COMPILER} ${TOOLCHAIN_C_FLAGS} --print-libgcc-file-name OUTPUT_VARIABLE LIBGCC_FILE_NAME diff --git a/cmake/compiler/gcc/target.cmake b/cmake/compiler/gcc/target.cmake index de3d19728c2..afbdaa118e7 100644 --- a/cmake/compiler/gcc/target.cmake +++ b/cmake/compiler/gcc/target.cmake @@ -109,6 +109,7 @@ else() endif() if(NOT no_libgcc) + # This libgcc code is partially duplicated in compiler/*/target.cmake execute_process( COMMAND ${CMAKE_C_COMPILER} ${TOOLCHAIN_C_FLAGS} --print-libgcc-file-name OUTPUT_VARIABLE LIBGCC_FILE_NAME diff --git a/cmake/compiler/host-gcc/target.cmake b/cmake/compiler/host-gcc/target.cmake index 922da85eb53..88da79a11a2 100644 --- a/cmake/compiler/host-gcc/target.cmake +++ b/cmake/compiler/host-gcc/target.cmake @@ -27,3 +27,17 @@ else() endif() endif() find_program(CMAKE_CXX_COMPILER ${cplusplus_compiler} CACHE INTERNAL " " FORCE) + +# This libgcc code is partially duplicated in compiler/*/target.cmake +execute_process( + COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAGS} --print-libgcc-file-name + OUTPUT_VARIABLE LIBGCC_FILE_NAME + OUTPUT_STRIP_TRAILING_WHITESPACE + ) +assert_exists(LIBGCC_FILE_NAME) + +# While most x86_64 Linux distributions implement "multilib" and have +# 32 bits libraries off the shelf, things like +# "/usr/lib/gcc/x86_64-linux-gnu/7/IAMCU/libgcc.a" are unheard of. +# So this does not support CONFIG_X86_IAMCU=y +LIST(APPEND TOOLCHAIN_LIBS gcc)