How to link without errors? [SOLVED, lmao so easy]
Posted: Sun Oct 09, 2016 4:45 am
Original question i asked on SO: http://stackoverflow.com/questions/3991 ... -linker-ld
I am currently following the Bare Bones tutorial from OSDev and i have set up everything and compiled the kernel and bootloader into object files, and i have the .ld file. However, when i try to link the files and produce it into a bin using:, i get this error:
""
I know what "ld returned 1 exit status" means (ld has gotten a error, not a error itself, just indicating errors.). The other solutions i have tried either give more errors or do absolutely nothing. Adding -T does nothing. I'm using Windows 10 and have the .exe's and etc. from a source which i don't have the link to, and i'm using GCC. I also put 4 dll's for gcc to work without errors. I have already compiled the assembly and C into object files, but nothing. I removed every part that has to do with GRUB/Multiboot except protected mode (possibly) and 32 bit code, and there are no errors in the code. I've never seen a solution that involves "cannot open linker script file linker.ld", and linking by default either literally ignores every piece of assembly code beacuse it's not "machine code" (it is, normally ignores /001 or /000 or /003 or &) or gives the same error (possibly with a few more errors).
I am currently following the Bare Bones tutorial from OSDev and i have set up everything and compiled the kernel and bootloader into object files, and i have the .ld file. However, when i try to link the files and produce it into a bin using:
Code: Select all
i686-elf-gcc -T linker.ld -o myos.bin -ffreestanding -O2 -nostdlib boot.o kernel.o -lgcc
"
Code: Select all
.../i686/bin/../lib/gcc/i686-elf/4.8.2/../../../../i686-elf/bin/ld.exe: cannot open linker script file linker.ld
collect2.exe: error: ld returned 1 exit status
I know what "ld returned 1 exit status" means (ld has gotten a error, not a error itself, just indicating errors.). The other solutions i have tried either give more errors or do absolutely nothing. Adding -T does nothing. I'm using Windows 10 and have the .exe's and etc. from a source which i don't have the link to, and i'm using GCC. I also put 4 dll's for gcc to work without errors. I have already compiled the assembly and C into object files, but nothing. I removed every part that has to do with GRUB/Multiboot except protected mode (possibly) and 32 bit code, and there are no errors in the code. I've never seen a solution that involves "cannot open linker script file linker.ld", and linking by default either literally ignores every piece of assembly code beacuse it's not "machine code" (it is, normally ignores /001 or /000 or /003 or &) or gives the same error (possibly with a few more errors).