Linker doesn't find the entry-function...

Programming, for all ages and all languages.
Post Reply
alphabetagamma
Posts: 15
Joined: Mon Dec 01, 2008 3:13 pm

Linker doesn't find the entry-function...

Post by alphabetagamma »

hi

the problem of the old topic is solved the linker works.
when i try to link my files i get the following error:

Code: Select all

i686-elf-ld -T kernel.ld kernel.o k_entry.o
i686-elf-ld: warning: cannot find entry symbol start; defaulting to ff800000
the label start ist global

Code: Select all

[global start]
i also tried to rename it to _start in the linker script.
any ideas what the problem could be ?

the source code is in the addition...
Attachments
c-kernel.rar
(1.59 KiB) Downloaded 52 times
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: Linker doesn't find the entry-function...

Post by JamesM »

Did you rename the actual start label, not just the global specifier? i.e. "_start:" -> "start:"
alphabetagamma
Posts: 15
Joined: Mon Dec 01, 2008 3:13 pm

Re: Linker doesn't find the entry-function...

Post by alphabetagamma »

yep.

i changed start in the linker script and in the asm file in every combination. with and without '_'
could you try to assemble and link it ?
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Linker doesn't find the entry-function...

Post by Combuster »

Compiles, assembles and links without errors on my regular crosscompiler.

I tried JamesM's crosscompiler for reference but it insists however that it isn't a valid windows binary :roll:
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
alphabetagamma
Posts: 15
Joined: Mon Dec 01, 2008 3:13 pm

Re: Linker doesn't find the entry-function...

Post by alphabetagamma »

so what can i do ?

could you upload your crosscompiler Combuster ? i should be able to instal it on cygwin like that one of JamesM...
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Linker doesn't find the entry-function...

Post by Combuster »

Just run through the GCC Cross-Compiler tutorial and make your own. Last time I tried blatantly copying it it stopped working as well.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Craze Frog
Member
Member
Posts: 368
Joined: Sun Sep 23, 2007 4:52 am

Re: Linker doesn't find the entry-function...

Post by Craze Frog »

Do nm kernel.o to make sure that the symbol start is actually within there, then kick the authors of ld for using wrong ("cutified") symbols in error messages and then sacrifice a goat under the full moon, do what you have to do and try again.
alphabetagamma
Posts: 15
Joined: Mon Dec 01, 2008 3:13 pm

Re: Linker doesn't find the entry-function...

Post by alphabetagamma »

with the tutorial i got the problem that he didn't find the directory behind the '..' command:

Code: Select all

cd /usr/src/build-binutils
   ../binutils-x.xx/configure --target=$TARGET --prefix=$PREFIX --disable-nls
   make all
   make install
or what does '..' mean ?
i downloaded the binutils-2.19.tar.gz but the binutils-2.19 folder in the archiv does not contain a configure folder.

edit:
start is in the assembler file not in the c kernel. but here is the output:
Attachments
Aufzeichnen.PNG
Aufzeichnen.PNG (11.47 KiB) Viewed 2512 times
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: Linker doesn't find the entry-function...

Post by JamesM »

Combuster wrote:Compiles, assembles and links without errors on my regular crosscompiler.

I tried JamesM's crosscompiler for reference but it insists however that it isn't a valid windows binary :roll:
Hmm, interesting - I assumed a full copy-paste of an entire toolchain on cygwin would work fine. It doesn't?
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: Linker doesn't find the entry-function...

Post by AJ »

Before I had managed to cross-compile, I used a copy-paste version which worked fine. I don't know if there are caveats (host os, etc?).

@g1o2k4:
g1o2k4 wrote:or what does '..' mean
Please learn how to use a command shell before trying os development. Also, "../binutils-x.xx/" is pretty standard notation.

I understand that the compiler has failed to work for whatever reason, but there is still a minimum level of knowlege you need before starting OS Development. You also need to show more initiative when it comes to interpreting compiler and linker messages. For example, in the other thread you did not understand that "undefined reference to _k_main" meant that you had to remove the leading underscore from the reference to k_main - this is a very common problem that has been covered in these forums countless times.

As you progress in os dev, you will find that you have much more cryptic errors than this, which will require an element of debugging before you ask on the forums. Please see the forum rules sticky before posting further.

Cheers,
Adam
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Linker doesn't find the entry-function...

Post by Solar »

g1o2k4 wrote:with the tutorial i got the problem that he didn't find the directory behind the '..' command:

Code: Select all

cd /usr/src/build-binutils
   ../binutils-x.xx/configure --target=$TARGET --prefix=$PREFIX --disable-nls
   make all
   make install
or what does '..' mean ?
That's what I meant when I said you should first do some "normal" developing to gain experience before jumping into kernelspace.

You downloaded binutils-2.18.tar.bz2 and unpacked it - which resulted in a directory called binutils-2.18. Then you created a directory build-binutils, cd'ed into that...

...and then, I understand from your post, you called ../binutils-x.xx/configure?

And it told you it couldn't find "the directory behind ../".

You could have tried to figure out where you went wrong. Possibly trying to list the directory ".." to find out what is there. (Which might have given you a hint.) Or even doing a full search for something called "configure" (which would also have given you a hint).

Or you could have assumed that the tutorial is broken in some way.

Since you did the latter, I foretell you will find much pain on the road of OSDev...
Every good solution is obvious once you've found it.
Post Reply