I have 2 files, io.s and io.h
Code: Select all
.intel_syntax noprefix
.global outb
.type outb, @function
mov al, [esp+8]
mov dx, [esp+4]
out dx, al
ret
Code: Select all
#include <stddef.h>
void outb(size_t port, size_t data);
Code: Select all
i686-elf-as io.s -o io.o
i686-elf-gcc -T linker.ld -o myos.bin -ffreestanding -O2 -nostdlib boot.o kernel.o terminal.o io.o -lgcc
terminal.o: In function `terminal_move_cursor':
terminal.c:(.text+0x61): undefined reference to `outb'
terminal.c:(.text+0x81): undefined reference to `outb'
terminal.c:(.text+0x98): undefined reference to `outb'
terminal.c:(.text+0xb1): undefined reference to `outb'
collect2: error: ld returned 1 exit status