RTEMS C++ global constructor for Sparc

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Mar 27 09:46:54 UTC 2014


In your linker map file is this:

  *crtbegin.o(.ctors)
  .ctors         0x020603f0        0x4 
/opt/rtems-4.11/lib/gcc/sparc-rtems4.11/4.8.2/crtbegin.o
  *crtbegin?.o(.ctors)
  *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
  .ctors         0x020603f4        0x4 o-optimize/init.o
  .ctors         0x020603f8        0x4 
/opt/rtems-4.11/lib/gcc/sparc-rtems4.11/4.8.2/libstdc++.a(eh_globals.o)
  .ctors         0x020603fc        0x4 
/opt/rtems-4.11/lib/gcc/sparc-rtems4.11/4.8.2/libstdc++.a(eh_alloc.o)
  .ctors         0x02060400        0x4 
/opt/rtems-4.11/lib/gcc/sparc-rtems4.11/4.8.2/libstdc++.a(wlocale-inst.o)
  .ctors         0x02060404        0x4 
/opt/rtems-4.11/lib/gcc/sparc-rtems4.11/4.8.2/libstdc++.a(locale-inst.o)
  .ctors         0x02060408        0x4 
/opt/rtems-4.11/lib/gcc/sparc-rtems4.11/4.8.2/libstdc++.a(system_error.o)
  *(SORT(.ctors.*))
                 0x0206040c                __CTOR_LIST__ = .
  *(.ctors)
  .ctors         0x0206040c        0x4 
/opt/rtems-4.11/lib/gcc/sparc-rtems4.11/4.8.2/crtend.o
                 0x02060410                __CTOR_END__ = .

I don't know why the constructor entries are before the __CTOR_LIST__.

On my machine this looks like:

  *crtbegin.o(.ctors)
  .ctors         0x0000000002058b10        0x4 
/opt/rtems-4.11/lib64/gcc/sparc-rtems4.11/4.8.3/crtbegin.o
  *crtbegin?.o(.ctors)
  *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
  .ctors         0x0000000002058b14        0x4 main.o
  .ctors         0x0000000002058b18        0x4 
/opt/rtems-4.11/lib64/gcc/sparc-rtems4.11/4.8.3/libstdc++.a(eh_alloc.o)
  .ctors         0x0000000002058b1c        0x4 
/opt/rtems-4.11/lib64/gcc/sparc-rtems4.11/4.8.3/libstdc++.a(eh_globals.o)
  *(SORT(.ctors.*))
  *(.ctors)
  .ctors         0x0000000002058b20        0x4 
/opt/rtems-4.11/lib64/gcc/sparc-rtems4.11/4.8.3/crtend.o

On 2014-03-27 06:28, Thomas (Gmail) wrote:
> I am using RTEMS for university research purpose.
> I am tring to integrate our C++ applications with RTEMS posix model.
> also, I am using Sparc simulator because I don't have real target at this time.
>
> When I check _Thread_Handler() of cpukit/score/src/threadhandler.c regarding
> C++ global constructor, _init() is called for sparc.
> When I check _init() object dump file, there is not any implementation code for
> C++ global constructor as like below;
> ------------------------------------------------------------
> Disassembly of section .init:
>
> 00000000 <_init>:
>     0:9d e3 bf a0 save  %sp, -96, %sp
>
> Disassembly of section .fini:
>
> 00000000 <_fini>:
>     0:9d e3 bf a0 save  %sp, -96, %sp
> ------------------------------------------------------------
>
> I am tring to find how to call C++ global constructor for sparc. I found
> something in http://gcc.gnu.org/onlinedocs/gccint/Initialization.html
>
> I am tring to add libgcc.a in linking process for calling __do_global_ctors().
>
> Please could you let me know how to add libgcc.a in RTEMS building environment ?
>
> If this approach is not correct, please let me know correct how-to-do for C++
> global constructor for Sparc.
>
> Best Regards,
> Thomas
>
>
>
>
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.org
> http://www.rtems.org/mailman/listinfo/rtems-users
>


-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the users mailing list