Skip to main content

Module c_build

Module c_build 

Source
Expand description

Release compiler flags for the vendored Aeron C build.

The choice lives here rather than in build_common.rs, which each crate’s build script include!s and so cannot be unit-tested in place.

Enums§

CpuTarget
Which CPUs a release build of Aeron C must run on.

Functions§

c_lto_flags
The CMAKE_C_FLAGS for cross-language LTO: -flto for RUSTERON_C_LTO (full, the default, or thin), and --target set to rustc’s target (cargo’s TARGET). Without it clang tags the bitcode with its own default triple (x86_64-pc-linux-gnu on Debian and Ubuntu), and lld warns on every C module linked into Rust’s x86_64-unknown-linux-gnu. The cmake crate would pass --target itself, but skips its compiler flags once CMAKE_C_FLAGS is defined.
llvm_major
The LLVM major version in rustc -vV (LLVM version: 22.1.2) or clang --version (clang version 22.1.8) output.
lto_release_c_flags
CMAKE_C_FLAGS_RELEASE under cross-language LTO. LLVM inlines a C function into a Rust caller only when the C target features are a subset of Rust’s, so C targets exactly the CPU rustc does (rustc_cpu, from -Ctarget-cpu; None keeps both on the target default).
release_c_flags
CMAKE_C_FLAGS_RELEASE for the Aeron C build of arch (CARGO_CFG_TARGET_ARCH) and vendor (CARGO_CFG_TARGET_VENDOR) for target. march (RUSTERON_C_MARCH) overrides the target’s -march.
rustc_target_cpu
The last -Ctarget-cpu in CARGO_ENCODED_RUSTFLAGS.
wants_linker_plugin_lto
Whether the final binary links with -Clinker-plugin-lto, from CARGO_ENCODED_RUSTFLAGS (flags separated by 0x1f). That flag is the switch for cross-language LTO: Aeron C is then compiled to LLVM bitcode so the linker can inline it into Rust callers.