I have added -fno-pie in the CFLAGS, but it still shows this error:
ld -melf_i386 -T linker.ld -o kernel.bin start.o kernel.o console.o utils.o
kernel.o: In function `_main':
kernel.C:(.text+0x16): undefined reference to `__GLOBAL_OFFSET_TABLE_'
makefile:30: recipe for target 'kernel.bin' failed
make: *** [kernel.bin] Error 1
The make file is shown below:
GCC_OPTIONS = -m32 -fno-pie -nostdlib -fno-builtin -nostartfiles -nodefaultlibs -fno-exceptions -fno-rtti -fno-stack-protector -fleading-underscore -fno-asynchronous-unwind-tables
all: kernel.bin
clean:
rm -f *.o *.bin
# ==== KERNEL ENTRY POINT ====
start.o: start.asm
nasm -f aout -o start.o start.asm
# ==== UTILITIES ====
utils.o: utils.H utils.C
gcc $(GCC_OPTIONS) -c -o utils.o utils.C
# ==== DEVICES ====
console.o: console.H console.C
gcc $(GCC_OPTIONS) -c -o console.o console.C
# ==== KERNEL MAIN FILE ====
kernel.o: kernel.C
gcc $(GCC_OPTIONS) -c -o kernel.o kernel.C
kernel.bin: start.o kernel.o console.o utils.o linker.ld
ld -melf_i386 -T linker.ld -o kernel.bin start.o kernel.o console.o utils.o
May I ask help for this question?
Thank you in advance.