Skip to content

Commit

Permalink
clang: Use compiler-rt path provided by compiler instead of libgcc
Browse files Browse the repository at this point in the history
Newer versions of Clang compiler no longer use 'libgcc.a' for their
runtime library. For example, the compiler prints the following with
`--print-libgcc-file-name` option:
```
/usr/lib64/clang/17/lib/baremetal/libclang_rt.builtins-armv7m.a
```

To keep it compatible with older Clang compilers and different
architectures, we can provide full path to runtime library instead of
name only.

Signed-off-by: Patryk Duda <[email protected]>
  • Loading branch information
duda-patryk committed Jun 29, 2023
1 parent 71280b5 commit bcd660e
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions cmake/compiler/clang/target.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,7 @@ if(NOT "${ARCH}" STREQUAL "posix")
OUTPUT_VARIABLE LIBGCC_FILE_NAME
OUTPUT_STRIP_TRAILING_WHITESPACE
)

get_filename_component(LIBGCC_DIR ${LIBGCC_FILE_NAME} DIRECTORY)

list(APPEND LIB_INCLUDE_DIR "-L\"${LIBGCC_DIR}\"")
if(LIBGCC_DIR)
list(APPEND TOOLCHAIN_LIBS gcc)
endif()
list(APPEND TOOLCHAIN_LIBS ${LIBGCC_FILE_NAME})

list(APPEND CMAKE_REQUIRED_FLAGS -nostartfiles -nostdlib ${isystem_include_flags})
string(REPLACE ";" " " CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
Expand Down

0 comments on commit bcd660e

Please sign in to comment.