ASM: Assembler sources not built in LLVM libunwind on NetBSD
libunwind adds assembler files to the sources for a target, but these are just ignored on NetBSD.
A workaround is to tag them as C sources, then everything works fine.
From libunwind 15.0.6/src/CMakeLists.txt
:
set(LIBUNWIND_ASM_SOURCES
UnwindRegistersRestore.S
UnwindRegistersSave.S
)
...
set(LIBUNWIND_SOURCES
${LIBUNWIND_CXX_SOURCES}
${LIBUNWIND_C_SOURCES}
${LIBUNWIND_ASM_SOURCES})
...
add_library(unwind_shared_objects OBJECT EXCLUDE_FROM_ALL ${LIBUNWIND_SOURCES} ${LIBUNWIND_HEADERS})
There is already a workaround in that file for other platforms:
# See add_asm_sources() in compiler-rt for explanation of this workaround.
# CMake doesn't work correctly with assembly on AIX. Workaround by compiling
# as C files as well.
if((APPLE AND CMAKE_VERSION VERSION_LESS 3.19) OR
(MINGW AND CMAKE_VERSION VERSION_LESS 3.17) OR
(${CMAKE_SYSTEM_NAME} MATCHES "AIX"))
set_source_files_properties(${LIBUNWIND_ASM_SOURCES} PROPERTIES LANGUAGE C)
endif()
if I extend that to NetBSD, everything works fine:
set_source_files_properties(${LIBUNWIND_ASM_SOURCES} PROPERTIES LANGUAGE C)
If not, the *.S files are just ignored during the build.