Skip to content

Instantly share code, notes, and snippets.

@MEhrn00
Created January 31, 2024 19:07
Show Gist options
  • Select an option

  • Save MEhrn00/3110b390fed9606503831af653437e6f to your computer and use it in GitHub Desktop.

Select an option

Save MEhrn00/3110b390fed9606503831af653437e6f to your computer and use it in GitHub Desktop.
Clang inline assembly
// clang -target x86_64-pc-windows-gnu --sysroot=/usr/x86_64-w64-mingw32 -fuse-ld=lld main_asm.c -o main.exe -L/usr/lib/gcc/x86_64-w64-mingw32/13.2.0/ -static
#include <windows.h>
int main() {
asm volatile(".intel_syntax noprefix;"
"mov rax, 8;"
".att_syntax;");
return 0;
}
// clang -target x86_64-pc-windows-gnu --sysroot=/usr/x86_64-w64-mingw32 -fasm-blocks -fuse-ld=lld main_msvc.c -o main.exe -L/usr/lib/gcc/x86_64-w64-mingw32/13.2.0/ -static
#include <windows.h>
int main() {
__asm {
mov rax, 8;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment