ld refusing to link after so many files?
ld refusing to link after so many files?
It's like refusing to link says "System cannot execute the specified program"
About 15 object files.
About 15 object files.
Re:ld refusing to link after so many files?
There is a maximum length on the command line, you can't get more than 255 characters I think it is. I think normal Windows command line programs support the normal 32766 characters but if you're using DJGPP or a batch file than it may not work.
You may want to try a makefile instead of a batch (DJGPP also supposedly has a hack around to support longer command lines in DOS if you use DJGPP make).
(I've had to make broad assumptions here, your post is not very descriptive since you could be using Linux, BSD, Mac or Windows, you also didn't give an example making it rather vague)
You may want to try a makefile instead of a batch (DJGPP also supposedly has a hack around to support longer command lines in DOS if you use DJGPP make).
(I've had to make broad assumptions here, your post is not very descriptive since you could be using Linux, BSD, Mac or Windows, you also didn't give an example making it rather vague)
Re:ld refusing to link after so many files?
I'm sorry, I'm using the Windows Platform. I'll look into a makefile thanks.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:ld refusing to link after so many files?
you may want to use cygwin shell & binutils too. Since they're native windows programs instead of DOS+DPMI, they're likely to have better support for large command line, many many open files at a time, etc.
Re:ld refusing to link after so many files?
It is also common practice to combine several object files into a link archive (using GNU 'ar', part of the binutils package), and linking that using ld's "-l" option.
Every good solution is obvious once you've found it.
Re:ld refusing to link after so many files?
Well, I think you guys are making this a bit too hard. After creating all my object files(such as kmain.o, ioport.o) in the same directory, I do this:
ld -T link.ld -o bootstrap.bin boot2.bto *.o
bootstrap.bin is, of course, my bootsector.
boot2.bto is the A.out file which I use to jump to my kernel
*.o just specifies all the .o files found in the folder.
Brett
P.S. I've gotten more than 15 files on this. I think I'm currently using something like 20... maybe... can't remember...
ld -T link.ld -o bootstrap.bin boot2.bto *.o
bootstrap.bin is, of course, my bootsector.
boot2.bto is the A.out file which I use to jump to my kernel
*.o just specifies all the .o files found in the folder.
Brett
P.S. I've gotten more than 15 files on this. I think I'm currently using something like 20... maybe... can't remember...
Re:ld refusing to link after so many files?
I am aware of that solution (I used it myself for a while) but a makefile is a much better long term solution since it does conditional compilation where it doesn't rebuild things that don't need need rebuilding.
Re:ld refusing to link after so many files?
Wow, thanks for the wildcard linking! I'll definately look into a makefile as well.
Re:ld refusing to link after so many files?
Note that, AFAIK, wildcards are expanded by the shell before being passed to the executable. You are likely to run into the next wall once you exceed the command length limit of 'ld'.
'ar' archives, as well as Makefiles, speed up your build cycle.
'ar' archives, as well as Makefiles, speed up your build cycle.
Every good solution is obvious once you've found it.
-
- Member
- Posts: 1600
- Joined: Wed Oct 18, 2006 11:59 am
- Location: Vienna/Austria
- Contact:
Re:ld refusing to link after so many files?
makefile & ar are definitely the way to go.
just recently I've converted my project from using a custom build script - which became a hell to maintain - to using Makefiles, and look, the build process is much cleaner now.
Further, for my 30+-entries runtime library, ar is the tool of choice, definitely. LD picks the object files it needs out of it.
stay safe.
just recently I've converted my project from using a custom build script - which became a hell to maintain - to using Makefiles, and look, the build process is much cleaner now.
Further, for my 30+-entries runtime library, ar is the tool of choice, definitely. LD picks the object files it needs out of it.
stay safe.
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
BlueillusionOS iso image