Pass multiple same options to rtems_linkflags

Peng Fan van.freenix at gmail.com
Sun Jul 27 14:00:09 UTC 2014


Hi,


2014-07-26 9:28 GMT+08:00 Chris Johns <chrisj at rtems.org>:

> On 26/07/2014 12:25 am, Peng Fan wrote:
>
>> Hi Chris,
>>
>> I build a rap file using such a command :
>> rtems-ld --lib-path
>> /opt/rtems-4.11/arm-rtems4.11/realview_pbx_a9_qemu/lib --lib m --lib
>> rtemscpu --lib rtemsbsp --base rtld.prelink --entry  rtems a.o b.o c.o
>> *.o ...
>> Is this ok? can reference a symbol in librtemscpu.a librtemsbsp.a? or
>> the reference symbol from librtemscpu.a librtemsbsp.a should be included
>> in the base image but not in the rap file?
>>
>
> This is fine. You do not need to load a base image with everything you
> might need.
>
> If you create another RAP file and do the same thing and that RAP pulls
> the same code in from one of those libraries it will not be linked to.
> Rather the first instance of the code loaded is used. The downside is a
> possible waste of code.
>
Yeah.Other RAP file which references the same code that already in the
first rap should not pull the same code into the final image.

>
> I suppose we could add code to compact the memory and not loaded the
> object file and so the overhead is limited to the RAP file.

Sorry. I can not got this. what code should be added to rtl-host?

>
>
>
>> I set rtems_linkflags like this:
>>          rtems_linkflags = ['--base', 'rtld.prelink',
>>                             '--lib-path',
>> '/opt/rtems-4.11/arm-rtems4.11/realview_pbx_a9_qemu/lib',
>>                             '--entry', 'my_main', '--lib', 'm', '--lib',
>> 'rtemscpu' , '--lib', 'rtemsbsp'],
>> But waf only uses one '--lib', it removes the other two '--lib', like
>> this: xxx '--entry', 'my_main', '--lib', 'm', 'rtemscpu', 'rtemsbsp',xxx
>> I am not familar with waf, any advice about his?
>>
>
> Try using LIBS and adding to that. Getting the order correct can be tricky.

To bld whose feature is 'c program', libs = ['m', 'xxx'] works. But to 'c
rap' which is defined in RTL, adding libs to bld of waf does not work. So I
wrote a patch to fix this, the patch first clear the RTEMS_LINKFLAGS env,
then refill it. The patch is in the attachments.

Regards,
Peng.


>
> Chris
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20140727/6fa1c2bd/attachment-0001.html>


More information about the devel mailing list