I've been trying to link my bootmanager files together, without much luck. Therefore I decided to build a little test thingy to see what goes wrong with the whole linking, and it's weird...
I've got three files, test.asm, main.c and Makefile. This is what they contain:
Code: Select all
Test.asm:
[bits 32]
GLOBAL _test
_test: ret
main.c:
void test();
int main() {
test();
return 0;
}
Makefile:
test:
nasm -fcoff -o test.o test.asm
gcc -C -Wall main.c
ld --oformat binary -e_main -omain.bin test.o main.o
Code: Select all
make:
main.o(.text+0x1d) main.c: undefined reference to '_test'
make.exe: *** [test] Error 1
When I open the object files in notepad they look okay, with .text, .data etc. And _test can be read in it as well.
So... what am I doing wrong? I've got this feeling it's not my code but I sure hope it is... I'm not having internet at home right now (writing from work) so reinstalling stuff get's really tricky. Not to mention quick tests or requests for more info than I just gave. In that case, you'll have to wait till monday
Thanks in advance, [: wacco :]