Skip to content

Commit

Permalink
Forcing Intel syntax for inline assembly in BOFs
Browse files Browse the repository at this point in the history
  • Loading branch information
mzet- committed Dec 17, 2024
1 parent dcb3c86 commit 8c926e5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bofs/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,10 @@ pub fn build(
});
obj.addCSourceFile(.{
.file = .{ .cwd_relative = source_file_path },
.flags = &.{ "-DBOF", "-D_GNU_SOURCE" },
.flags = &.{ "-DBOF", "-D_GNU_SOURCE",
if (arch == .x86 or arch == .x64) "-include" ++ thisDir() ++ "/src/force_intel_asm.h" else "",
if (arch == .x86) "-DWOW64" else ""
},
});
if (format == .coff) {
obj.addIncludePath(.{ .cwd_relative = windows_include_dir });
Expand Down
2 changes: 2 additions & 0 deletions bofs/src/force_intel_asm.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#pragma once
__asm__(".intel_syntax");

0 comments on commit 8c926e5

Please sign in to comment.