_init magic for c++ (on sparc64)

Gedare Bloom gedare at gwmail.gwu.edu
Mon Nov 29 20:55:47 CST 2010


Hi,

I'm trying to get C++ support working properly on the sparc64 target
with usiii BSP. I'm having a little trouble figuring out how to make
things work, and am hoping some general pointers might be floating out
there for me to try.

In particular, previously I stitched in a worthless _init declaration
in the BSPs' start.S file in order to get applications to compile, but
this is not the "correct" way of getting the _init symbol.  I've read
through http://www.rtems.com/wiki/index.php/Using_C_Plus_Plus which
has been helpful, but I seem to be missing something in implementing
the proper magic between bsp_specs, linkcmds, and other
autotools-magic.

The usiii bsp_specs doesn't include crti.o/crtn.o like some other
bsps, so perhaps that is an issue? I tried adding those to bsp_specs,
but the libs aren't built/installed from the RPM, so I guess they
probably aren't needed/generated by gcc...

Using the CVS head and sparc64-rtems4.11 tools from RPM, after I
comment out the definitions of _init and _fini at the end of the
libbsp/sparc64/shared/start.S file, I get the following error while
linking hello world while building the usiii BSP:

Making all in hello
gmake[5]: Entering directory
`/home/gedare/work/simics/gems/gems-2.1.1-sparc64/simics_3_workspace/build-sparc64/b-usiiicvs/sparc64-rtems4.11/c/usiii/testsuites/samples/hello'
sparc64-rtems4.11-gcc -B../../../../../usiii/lib/ -specs bsp_specs
-qrtems -mcpu=ultrasparc3 -DUS3 -DSUN4U -gstabs -Wall
-Wimplicit-function-declaration -Wstrict-prototypes -Wnested-externs
 -mcpu=ultrasparc3 -DUS3 -DSUN4U   -o hello.exe init.o
../../../../../usiii/lib/no-barrier.rel
../../../../../usiii/lib/no-dpmem.rel
../../../../../usiii/lib/no-event.rel
../../../../../usiii/lib/no-msg.rel ../../../../../usiii/lib/no-mp.rel
../../../../../usiii/lib/no-part.rel
../../../../../usiii/lib/no-region.rel
../../../../../usiii/lib/no-signal.rel
../../../../../usiii/lib/no-timer.rel
../../../../../usiii/lib/no-rtmon.rel
../../../../../usiii/lib/no-ext.rel
../../../../../usiii/lib/librtemscpu.a(libscore_a-threadhandler.o): In
function `_Thread_Handler':
../../../../../../rtems/c/src/../../cpukit/score/src/threadhandler.c:148:
undefined reference to `_init'
/opt/rtems-4.11/lib/gcc/sparc64-rtems4.11/4.5.1/../../../../sparc64-rtems4.11/lib/libc.a(lib_a-init.o):
In function `__libc_init_array':
/builddir/build/BUILD/rtems-4.11-sparc64-rtems4.11-gcc-4.5.1/build/sparc64-rtems4.11/newlib/libc/misc/../../../../../gcc-4.5.1/newlib/libc/misc/init.c:40:
undefined reference to `_init'
collect2: ld returned 1 exit status
gmake[5]: *** [hello.exe] Error 1

I'm just not quite sure how to proceed in trying to fix this, and
thought someone out there might have some insight on this kind of
problem.
-Gedare



More information about the rtems-users mailing list