Skip to content

Commit

Permalink
[dpdk-rs] Enhancement update intrinsics flags for bindgen and inline
Browse files Browse the repository at this point in the history
* 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 <roretzla@microsoft.com>
  • Loading branch information
tylerretzlaff committed Dec 19, 2023
1 parent 104ca1f commit 27534d6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions dpdk-rs/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 27534d6

Please sign in to comment.