wrong with linker ld...

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
xyjamepa
Member
Member
Posts: 397
Joined: Fri Sep 29, 2006 8:59 am

wrong with linker ld...

Post by xyjamepa »

hi guys...
i tried to add another file to my kernel normally but
i got this message:

Code: Select all

the system cannot execute the specified program.
by adding a file i mean compiling it and then linking it with the rest
of my kernel
so my problem means i cannot add any new C files to my kernel.
i'm using DJGPP under windows xp.
did any body have this problem befor?what can i do?
Thanx

Code: Select all

C:\DJGPP\bin\ld -T link.ld -o kernel.bin start.o main.o video.o string.o gdt.o idt.o isrs.o irq.o  keyboard.o  stack.o phmanager.o paging.o s.o
when adding s.o it gives me that message.
Thomac
Posts: 11
Joined: Sat Sep 16, 2006 2:23 am

Post by Thomac »

That's an annoying problem with a rather simple solution.
The command line has to be shorter than 255 characters IIRC, so if you rename phmanager.o to phman.o you should be able to get it to work. :wink:
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Post by AJ »

The solution I use for this is to manually include my entry point first (in my case, kernel.o) and then use the abbreviation *.o in order to link the other files.

As my entry point file (in ASM) is assembled to a different sub-directory, this seems to work quite well, and all I have to do is compile another object file and it will automatically be linked.

Adam
User avatar
xyjamepa
Member
Member
Posts: 397
Joined: Fri Sep 29, 2006 8:59 am

Post by xyjamepa »

thank you guys that was helpful
it is working now :D using your advice Thomac.
is there any way to link the files using many lines?
i mean not using only one line...
this problem may happen in the comming future,don't you think so?
Thanx.
User avatar
ces_mohab
Member
Member
Posts: 77
Joined: Wed Oct 18, 2006 3:08 am

Post by ces_mohab »

abuashraf wrote: is there any way to link the files using many lines?
i mean not using only one line...
this problem may happen in the comming future,don't you think so?
Thanx.
do you use GNU make?

Code: Select all

ld -T link.ld -o kernel.bin start.o main.o video.o string.o gdt.o idt.o isrs.o  \
irq.o  keyboard.o  stack.o phmanager.o paging.o s.o
this works in command line also if you use batch files.
To write an OS you need 2 minds one for coding and other for debugging.
User avatar
xyjamepa
Member
Member
Posts: 397
Joined: Fri Sep 29, 2006 8:59 am

Post by xyjamepa »

I'm not using the GNU make i'm using a batch file.
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:

Post by Combuster »

If you are constantly limited by command line length, you can try linking incrementally:

ld -i input1.o -o accumulator.o
ld -i accumulator.o input2.o -o accumulator.o
ld -i accumulator.o input3.o -o accumulator.o
...
ld <funky parameters> accumulator.o -o kernel
"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 ]
Post Reply