Skip to content

Commit c9d6c4c

Browse files
mark-inderheesnashif
authored andcommitted
compiler: for xtensa add libgcc support
In order to compile with C++ exception handling for xtensa, the libgcc location needs to be known. This change uses the same logic from gcc's target.cmake to query the compiler for libgcc location and add the lib to the include list. Signed-off-by: Mark Inderhees <[email protected]>
1 parent 2de5e60 commit c9d6c4c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

cmake/compiler/xcc/target.cmake

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,17 @@ foreach(file_name include/stddef.h include-fixed/limits.h)
4040
list(APPEND NOSTDINC ${_OUTPUT})
4141
endforeach()
4242

43+
# This libgcc code is partially duplicated in compiler/*/target.cmake
44+
execute_process(
45+
COMMAND ${CMAKE_C_COMPILER} ${TOOLCHAIN_C_FLAGS} --print-libgcc-file-name
46+
OUTPUT_VARIABLE LIBGCC_FILE_NAME
47+
OUTPUT_STRIP_TRAILING_WHITESPACE
48+
)
49+
50+
get_filename_component(LIBGCC_DIR ${LIBGCC_FILE_NAME} DIRECTORY)
51+
52+
list(APPEND LIB_INCLUDE_DIR "-L\"${LIBGCC_DIR}\"")
53+
4354
# For CMake to be able to test if a compiler flag is supported by the
4455
# toolchain we need to give CMake the necessary flags to compile and
4556
# link a dummy C file.

0 commit comments

Comments
 (0)