[Solved] OpenBSD _global_offset_table_ woes
Posted: Sat Jun 28, 2014 10:28 pm
I recently changes to openbsd and attempted to compile my little OS, after much modification to the make file. When it finally did compile, I attempted to use the basic video libary I had, only to have it failing in the linking phase. The exact output is
Here is my makefile:
and the makeconfig file included by it
This was attempted on openBSD 5.5 on an amd64 computer. In case anyone wants to build the version that ran on linux, here is the git repository for it: https://github.com/Jebes/gensokyo-os
Code: Select all
kern.o(.text+0x16): In function `main':
: undefined reference to `_GLOBAL_OFFSET_TABLE_'
Code: Select all
include makeconfig
ALL=print.o kernel.sys krnldr.sys boot.bin floppy.img
all: $(ALL)
echo Build Done
kernel.sys: kern/kern.o kern/test.o
$(LD) $(LDFLAGS) -T linker.ld kern.o test.o -o kernel.sys
print.o: lib/i386/print.asm
$(AS) $(ASFLAGS) lib/i386/print.asm -o print.o
krnldr.sys: bootloader/stage2.asm bootloader/floppy.asm bootloader/fat12.asm
$(AS) bootloader/stage2.asm -o krnldr.sys
boot.bin: bootloader/bootloader.asm bootloader/floppy.asm bootloader/fat12.asm
$(AS) bootloader/bootloader.asm -o boot.bin
floppy.img: boot.bin
dd if=/dev/zero of=floppy.img bs=512 count=2880
sudo vnconfig vnd0 floppy.img
echo "a\n\n\n\n\nw\nq\n" | sudo disklabel -E vnd0
sudo newfs_msdos -a 9 -b 512 -c 1 -e 224 -F 12 -f 1440 -h 2 -r 1 -S 512 -u 18 vnd0a
mkdir -p floppy/
sudo mount -t msdos /dev/vnd0a /mnt/
sudo cp krnldr.sys kernel.sys /mnt/
sudo umount /mnt/
sudo vnconfig -u vnd0
dd if=boot.bin of=floppy.img count=1 bs=512 conv=notrunc
clean:
- rm *.bin *.sys *.img *.o *.a
Code: Select all
CPU=i386
CC=gcc
AS=nasm
ASFLAGS=-f elf32
CFLAGS=-fpic -std=c99 -ffreestanding -nostdlib -nostdinc -fno-builtin -fno-stack-protector -m32 -Iheaders/
LD=ld
LDFLAGS=-melf_i386 -static