Dynamic Libraries

Marek Prochazka Marek.Prochazka at scisys.co.uk
Mon Sep 18 09:18:42 UTC 2006


Till,

This fixed the problem and it works O.K. now!

I very much appreciate your help!

Best regards,
Marek

> -----Original Message-----
> From: Till Straumann [mailto:strauman at slac.stanford.edu] 
> Sent: 14 September 2006 22:53
> To: RTEMS Users Mailing List
> Subject: Re: Dynamic Libraries
> 
> Marek.
> 
> Regardless of a possible fix to your linker script -- here is 
> a workaround:
> 
> Symbols for the sections are not really needed and you can 
> simply delete
> them from the generated 'symbolfile.c' and not use the linker 
> script at all
> (or just delete the offending ones).
> 
> To make life easier, I added a new [-s] option to xsyms which you have
> to enable in order to produce entries for the section symbols 
> in the table.
> I.e., if you don't use -s you should be OK.
> 
> HTH
> -- 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.
> >>     
> >
> > /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/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_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/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 -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/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
> >
> > link_helper:
> > __cexp__dummy_alias_0 = ADDR( .text ) ;
> > __cexp__dummy_alias_1 = ADDR( .data ) ;
> > __cexp__dummy_alias_2 = ADDR( .bss ) ;
> > __cexp__dummy_alias_3 = ADDR( .jcr ) ;
> >
> > 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
> >>>>>>
> >>>>>>         
> >>>>>>             
> >>>>>       
> >>>>>           
> >>>>     
> >>>>         
> >>>   
> >>>       
> >>     
> >
> >   
> 
> 
> 




More information about the users mailing list