Page 1 of 1

wrong with linker ld...

Posted: Mon Nov 06, 2006 6:53 pm
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.

Posted: Mon Nov 06, 2006 7:08 pm
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:

Posted: Tue Nov 07, 2006 4:41 am
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

Posted: Wed Nov 08, 2006 2:15 pm
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.

Posted: Wed Nov 08, 2006 2:22 pm
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.

Posted: Wed Nov 08, 2006 2:47 pm
by xyjamepa
I'm not using the GNU make i'm using a batch file.

Posted: Wed Nov 08, 2006 4:44 pm
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