global contructors

Chris Johns chrisj at rtems.org
Thu Aug 24 00:28:20 UTC 2006


Philippe Simons wrote:
> I'm close to get global construcors working on ARM.
> my .init/.fini and .ctors/.dtors sections are build correctly
> I made some test to force the call to _init() in the Init task, and it
> seems to works.
> 
> but where should i define the __USE_INIT_FINI__ to let _Thread_Handler
> call _init()?
> i tried to add it in the bsp_specs using: %(old_cpp) %{qrtems:
> -D__USE_INIT_FINI__ }
> but it doesnt seems to change anything to _Thread_Handler
> 
> any tips on this?
> 

You need to build the tools with the correct setup:

[cjohns at moa rtemsrpms]$ which i386-rtems4.7-gcc
/opt/rtems-4.7/bin/i386-rtems4.7-gcc
[cjohns at moa rtemsrpms]$ i386-rtems4.7-gcc -dM -E - </dev/null | grep 
__USE_INIT_FINI__
#define __USE_INIT_FINI__ 1
[cjohns at moa rtemsrpms]$ arm-rtems4.7-gcc -dM -E - </dev/null | grep 
__USE_INIT_FINI__

Looking at the source for the rtems-4.7 tool set:

[chrisjohns at england config]$ pwd
/home/chrisjohns/rtems/4.7/packages/BUILD/custom-arm-rtems4.7-gcc-4.1.1/gcc-4.1.1/gcc/config
[chrisjohns at england config]$ grep -r __USE_INIT_FINI__ arm
[chrisjohns at england config]$ grep -r __USE_INIT_FINI__ m68k
m68k/rtemself.h:        builtin_define ("__USE_INIT_FINI__");   \

I did notice the arm does have __USES_INITFINI__ defined but this is 
only target in gcc to have this.

Should the arm have __USE_INIT_FINI__ defined or should RTEMS handle 
__USES_INITFINI__ or is it safe to assume __ELF__ means __USE_INIT_FINI__ ?

Regards
Chris



More information about the users mailing list