Combining multiple object files into one at link-time

Chris Johns chrisj at rtems.org
Wed Aug 24 23:17:20 UTC 2016


On 25/08/2016 2:28 AM, Pavel Pisa wrote:
> Other option is to place multiple object to single
> archive
>
>   ar r combined.a obj1.o obj2.o
>
> I think, that it should work in RTEMS elf loader,
> ??? Chris, can you comment, please  ???

Yes this should work. You can load object files from archives using 
'libfoo.a:bar.o' as the file name.

I am considering adding support to search archives on the target to 
complete a link.

An embedded system is typically closed so an archive that contains only 
those objects you need is ideal rather than loading a complete archive 
only part of is used. There is some support in the rtems-ld to create 
target archives from archives used in a link. This become complicated 
when you have a few modules being linked against a common set of libraries.

Chris



More information about the users mailing list