This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: egcs 971008 on Linux/PPC - test results
Richard Henderson writes:
| 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?
Now that I think about it, I think I know what the problem is, and its
been something I meant to fix but it kind of fell off my plate.
Basically the Linux PowerPC stuff creates crt{begin,end}.o from the
System V configs and crt{i,o}.o from the eabi configs. My hunch is to
do Linux the same way I did eabi, and eliminate crt{begin,end}.
--
Michael Meissner, Cygnus Solutions (East Coast)
4th floor, 955 Massachusetts Avenue, Cambridge, MA 02139, USA
meissner@cygnus.com, 617-354-5416 (office), 617-354-7161 (fax)