Dynamic Libraries

Till Straumann strauman at slac.stanford.edu
Thu Sep 14 18:18:52 UTC 2006


Hmm - I guess I don't fully understand your build system.
What 'spec' file does sparc-rtems-gcc use? Where does it come from?
What linker script does sparc-rtems-ld use?

You could let the linker generate a link map and analyze that
- maybe it gives additional hints.

-- Till

Marek Prochazka wrote:
>> I simply didn't get a chance to look at it [don't have any 
>> sparc tools 
>> installed].
>> What BSP are you using - I could give it a try.
>>     
>
> I use this:
>
> BSP NAME:       sis
> BOARD:           any based on the European Space Agency's ERC32
> BUS:                N/A
> CPU FAMILY:    sparc
> CPU:                ERC32 (SPARC V7 + on-CPU peripherals) based on
> Cypress 601/602
> COPROCESSORS:       on-chip 602 compatible FPU
> MODE:               32 bit mode
>
> My target platform is Leon2.
>
>   
>> Also: please send me a full console log of the failing build command.
>>     
>
> Please find the full output attached.
>
> Many thanks,
> Marek
>
>   
>> -- Till
>>
>> 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.
>>>
>>> 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
>>>>>>
>>>>>>         
>>>>>>             
>>>>>       
>>>>>           
>>>>     
>>>>         
>>>   
>>>       
>> ------------------------------------------------------------------------
>>
>> /opt/rtems-4.6/bin/sparc-rtems-gcc  -g -DCDS_DEBUG_VERSION  -Wall -W -ansi -pedantic  -DG_RTEMS_VERSION -DG_LEON_VERSION -DG_SPACEWIRE_VERSION -D_POSIX_C_SOURCE=199506L -msoft-float -qleon2 -I./inc -I/home/marek/work/Global/inc -I/home/marek/work/BSW/inc -I/home/marek/work/SOIS/CMS/inc -I/home/marek/work/SOIS/CMS_Config/inc -I/home/marek/work/SOIS/MMS/inc -I/home/marek/work/SOIS/TAS/inc -I/home/marek/work/SOIS/DAS/inc -I/home/marek/work/SOIS/DAS_Config/inc -I/home/marek/work/DisCo/SOM/RIS/inc -I/home/marek/work/DisCo/SOM/Naming_Service/inc -I/home/marek/work/DisCo/SOM/Naming_Service/IDL -I/home/marek/work/DisCo/SOM/EVS/inc -I/home/marek/work/DisCo/SOM/EVS/idl -I/home/marek/work/DisCo/SOM/CDS/inc -I/home/marek/work/DisCo/SOM/SCS/inc -I/home/marek/work/DisCo/SOM/IFAS/inc -I/home/marek/work/DisCo/SOM/FDIR/inc -I/home/marek/work/DRIVERS/UDP/inc -I/home/marek/work/DRIVERS/LEON_SPW/inc -I/home/marek/work/SOIS/Tools/MA_Emulation/inc -I/home/marek/work/SOIS/Tools/DAS_Device_Emulation/inc -D_MICROORB_NAME_SERVICE -D_MICROORB_TRADING_SERVICE -D_MICROORB_RTCOSSCHEDULING_SERVICE -D_MICROORB_STORECOUNTER  -D_MICROORB_SIOP_PLUGIN -D_MICROORB_POLICIES -D_MICROORB_CORBA_ANY -D_MICROORB_PORTABLESERVER_POA -D_MICROORB_RTCORBA -D_MICROORB_MESSAGING -D_MICROORB_AMI -D_MICROORB_RTCORBA_THREADPOOL_WITH_LANES -I./idl -I../cexp-1.5 Loader.o -L../cexp-1.5/build-rtems -L../cexp-1.5/build-rtems/regexp -L../cexp-1.5/build-rtems/binutils/bfd -L../cexp-1.5/build-rtems/binutils/libiberty -L../cexp-1.5/build-rtems/binutils/opcodes -lcexp -lspencer_regexp -lbfd -liberty -lopcodes -L/home/marek/work/lib -L/home/marek/work/BSW/lib -L/home/marek/work/SOIS/CMS/lib -L/home/marek/work/SOIS/CMS_Config/lib -L/home/marek/work/SOIS/MMS/lib -L/home/marek/work/SOIS/TAS/lib -L/home/marek/work/SOIS/DAS/lib -L/home/marek/work/SOIS/DAS_Config/lib -L/home/marek/work/DisCo/SOM/RIS/lib -L/home/marek/work/DisCo/SOM/Naming_Service/lib -L/home/marek/work/DisCo/SOM/EVS/lib -L/home/marek/work/DisCo/SOM/CDS/lib -L/home/marek/work/DisCo/SOM/SCS/lib -L/home/marek/work/DisCo/SOM/IFAS/lib -L/home/marek/work/DisCo/SOM/FDIR/lib  -L/home/marek/work/DRIVERS/LEON_SPW/lib -lMMS_RTEMS_LEON_debug -lCMS_RTEMS_LEON_debug -lspwCtm -lBSW_RTEMS_debug  -o Loader
>> --------- Generating SYSTEM symbol table
>> ../cexp-1.5/build-host/xsyms -C Loader Symbols.c > link_helper
>> --------- Compiling SYSTEM symbol table
>> /opt/rtems-4.6/bin/sparc-rtems-gcc -c -fomit-frame-pointer -fasm -O -I../cexp-1.5 Symbols.c
>> --------- Linking Loader application - second pass
>> /opt/rtems-4.6/bin/sparc-rtems-gcc  -g -DCDS_DEBUG_VERSION  -Wall -W -ansi -pedantic  -DG_RTEMS_VERSION -DG_LEON_VERSION -DG_SPACEWIRE_VERSION -D_POSIX_C_SOURCE=199506L -msoft-float -qleon2 -I./inc -I/home/marek/work/Global/inc -I/home/marek/work/BSW/inc -I/home/marek/work/SOIS/CMS/inc -I/home/marek/work/SOIS/CMS_Config/inc -I/home/marek/work/SOIS/MMS/inc -I/home/marek/work/SOIS/TAS/inc -I/home/marek/work/SOIS/DAS/inc -I/home/marek/work/SOIS/DAS_Config/inc -I/home/marek/work/DisCo/SOM/RIS/inc -I/home/marek/work/DisCo/SOM/Naming_Service/inc -I/home/marek/work/DisCo/SOM/Naming_Service/IDL -I/home/marek/work/DisCo/SOM/EVS/inc -I/home/marek/work/DisCo/SOM/EVS/idl -I/home/marek/work/DisCo/SOM/CDS/inc -I/home/marek/work/DisCo/SOM/SCS/inc -I/home/marek/work/DisCo/SOM/IFAS/inc -I/home/marek/work/DisCo/SOM/FDIR/inc -I/home/marek/work/DRIVERS/UDP/inc -I/home/marek/work/DRIVERS/LEON_SPW/inc -I/home/marek/work/SOIS/Tools/MA_Emulation/inc -I/home/marek/work/SOIS/Tools/DAS_Device_Emulation/inc -D_MICROORB_NAME_SERVICE -D_MICROORB_TRADING_SERVICE -D_MICROORB_RTCOSSCHEDULING_SERVICE -D_MICROORB_STORECOUNTER  -D_MICROORB_SIOP_PLUGIN -D_MICROORB_POLICIES -D_MICROORB_CORBA_ANY -D_MICROORB_PORTABLESERVER_POA -D_MICROORB_RTCORBA -D_MICROORB_MESSAGING -D_MICROORB_AMI -D_MICROORB_RTCORBA_THREADPOOL_WITH_LANES -I./idl -I../cexp-1.5 Symbols.o Loader.o link_helper -L../cexp-1.5/build-rtems -L../cexp-1.5/build-rtems/regexp -L../cexp-1.5/build-rtems/binutils/bfd -L../cexp-1.5/build-rtems/binutils/libiberty -L../cexp-1.5/build-rtems/binutils/opcodes -lcexp -lspencer_regexp -lbfd -liberty -lopcodes -L/home/marek/work/lib -L/home/marek/work/BSW/lib -L/home/marek/work/SOIS/CMS/lib -L/home/marek/work/SOIS/CMS_Config/lib -L/home/marek/work/SOIS/MMS/lib -L/home/marek/work/SOIS/TAS/lib -L/home/marek/work/SOIS/DAS/lib -L/home/marek/work/SOIS/DAS_Config/lib -L/home/marek/work/DisCo/SOM/RIS/lib -L/home/marek/work/DisCo/SOM/Naming_Service/lib -L/home/marek/work/DisCo/SOM/EVS/lib -L/home/marek/work/DisCo/SOM/CDS/lib -L/home/marek/work/DisCo/SOM/SCS/lib -L/home/marek/work/DisCo/SOM/IFAS/lib -L/home/marek/work/DisCo/SOM/FDIR/lib  -L/home/marek/work/DRIVERS/LEON_SPW/lib -lMMS_RTEMS_LEON_debug -lCMS_RTEMS_LEON_debug -lspwCtm -lBSW_RTEMS_debug  -o Loader
>> /opt/rtems-4.6/lib/gcc-lib/sparc-rtems/3.2.3/../../../../sparc-rtems/bin/ld: ADDR forward reference of section .text
>> collect2: ld returned 1 exit status
>> make: *** [t] Error 1
>>
>>     





More information about the users mailing list