egcs 971008 on Linux/PPC - test results

Richard Henderson rth@cygnus.com
Thu Oct 16 02:35:00 GMT 1997


On Wed, Oct 15, 1997 at 11:55:21PM -0400, Elliot Lee wrote:
> Is there documentation somewhere that details the different purposes of
> these crt* files, so I can narrow things down and find which one might be
> at fault?

crti/n creates the .init & .fini sections that are invoked by ld.so on
startup/shutdown.  crtbegin/end interfaces between the section-is-a-
function mechanism used by crti/n to the table-of-function-pointers
initialization preferred by g++ for running its constructors.

So .init invokes __do_global_ctors_aux, which calls the c++ constructors.

> I tried breaking on _start in gdb and single-stepping into
> things, but gdb merrily goes on by :(

Try "b *_start+4".  I've had more luck with the second insn in the past,
for whatever reasons.

> 0x182ee70 <__do_global_ctors_aux+72>:   lwz     r29,0(r9)
> 0x182ee74 <__do_global_ctors_aux+76>:   mtlr    r29
> 0x182ee78 <__do_global_ctors_aux+80>:   blrl

This is "r29 = *r9; (*r29)();".  So either the table of constructors is
garbage, or you managed to get a pointer to something else.  Find out what
symbol lives near r9.

Unlike the Alpha, which has constraints the hackery in crtstuff completely
breaks, I wasn't aware of anything that ppc would care about in there. 
But obviously something has gone wrong.  What differences do you see with
objdump -dr between the two versions of crtbegin/end?


r~



More information about the Gcc mailing list