xing1357/SimpleOS

Makefile

SwoleDuck opened this issue · 2 comments

Makefile contains the building of file
hd.c ( currently it does not exists in the repo as far as i know)

Also, have some problems with the linker

/usr/bin/ld -m elf_i386 -T ./config/linker.ld -nostdlib --allow-multiple-definition -o out/SimpleOS.bin obj/asm/entry.o obj/asm/load_gdt.o obj/asm/load_idt.o obj/asm/exception.o obj/asm/irq.o obj/asm/load_tss.o obj/io_ports.o obj/vga.o obj/string.o obj/console.o obj/gdt.o obj/idt.o obj/isr.o obj/8259_pic.o obj/keyboard.o obj/mouse.o obj/kernel.o obj/gui.o obj/ext2.o obj/ide.o obj/tss.o obj/kheap.o obj/pmm.o
/usr/bin/ld: obj/string.o: in function `malloc':
string.c:(.text+0x4f4): undefined reference to `__stack_chk_fail_local'
/usr/bin/ld: obj/console.o: in function `printf':
console.c:(.text+0xa1d): undefined reference to `__stack_chk_fail_local'
/usr/bin/ld: obj/mouse.o: in function `mouse_handler':
mouse.c:(.text+0x3ed): undefined reference to `__stack_chk_fail_local'
/usr/bin/ld: obj/ext2.o: in function `read_inode':
ext2.c:(.text+0xd14): undefined reference to `__stack_chk_fail_local'
/usr/bin/ld: obj/ext2.o: in function `ext2_read_dir':
ext2.c:(.text+0xede): undefined reference to `__stack_chk_fail_local'
/usr/bin/ld: obj/ide.o:ide.c:(.text+0x8f9): more undefined references to `__stack_chk_fail_local' follow
/usr/bin/ld: out/SimpleOS.bin: hidden symbol `__stack_chk_fail_local' isn't defined
/usr/bin/ld: final link failed: bad value
make: *** [Makefile:59: all] Error 1

It is solved with adding the -fno-stack-protector in the CC_FLAGS but i dont think its safe.
My linker is

  1. GNU ld (GNU Binutils) 2.38

I dont know if its appropriate to include this in here as its probably a bug with my linker, you can close it if nobody else has this problem

What is your linux distro? Some include patched versions of gcc. Also, I think this might help in resolving your other issue.

Linux version: 5.18.15-arch1-2-64bit

The sse instructions are definetely related to my gcc version and i can bypass them if i use the flag -mno-sse

For the '_undefined reference to '_stack_chk_fail_local'', i do not have a good grasp on how the linker script works but it could be a fault of the gcc

Not related to this issue
I have started a conversation in the discussion panel ( just pointing it out in case there was no pop up in your feed ). I would appreciate it if you could read/answer it.