initialization of sdata on ppc & c++ code

Kumar Gala kumar.gala@freescale.com
Thu Feb 24 15:30:00 GMT 2005


We have run into an issue recently in that the sdata pointer (r13) on  
ppc is not initialization in time for use in some early c++ code.

Here is a back trace from GDB showing the failure:

#0  0x10009cbc in strlen ()
#1  0x0fd0e72c in getenv () from /lib/libc.so.6
#2  0x0ff4e708 in  
_GLOBAL__I_.._.._.._.._.._gcc_3.4.3_libstdc___v3_src_allocator_inst.cc_9 
D2164D3_EA394990 () at mt_allocator.h:163
#3  0x0ffb8ecc in __do_global_ctors_aux () from /root/libstdc++.so.6
#4  0x0ff3b79c in _init () from /root/libstdc++.so.6
#5  0x3000bb54 in _dl_init () from /lib/ld.so.1
#6  0x3000f138 in realloc () from /lib/ld.so.1

We have a custom strlen that uses sdata that is crashing because r13 is  
not setup correctly.  I'm wondering if this is expected behavior  
because _setup has yet to be called and that it is not feasible for  
'standard' libc functions to depend on sdata or is this an issue that  
can be resolved (some how moving sdata init earlier).  The very early  
initialization is a bit of black magic to me :)

We are using gcc-3.4.3 and glibc-2.3.1.

thanks

- kumar



More information about the Libc-alpha mailing list