Skip to content

Instantly share code, notes, and snippets.

@micromaomao
Created January 28, 2020 23:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save micromaomao/3251e97a6147b531739e9b6b1cbb9144 to your computer and use it in GitHub Desktop.
Save micromaomao/3251e97a6147b531739e9b6b1cbb9144 to your computer and use it in GitHub Desktop.
simple asm template
cmake_minimum_required(VERSION 3.16)
project(main NONE)
add_custom_command(
OUTPUT main.o
DEPENDS main.asm
COMMAND nasm -f elf64 main.asm -o main.o
)
add_custom_command(
OUTPUT main
DEPENDS main.o
COMMAND ld main.o -o main
)
add_custom_target(build ALL DEPENDS main)
global _start
section .text
_start:
xor eax, eax
not rax
xor eax, eax
mov byte [0x0], 0 ; cause trap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment