_init magic for c++ (on sparc64)

Gedare Bloom gedare at gwmail.gwu.edu
Tue Nov 30 02:55:47 UTC 2010


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

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
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-msg.rel ../../../../../usiii/lib/no-mp.rel
../../../../../usiii/lib/librtemscpu.a(libscore_a-threadhandler.o): In
function `_Thread_Handler':
undefined reference to `_init'
In function `__libc_init_array':
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

More information about the users mailing list