Dynamic Libraries
Joel Sherrill
joel.sherrill at oarcorp.com
Thu Sep 14 14:25:48 UTC 2006
Marek Prochazka wrote:
> Please, anyone having a hint how to deal with the problem described
> below? Or should I consider the issue being hard to solve in an easy way
> and hence Cexp not being able to use on sparc-rtems? Sorry but I have to
> keep pushing as I have to decide reasonably quickly whether I can use
> Cexp for my project or not.
>
>
AFAIK this is an ld issue not specifically Cexp. I saw this message about
this error message on an old thread on the binutils list (typed in so I
hope
the URL is right):
http://sourceware.org/ml/binutils/2003-04/msg00540.html
Maybe you can tell from that discussion what is going on with this linker
script. I don't think this is as much SPARC specific as an odd side-effect
of your test case and linker script.
--joel
> Thanks.
>
> Best regards,
> Marek Prochazka
>
>
>> -----Original Message-----
>> From: Marek Prochazka [mailto:Marek.Prochazka at scisys.co.uk]
>> Sent: 12 September 2006 17:18
>> To: Till Straumann
>> Cc: rtems-users at rtems.com
>> Subject: RE: Dynamic Libraries
>>
>> Hi,
>>
>> I have successfully linked a Cexp "loader" application on
>> Linux and was
>> able to load modules at runtime. Quite good stuff!
>>
>> When I am trying to do the same for sparc-rtems target, I get the
>> following message when linking:
>>
>> /opt/rtems-4.6/lib/gcc-lib/sparc-rtems/3.2.3/../../../../sparc
>> -rtems/bin
>> /ld: ADDR forward reference of section .text
>>
>> My link_helper file looks like this:
>>
>> __cexp__dummy_alias_0 = ADDR( .text ) ;
>> __cexp__dummy_alias_1 = ADDR( .data ) ;
>> __cexp__dummy_alias_2 = ADDR( .bss ) ;
>> __cexp__dummy_alias_3 = ADDR( .jcr ) ;
>>
>> Corresponding part of mysymbtab.c is
>>
>> static CexpSymRec systemSymbols[] = {
>> {
>> .name =".text",
>> .value.ptv =(void*)&__cexp__dummy_alias_0,
>> .value.type =TVoid,
>> .size =0,
>> .flags =0|CEXP_SYMFLG_SECT,
>> },
>> {
>> .name =".data",
>> .value.ptv =(void*)&__cexp__dummy_alias_1,
>> .value.type =TVoid,
>> .size =0,
>> .flags =0|CEXP_SYMFLG_SECT,
>> },
>> {
>> .name =".bss",
>> .value.ptv =(void*)&__cexp__dummy_alias_2,
>> .value.type =TVoid,
>> .size =0,
>> .flags =0|CEXP_SYMFLG_SECT,
>> },
>> {
>> .name =".jcr",
>> .value.ptv =(void*)&__cexp__dummy_alias_3,
>> .value.type =TVoid,
>> .size =0,
>> .flags =0|CEXP_SYMFLG_SECT,
>> },
>> ...
>>
>> I have built libcexp for sparc-rtems and xsyms on Linux for
>> sparc-rtems
>> target. When I tried to build xsyms on top of libelf (--disable-bfd
>> --disable-cexp) then the mysymtab.c file generated by xsyms
>> is actually
>> a binary file - so I do not know how use it.
>>
>> Any hints related to this?
>>
>> Many thanks,
>> Marek
>>
>>
>>
>>> -----Original Message-----
>>> From: Marek Prochazka [mailto:Marek.Prochazka at scisys.co.uk]
>>> Sent: 12 September 2006 09:28
>>> To: Till Straumann
>>> Cc: rtems-users at rtems.com
>>> Subject: RE: Dynamic Libraries
>>>
>>> Hi,
>>>
>>> thanks, this helped me to link it! BTW my version of the
>>>
>> README file,
>>
>>> which comes from Cexp 1.5 sources downloaded from the Cexp
>>>
>> home page,
>>
>>> does not mention the trick with "> link_helper" in points 2) and 4).
>>>
>>> Regards,
>>> Marek
>>>
>>>
>>>> Allan is correct. RTMF (see step 4), please [from the README]:
>>>>
>>>> > 1) compile and link all sources, libraries etc.; build an
>>>> executable
>>>> > 2) xsyms -C executable mysymtab.c > link_helper
>>>> > 3) compile mysymtab.c (set -I to Cexp source directory, since
>>>> > cexpsyms.h is included)
>>>> > 4) link application again, but this time add
>>>>
>> 'mysymtab.c' to the
>>
>>>> > list of sources and 'link_helper' to the list of files to
>>>> > be linked.
>>>> > NOTE: Step 1) linking succeeds without a symtab.o
>>>>
>>> because there's
>>>
>>>> > a weak NULL-ptr alias for the builtin symtab.
>>>>
>>>> HTH
>>>> -- Till
>>>>
>>>>
>>>
>>
>
>
More information about the users
mailing list