I would like to split my nasm code into several files, so that I can work on different pieces of code separately. However, the only way I found is using nasm %include
macro. For example. main.asm
file looks somewhat like this,
; ---- main.asm ----
%include "./header.asm"
section .text
global _start
_start:
call dummy_func
mov rax, 0x3c
mov rdx, 0x0
syscall
while header.asm
only contains
section .text
dummy_func:
ret
I have heard about a way to do this during linking. I got very interested in that, but couldn't find anything appropriate. Is it really possible? If so, can it be done with ld
? What other means are there to include a static library? (probably some more macros. However I'm not sure "macros" is the right word here)