aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-22 13:43:50 +0000
committer_ov4 <ov4@ov4.org>2026-10-22 13:43:50 +0000
commit06538905915b15bde6364459929fe89cf0b8de5c (patch)
tree1ec58f49ee4d990484001c13395aae2a8e5cd328 /cmake
parent90bf56f456e22dcd98458eca14e0b152a5efb179 (diff)
feat(codegen): arrange EXTERN signatures with clang's C ABI
Every EXTERN "C" signature is now arranged by clang's CodeGen (arrangeFreeFunctionCall) for the host triple and applied by one generic lowering routine, replacing the hand-written signext/zeroext rule. clangCodeGen is linked statically into CPSCodeGen. Records still cross only through pointer types, so generated code is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/NativeCompiler.cmake5
1 files changed, 4 insertions, 1 deletions
diff --git a/cmake/NativeCompiler.cmake b/cmake/NativeCompiler.cmake
index e0b4b3f..5ff49cb 100644
--- a/cmake/NativeCompiler.cmake
+++ b/cmake/NativeCompiler.cmake
@@ -19,7 +19,7 @@ else()
set(cpsc_linker_libraries lldELF)
endif()
-foreach(cpsc_native_library clangDriver ${cpsc_linker_libraries})
+foreach(cpsc_native_library clangDriver clangCodeGen ${cpsc_linker_libraries})
get_target_property(cpsc_native_type ${cpsc_native_library} TYPE)
if(NOT cpsc_native_type STREQUAL "STATIC_LIBRARY")
message(FATAL_ERROR "Native output requires static ${cpsc_native_library}; found ${cpsc_native_type}. See doc/build.md for static dependency setup.")
@@ -75,6 +75,9 @@ target_sources(cpsc PRIVATE tools/driver/NativeCompiler.cc)
target_include_directories(cpsc PRIVATE ${CLANG_INCLUDE_DIRS} ${LLD_INCLUDE_DIRS}
"${CMAKE_BINARY_DIR}/native-runtime")
target_link_libraries(cpsc PRIVATE clangDriver ${cpsc_linker_libraries})
+# EXTERN signatures use clang's C ABI code (lib/CodeGen/CABI/ClangABI.cc).
+target_include_directories(CPSCodeGen PRIVATE ${CLANG_INCLUDE_DIRS})
+target_link_libraries(CPSCodeGen PRIVATE clangCodeGen clangDriver)
if(MINGW AND TARGET LibXml2::LibXml2)
# LLD's COFF manifest support reaches libxml2 through LLVMWindowsManifest.
# An explicit .dll.a in that interface bypasses the driver's -static flag.