From a240bcf1f7578c1df82674b548182e339e86c9bb Mon Sep 17 00:00:00 2001 From: Tyler Retzlaff Date: Tue, 19 Dec 2023 15:17:18 -0800 Subject: [PATCH] dpdk-rs Enhancement: update intrinsics flags for bindgen and inline * Add the -mavx flag to build of the inline translation unit to match the flag passed to clang for bindgen. * Add the rtm and cldemote flags for both bindgen and inline to make visible respective intrinsics in the application namespace. This allows build.rs to be robust to DPDK that may have intrinsics option enabled instead of inline asm. Signed-off-by: Tyler Retzlaff --- dpdk-rs/build.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dpdk-rs/build.rs b/dpdk-rs/build.rs index 6fbcb780cc..8832662d75 100644 --- a/dpdk-rs/build.rs +++ b/dpdk-rs/build.rs @@ -83,6 +83,8 @@ fn os_build() -> Result<()> { // Step 2: Generate bindings for the DPDK headers. let bindings: Bindings = Builder::default() .clang_arg(&format!("-I{}", include_path)) + .clang_arg("-mrtm") + .clang_arg("-mcldemote") .allowlist_recursively(true) .allowlist_type("rte_mbuf") .allowlist_type("rte_mempool") @@ -162,6 +164,9 @@ fn os_build() -> Result<()> { let mut builder: Build = cc::Build::new(); builder.opt_level(3); builder.flag("-march=native"); + builder.flag("-mavx"); + builder.flag("-mrtm"); + builder.flag("-mcldemote"); builder.file("inlined.c"); builder.include(include_path); builder.compile("inlined");