News MIPS option -mno-shared

David Daney ddaney@avtrex.com
Thu Dec 9 18:03:00 GMT 2004


Ian Lance Taylor wrote:
> I'd like to see whether anybody has an opinion about this patch before
> I check it in.
> 
> This patch adds a new option to the MIPS assembler: -mno-shared.
> Normally the .cpload pseudo-op generates code which looks like this:
> 
> 	lui	$gp,%hi(_gp_disp)
> 	addiu	$gp,$gp,%lo(_gp_disp)
> 	addu	$gp,$gp,.cpload argument
> 
> With -mno-shared, the .cpload pseudo-op will generate code that looks
> like this:
> 
> 	lui	$gp,%hi(_gp)
> 	addiu	$gp,$gp,%lo(_gp)
> 

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.

Being the moderately astute person that I am, I will be able to fix my code
to work with the optimized prolog.

I wonder if others will be effected as well.

David Daney.



More information about the Binutils mailing list