This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
RE: News MIPS option -mno-shared
- From: "Dave Korn" <dave dot korn at artimi dot com>
- To: "'Ian Lance Taylor'" <ian at wasabisystems dot com>,"'David Daney'" <ddaney at avtrex dot com>
- Cc: <binutils at sourceware dot org>
- Date: Fri, 10 Dec 2004 13:43:50 -0000
- Subject: RE: News MIPS option -mno-shared
> -----Original Message-----
> From: binutils-owner On Behalf Of Ian Lance Taylor
> Sent: 09 December 2004 20:32
> To: David Daney
> David Daney writes:
>
> > I have code that generates stack traces that relies on the
> structure of the
> > function prolog to work. It looks for this:
> >
> > /*
> > * Find function prolog. It will have the form:
> > *
> > * 3c1c???? lui gp,????
> > * 279c???? addiu gp,gp,????
> > * 0399e021 addu gp,gp,t9
> > * 27bd#### addiu sp,sp,####
> > *
> > * Where ???? are the offset of the GOT from the function
> > * entrypoint, and #### is the amount added to the
> stack poiner.
> > */
> >
> > Your change will break it.
>
> True, but only if you choose to use -mno-shared when you compile. I'm
> not proposing that it be the default, only that it be an option.
>
> Ian
GDB will presumably barf on this too, won't it? It does very much the same
kind of crude disassembling/parsing of function prologs IIUIC.
Having said that, reversing the prolog to deduce information that was
discarded at compile-time is always going to be an inherently fragile strategy.
The proper solution (both for gdb and for David's application, and I think to
some extent gdb may be already beginning to support this where applicable) is to
compile the application with debug info that identifies which instructions are
prolog-related. I think that means Dwarf-3.
David, another thing that could break your code is if the MIPS gcc port starts
to use RTL prolog generation; when that happens, you'll start to see code where
instructions from the body of the function are migrated upward in among prolog
instructions by the scheduler. That's liable to confuse any code that attempts
to parse prologs without using debug info.
cheers,
DaveK
--
Can't think of a witty .sigline today....