Problem with the gnu linker (ld.exe)

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

Re: Problem with the gnu linker (ld.exe)

Post by alphabetagamma »

Code: Select all

ld -v
file k_entry.o
file kernel.o
gives the results in the addition.

by the way:
when i use the assembler command "-f elf" instead of "-f aout" and then try to link it with "ld -T kernel.ld kernel.o k_entry.o" i get:
ld: cannot perform PE operations ons non PE output file 'a.exe'.
Attachments
Aufzeichnen.PNG
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: Problem with the gnu linker (ld.exe)

Post by JamesM »

Hi,

The problem is with kernel.o. Post the results of:

Code: Select all

gcc -v
Also, try recompiling kernel.o. It's been compiled with the cygwin standard compiler, not the crosscompiler.
alphabetagamma
Posts: 15
Joined: Mon Dec 01, 2008 3:13 pm

Re: Problem with the gnu linker (ld.exe)

Post by alphabetagamma »

ok then how can i substitute the cygwin gcc for the cross gcc ?
Attachments
Aufzeichnen.PNG
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: Problem with the gnu linker (ld.exe)

Post by JamesM »

did you do the "export PATH=..." command I gave you?
alphabetagamma
Posts: 15
Joined: Mon Dec 01, 2008 3:13 pm

Re: Problem with the gnu linker (ld.exe)

Post by alphabetagamma »

yes but i didnt use "i686-elf-gcc" i think i need that command and not "gcc".

the new cygwin output in addition.
Attachments
Aufzeichnen.PNG
Aufzeichnen.PNG (9.39 KiB) Viewed 3265 times
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: Problem with the gnu linker (ld.exe)

Post by JamesM »

Excellent - in k_entry.asm, change the "call _k_main" to "call k_main", and you should be sorted.
alphabetagamma
Posts: 15
Joined: Mon Dec 01, 2008 3:13 pm

Re: Problem with the gnu linker (ld.exe)

Post by alphabetagamma »

one more error:
i686-elf-ld -T kernel.ld kernel.o k_entry.o

i686-elf-ld: warning: cannot find entry symbol start; defaulting to ff800000


edit: addition: thats what i changed...had to change the fourth line "[extern _k_main]" to "[extern k_main]" otherwise he says "undefined defined symbol k_main" at the call...
Attachments
c-kernel.rar
(1.59 KiB) Downloaded 110 times
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: Problem with the gnu linker (ld.exe)

Post by JamesM »

... and change "_start" to "start"? Come on, surely you could work that out?
alphabetagamma
Posts: 15
Joined: Mon Dec 01, 2008 3:13 pm

Re: Problem with the gnu linker (ld.exe)

Post by alphabetagamma »

i tried all combinations..perhabs the adress ist wrong ?
ff800000 ?
Post Reply