Skip to content

Commit 80e1b78

Browse files
stephanosiogalak
authored andcommitted
cmake: host-gcc: Detect libgcc for all archs
This commit updates the build system to always detect the libgcc path for the host platforms regardless of the target architecture. The native_posix_64 target previously used the x32 ABI (`-mx32`) and the multilib for this ABI was not commonly available in the x86-64 host toolchains. That is no longer the case because native_posix_64 had been updated to use the x86-64 ABI (`-m64`). Signed-off-by: Stephanos Ioannidis <[email protected]>
1 parent e72a327 commit 80e1b78

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

cmake/compiler/host-gcc/target.cmake

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,15 @@ else()
1818
endif()
1919
find_program(CMAKE_CXX_COMPILER ${cplusplus_compiler} CACHE INTERNAL " " FORCE)
2020

21-
# The x32 version of libgcc is usually not available (can't trust gcc
22-
# -mx32 --print-libgcc-file-name) so don't fail to build for something
23-
# that is currently not needed. See comments in compiler/gcc/target.cmake
24-
if (CONFIG_X86)
25-
# Convert to list as cmake Modules/*.cmake do it
26-
STRING(REGEX REPLACE " +" ";" PRINT_LIBGCC_ARGS "${CMAKE_C_FLAGS}")
27-
# This libgcc code is partially duplicated in compiler/*/target.cmake
28-
execute_process(
29-
COMMAND ${CMAKE_C_COMPILER} "${PRINT_LIBGCC_ARGS}" --print-libgcc-file-name
30-
OUTPUT_VARIABLE LIBGCC_FILE_NAME
31-
OUTPUT_STRIP_TRAILING_WHITESPACE
32-
)
33-
assert_exists(LIBGCC_FILE_NAME)
34-
endif()
21+
# Convert to list as cmake Modules/*.cmake do it
22+
STRING(REGEX REPLACE " +" ";" PRINT_LIBGCC_ARGS "${CMAKE_C_FLAGS}")
23+
# This libgcc code is partially duplicated in compiler/*/target.cmake
24+
execute_process(
25+
COMMAND ${CMAKE_C_COMPILER} "${PRINT_LIBGCC_ARGS}" --print-libgcc-file-name
26+
OUTPUT_VARIABLE LIBGCC_FILE_NAME
27+
OUTPUT_STRIP_TRAILING_WHITESPACE
28+
)
29+
assert_exists(LIBGCC_FILE_NAME)
3530

3631
set(NOSTDINC "")
3732

0 commit comments

Comments
 (0)