The bindings generated by bindgen on the x86_64-pc-windows-msvc target
produces a log of warnings, such as:
warning: `extern` block uses type `u128`, which is not FFI-safe
| compiler: *mut YR_COMPILER,
| ^^^^^^^^^^^^^^^^ not FFI-safe
|
= note: 128-bit integers don't currently have a known stable ABI
This is due to the fact that:
YR_COMPILER contains a jmp_buf variable
on this target, jmp_buf is aligned on 16-bytes
bindgen uses the u128 type for alignments on opaque types.
To avoid those warnings however, there is a somewhat simple solution:
do not make the YR_COMPILER type opaque, but make opaque all its
dependencies. This keeps the size of the generated bindings small,
but allows bindgen to expand the definition of jmp_buf, fixing the
warnings.
At the same time, some other types whose definitions were not needed
have been marked opaque, to reduce the generated codesize a bit more.
This includes YR_AC_MATCH and YR_RULES.
The bindings generated by bindgen on the x86_64-pc-windows-msvc target produces a log of warnings, such as:
This is due to the fact that:
This is an issue on the bindgen side, which should not use u128 types for alignments. See https://github.com/rust-lang/rust-bindgen/issues/2105
To avoid those warnings however, there is a somewhat simple solution: do not make the YR_COMPILER type opaque, but make opaque all its dependencies. This keeps the size of the generated bindings small, but allows bindgen to expand the definition of jmp_buf, fixing the warnings.
At the same time, some other types whose definitions were not needed have been marked opaque, to reduce the generated codesize a bit more. This includes YR_AC_MATCH and YR_RULES.