JD jd1008 at
Sun May 1 18:08:58 UTC 2011

On 05/01/11 10:51, Tom Horsley wrote:
> On Sun, 1 May 2011 18:47:14 +0100 (BST)
> Patrick Dupre wrote:
>> I wish to link several .o files to make only one .o file not executable
>> (it will relinked later). I would like to first make a prelinked file easier to then link
>> them to the excutable file (ie. with a main).
> ld -r can do that, but are you sure you don't just want to
> stick all the .o files in an archive with ar and link with
> that static library later?
Well, I actually have seen this in several makefiles
where several .o's are linked into a single big .o
This is useful when you are building, say, a kernel
module. For example:

crypto-rsl.o: arc4.o api.o autoload.o cipher.o compress.o digest.o 
scatterwalk.o proc.o
         $(LD) -r $^ -o $@

Also, vmlinux itself is created in this way.

More information about the users mailing list