Page 1 of 2
ld in Windows Xp
Posted: Mon Mar 19, 2007 11:26 am
by salil_bhagurkar
I link about 30 files of my os together to form an image. But when the total number of files linked exceeds about 9-10 make gives me an error:
process_begin: CreateProcess(D:\DJGPP\bin\ld.exe, ld -T src/link.ld -o image entry.o mm.o sched.o..........(about 30 files)....smp.o cpu.o) failed.
make (e=87): The parameter is incorrect.
make ***[image] Error 87
Posted: Mon Mar 19, 2007 11:31 am
by Solar
Yep...
For one, some part of the DJGPP environment has a restriction on command line length. I don't know whether it's the DOS box or the tools themselves or whatever, I never used the DJGPP toolchain myself. The usual recommendation is to use Cygwin.
Your specific problem - linker invocations getting terribly long - is best solved by setting up a linker archive. The tool to do this is 'ar'. Check out its manpage.
Posted: Mon Mar 19, 2007 11:53 am
by salil_bhagurkar
Thanks. I will probably get Cygwin and try it out.
But i actually two installations of windows Xp (The other one just has all services disabled and no s/w installations for speed). There are no such problems in the other xp. It links fine with the same ld. So is there any setting in windows for ntvdm that takes care of the commandline depth?
Posted: Mon Mar 19, 2007 12:27 pm
by Brynet-Inc
salil_bhagurkar wrote:Thanks. I will probably get Cygwin and try it out.
But i actually two installations of windows Xp (The other one just has all services disabled and no s/w installations for speed). There are no such problems in the other xp. It links fine with the same ld. So is there any setting in windows for ntvdm that takes care of the commandline depth?
Yes, DJGPP has limited command line arguments apparently.. could be a DOS thing..
You might try specifying the names of your objects in your linker script..
Code: Select all
INPUT(file.o, file.o, …) or INPUT(file.o file.o …)
Like Solar said, You can use "ar".. It's very helpful.. you could make libkern.a which is essentially just an archive containing all of your .o objects.
Code: Select all
ar vcrs libkern.a object1.o object2.o ... 30 files hehe..
Then you would link like:
Code: Select all
ld -T src/link.ld -o image libkern.a
To think about it though.. You would probably have a too long of command line running the ar command also
..
(
You could make multiple archives though..)
Adding the object names into the linker script seems to be the most effective solution in your case, Could also just use MinGW and then setup a Cross-compiler.. (Or Cygwin if you must..)
Here comes my trademark phrase though:
Why not just use BSD or Linux?
Have fun
Posted: Mon Mar 19, 2007 12:35 pm
by salil_bhagurkar
Well, i have a 128Mb ram and all versions of linux seem to creep on my pc... I can manage Xp to run fast... Linux is getting bloated day by day... I just find Xp more familiar and user friendly (
Please excuse me linux lovers)
Posted: Mon Mar 19, 2007 12:38 pm
by Brynet-Inc
salil_bhagurkar wrote:Well, i have a 128Mb ram and all versions of linux seem to creep on my pc... I can manage Xp to run fast... Linux is getting bloated day by day... I just find Xp more familiar and user friendly (
Please excuse me linux lovers)
KDE/Gnome are the resource hogs, That has nothing to do with BSD/Linux's speed..
You could run something like blackbox with as little as 32mb RAM (Less is possible.. unrecommended though..)
EDIT: Removed 2015: Imageshack replaced all links with spam.
Posted: Mon Mar 19, 2007 12:46 pm
by salil_bhagurkar
I guess even Xfce runs fast. So all i have to do is get Bochs, NASM and set up the environment...
I should try it out...
Posted: Mon Mar 19, 2007 12:48 pm
by Brynet-Inc
salil_bhagurkar wrote:I guess even Xfce runs fast. So all i have to do is get Bochs, NASM and set up the environment...
I should try it out...
Great
Emulation is always going to be slower then on bare metal though..
Posted: Mon Mar 19, 2007 12:53 pm
by salil_bhagurkar
I know, I already have Bochs and a nice environment in Windows...
I emulate atleast 50 times a day... with 4-5 real pc boots
Posted: Tue Mar 20, 2007 7:04 am
by AJ
Hi,
With regards to the original problem, I use DJGPP for all my os devving - against the advice of the wiki
.
The problem you have is not so much with number of input files as DOS command line length. This will give the same problem with ar.
I have now started:
a) using a makefile for most of my builds
b) when using a batch file, command line, use wildcards - *.o rather than naming each object individually.
The second approach has the added advantage that you do not need to amend your linker command every time you add another object.
Cheers,
Adam
Posted: Thu Mar 22, 2007 7:36 am
by Solar
Try the [wiki]Tutorial:Makefile[/wiki] for the second problem...
Posted: Thu Mar 22, 2007 8:13 pm
by mystran
Ar is just an archiver, not too much unlike zip or tar.
So you can do this:
Code: Select all
del objects.a
ar rcs objects.a object1.o
ar rs objects.a object2.o
ar rs objects.a object3.o
ld -o binary.exe objects.a
No long command lines no matter how many files you add!
What comes to Linux running fast, basicly ANYTHING except KDE/Gnome will run just fine on 128MB. At least anything that was in freshmeat.net listings a few years ago (it's been a while since I've gone through the list). The only possible other trouble maker is Enlightenment, but I guess 128MB should be enough even for that (though it can burn lots of CPU for eyecandy).
Posted: Thu Mar 22, 2007 8:22 pm
by pcmattman
What I do for my kernel/library is this:
All library files are named *_lib.c, so they get passed to gcc via a wildcard. The same goes for the object files.
All kernel files are name *_main.c.
This basically means that I can seamlessly add new files to the library or my kernel without having to modify batch files. The only place where this becomes inconvenient is when I use folders.
Posted: Tue Mar 27, 2007 7:38 am
by Solar
That still means you recompile all your files if you changed one source file. Not a problem in the beginning, but a real time-waster once things become more complex. That's why make was invented...
Posted: Tue Mar 27, 2007 3:33 pm
by pcmattman
Yes, I know. After numerous attempts Make still didn't work so I pretty much gave up on trying to make it work and work more on my OS.