Skip to content

libffi: build for MSVC with clang-cl - #244

Merged
sjoelund merged 1 commit into
masterfrom
libffi-clang-cl
Sep 24, 2026
Merged

sjoelund merged 1 commit into
masterfrom
libffi-clang-cl

Conversation

@sjoelund

Copy link
Copy Markdown
Member

Cross-compiling the C omc to x86_64-pc-windows-msvc builds the vendored libffi with clang-cl. The same fix as in the libffi-sys fork the Rust omc uses:

  • clang-cl assembles the GNU-syntax win64.S itself; only cl needs MASM. The preprocessed win64_intel.S carries .cfi directives that llvm-ml64 rejects.
  • A static build exports FFI_STATIC_BUILD. Without it ffi.h declares the API dllimport and types.c fails with "definition of dllimport data".
  • Build libffi when cross-compiling the C omc. Only the Rust omc and runtime-only cross builds do without it.

Assisted-by: Claude Opus 5.5

Related Issues

Purpose

Approach

Cross-compiling the C omc to x86_64-pc-windows-msvc builds the vendored
libffi with clang-cl. The same fix as in the libffi-sys fork the Rust
omc uses:

- clang-cl assembles the GNU-syntax win64.S itself; only cl needs MASM.
  The preprocessed win64_intel.S carries .cfi directives that
  llvm-ml64 rejects.
- A static build exports FFI_STATIC_BUILD. Without it ffi.h declares
  the API dllimport and types.c fails with "definition of dllimport
  data".
- Build libffi when cross-compiling the C omc. Only the Rust omc and
  runtime-only cross builds do without it.

Assisted-by: Claude Opus 5.5
@sjoelund
sjoelund merged commit 1192e07 into master Sep 24, 2026
6 checks passed
@sjoelund
sjoelund deleted the libffi-clang-cl branch September 24, 2026 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant