Dman95 / SASM

SASM - simple crossplatform IDE for NASM, MASM, GAS and FASM assembly languages

Home Page:http://dman95.github.io/SASM/

Repository from Github https://github.comDman95/SASMRepository from Github https://github.comDman95/SASM

Manual compilation returns " undefined reference to 'get_stdout' "

iwakura1ain opened this issue · comments

When compiling manually in a terminal, the attached include files are not recognized.

sudo nasm -f elf64 hello_sasm.asm -o hello_sasm.o

gcc -no-pie -m64 -o hello_sasm hello_sasm.o

hello_sasm.o: In function ..@25.after_data': >hello_sasm.asm:(.text+0x76): undefined reference to get_stdout' >collect2: error: ld returned 1 exit status

Even after manually adding io64.inc and io.inc into the project directory, it still does not work.

That's because io*.inc files use these functions.
You could create macro.c file:

#include <stdio.h>
FILE *get_stdin(void) { return stdin; }
FILE *get_stdout(void) { return stdout; }

Compile it to macro.o, and then use GCC to link this object file with your own.
You could also take a look at script that compiles assembly to elf32, but with some minor modifications it could produce 64 bit executables too