From 1b33d7934f4024cc6b2998b70a9bebc7c64007e4 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 6fbcb780c..8832662d7 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");