problems with relocatable object files

Kate Feng feng1 at bnl.gov
Tue Dec 9 14:25:08 UTC 2008


Till Straumann wrote:
> When you link your relocatable file (simplified) with
>
> gcc -r $(OBJECTS) -o myrel.o
>
> then gcc will implicitly link startfiles and 'default' libraries such as 
> libc etc.
>
> Hope you didn't forget to add -nostdlib, i.e.,
>
> gcc -nostdlib -r $(OBJECTS) -o myrel.o
>   
-nostdlib will bypass libgcc.a too. Usually, one needs to use
the libgcc.a even when one needs to avoid the standard libraries.
Thus, you might need to add -lgcc as well.

Cheers,
Kate||
> HTH
> -- Till
>
> rtwas wrote:
>   
>> Hello,
>>
>> I'm trying to move my build tree to the *rtems* was of doing things. Our 
>> project is rather large so
>> we link using "-r" for later linking into the final executable. It 
>> (relocatable object) compiles and links ok but when I try
>> to use it in the final linking I get weird errors like:
>>
>> rpc/gimbalnop/server/o-optimize/TtRpcNopCmdSvr.o: In function `MMUon':
>> /usr/local/packages/rtos/rtems/4.9/4.9.0/rtems-4.9.0-mvme5500-build.110708.00/powerpc-rtems4.9/c/mvme5500/lib/libbsp/powerpc/mvme5500/../../../../../../../../rtems-4.9.0/c/src/lib/libbsp/powerpc/mvme5500/start/start.S:139: 
>> multiple definition of `MMUon'
>> /opt/rtems-4.9/powerpc-rtems4.9/mvme5500/lib/mvme5500start.o:/usr/local/packages/rtos/rtems/4.9/4.9.0/rtems-4.9.0-mvme5500-build.110708.00/powerpc-rtems4.9/c/mvme5500/lib/libbsp/powerpc/mvme5500/../../../../../../../../rtems-4.9.0/c/src/lib/libbsp/powerpc/mvme5500/start/start.S:139: 
>> first defined here
>> rpc/gimbalnop/server/o-optimize/TtRpcNopCmdSvr.o:(.data+0x0): multiple 
>> definition of `__dso_handle'
>> /opt/rtems-4.9/lib/gcc/powerpc-rtems4.9/4.3.2/m7400/crtbegin.o:(.data+0x0): 
>> first defined here
>> rpc/gimbalnop/server/o-optimize/TtRpcNopCmdSvr.o:(.got2+0x0): multiple 
>> definition of `__GOT2_START__'
>> /opt/rtems-4.9/lib/gcc/powerpc-rtems4.9/4.3.2/m7400/ecrti.o:/builddir/build/BUILD/rtems-4.9-powerpc-rtems4.9-gcc-4.3.2/build/gcc/ecrti.S:115: 
>> first defined here
>> .
>> .
>> . etc.
>>
>>
>> This Makefile I'm using is based on a *working* Makefile that builds 
>> under linux.
>>
>>
>> After some mods to the original linux Makefile I have something like this:
>> .
>> .
>> .
>> CSRCS = ${CFILES}
>> COBJS_ = $(CSRCS:.c=.o)
>> COBJS = $(COBJS_:%=${ARCH}/%)
>>
>>
>> include $(RTEMS_MAKEFILE_PATH)/Makefile.inc
>> include $(RTEMS_CUSTOM)
>> include $(PROJECT_ROOT)/make/leaf.cfg
>>
>> CPPFLAGS += -I../../.. -I../../../include
>>
>>
>>
>> TARGET = TtRpcNopCmdSvr
>>
>> all: ${TARGET}.o
>>
>>
>> %.o: %.c
>>         ${COMPILE.c}  ${CPPFLAGS}  $< 
>>
>> ${TARGET}.o: ${COBJS_}
>>         ${LINK.c} -o ${ARCH}/${TARGET}.o -r ${COBJS_}
>> .
>> .
>> .
>>
>>
>> Help appreciated.
>>
>> Thanks,
>>
>> Robert W.
>> _______________________________________________
>> rtems-users mailing list
>> rtems-users at rtems.com
>> http://rtems.rtems.org/mailman/listinfo/rtems-users
>>   
>>     
>
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.com
> http://rtems.rtems.org/mailman/listinfo/rtems-users
>   




More information about the users mailing list