I have a (possibly) rather stupid question about linker scripts. I was wondering if there was a way to use wildcards in input files. Suppose I have a directory with 2 object files 'main.o' and 'print.o', is there anyway I could do something like:
or something similar? It's really a pain to add an object file each time I create a new source file. So I figured there had to be some way of doing it.
Thanks,
Creature
When the chance of succeeding is 99%, there is still a 50% chance of that success happening.
Otherwise, there's still the shell thing, like:
cat link.ld.in > link.ld
find blabla | grep lala | sed hobo >> link.ld
"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 ]
(stab at the darkness) djgpp, 255 char command line
Before I forget, did you look at the Makefile tutorial, so to not miss out on the obvious?
"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 ]
Solar wrote:The behaviour is not documented in the LD manual, so I wouldn't rely on it even if it works...
Which begs the question, why would you want to include both files in the linker script, instead of the LD command line?
I was giving an example, I don't really have 2 object files in my linker script, there are many more and it's a pain to add them to the command line either way. I'm amazed that they didn't implement something automated into the linker script.
I guess I could do what Shrek proposed, but no thanks for the application, I can write it myself .
Thanks for your help .
When the chance of succeeding is 99%, there is still a 50% chance of that success happening.
Hi,
I was just recommending a quick fix , so that the 'process' is not getting affected . I would advise you to meditate further on the questions of other posters as well .
Creature wrote:I was giving an example, I don't really have 2 object files in my linker script, there are many more and it's a pain to add them to the command line either way. I'm amazed that they didn't implement something automated into the linker script.
Because this is the classic scenario for a Makefile using "find" to get the list of source (and object) files... try the Makefile tutorial in the Wiki for a guide on how to do that.
I guess I could do what Shrek proposed, but no thanks for the application, I can write it myself .
Toying with the linker script is the wrong solution for this (very valid) problem, IMHO.
Every good solution is obvious once you've found it.
Well I had more of an idea to use the linker script without the input files and write some kind of application that grabs all the object files in the specified directory and adds them to the 'ld' command line one by one. Though tedious and possibly slow, it still does the trick. I was trying to stay away from makefiles (as I don't really know a lot about them). Guess it's time to see how they work too, had to happen someday .
When the chance of succeeding is 99%, there is still a 50% chance of that success happening.