thomtl is making a good suggesting about making a cross compiler rather than use you the native compiler on your OS. The problem is in how you are building and linking your code. The issue is that your native compiler is defaulting to position independent code and position independent executable code generation. You are hiding the problem(not fixing it) by adding
--ignore-unresolved-symbol _GLOBAL_OFFSET_TABLE_ to your linking command. Remove this from the linking step, and add the `-fno-PIE` option instead. You will also have to compile the .c files without position independent code as well so you'll need to add the `-fno-PIC` flag to the C flags you are using. The changedlines in your build file could look like:
Code:
# default variables
CFLAGS="-m32 -c -g -O2 -W -Wall -Wextra -Werror -fno-PIC "\
"-ffreestanding -std=gnu99 -fno-builtin -Ikernel/include -Ilibc/include"
CFLAGS_LIBC="-m32 -c -g -O2 -W -Wall -Wextra -Werror -fno-PIC "\
"-ffreestanding -std=gnu99 -fno-builtin -Ikernel/include -Ilibc/include"
then:
Code:
ld -g -m elf_i386 -T kernel/link.ld -no-PIE -o kernel.bin kentry.o kernel.o video.o gdt.o idt.o isr.o timer.o x86.o interrupt.o vbe.o gui.o libc.a
I am curious where you might have learned to use
--ignore-unresolved-symbol _GLOBAL_OFFSET_TABLE_? Someone else in the past few weeks had the same problem in a question on this forum.