linking question
linking question
i'm currently keeping my source in ~/os and i have the following files loader.s, loader.o, kernel.c, kernel.o, and linker.LD but i don't really know how to actually link them together in cygwin. thank you
chik'n
You have to use ld.
It should be something like:
However, forgive me if my syntax is a little off for some reason or another.
It should be something like:
Code: Select all
ld -Tlinker.LD loader.o kernel.o -o kernel.bin
C8H10N4O2 | #446691 | Trust the nodes.
ok i did that but it doesnt work for me:
loader.o: in function 'loader' :
loader.s:<.text+0x14>: undefined reference to 'main'
and now i really don't know whats wrong
loader.o: in function 'loader' :
loader.s:<.text+0x14>: undefined reference to 'main'
and now i really don't know whats wrong
- Attachments
-
- kernel.zip
- my source
- (1.72 KiB) Downloaded 139 times
chik'n
Do:
And post the results.
JamesM
Code: Select all
nm main.o #or whatever your object file is where 'main()' is defined.
nm start.o
JamesM
Are you using a proper crosscompiler? You appear to call alloca() which you really shouldn't. Also, your compiler appears to prefix underscores which is just bad.
What this reads:
The first file defines _main and requires ___main and __alloca (both of which are nonsense, which is your compiler setup screwing up). The second file defines _loader and requires _main.
Your code is correct. Fix your compilers.
What this reads:
The first file defines _main and requires ___main and __alloca (both of which are nonsense, which is your compiler setup screwing up). The second file defines _loader and requires _main.
Your code is correct. Fix your compilers.
how?Candy wrote:Are you using a proper crosscompiler? You appear to call alloca() which you really shouldn't. Also, your compiler appears to prefix underscores which is just bad.
What this reads:
The first file defines _main and requires ___main and __alloca (both of which are nonsense, which is your compiler setup screwing up). The second file defines _loader and requires _main.
Your code is correct. Fix your compilers.
also i tried it under linux and cygwin still same thing
chik'n
http://www.osdev.org/wiki/GCC_Cross-Compiler of course.
Make a cross compiler and it will not pretend you're making a program for Windows.
Make a cross compiler and it will not pretend you're making a program for Windows.