This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] MIPS16 TLS support for GCC


[forking for different topics]

"Maciej W. Rozycki" <macro@codesourcery.com> writes:
> On Sat, 4 Feb 2012, Richard Sandiford wrote:
>> >  I don't think _mcount has ever worked for dynamic libraries, has it? -- 
>> > please correct me if I am wrong, but I believe `gprof' relies on memory 
>> > segments to be contiguous which is certainly not the case for a dynamic 
>> > executable where you have a separate set of mappings for the executable 
>> > proper and then for each shared library loaded.
>> >
>> >  I didn't know it required $3 for anything either -- I've thought it was 
>> > $1 only.  How has it worked for standard MIPS code then?
>> 
>> Sorry, I misremembered, it was $2 (for the static chain register).
>
>  Please elaborate anyway -- if you remember the details of $2 usage 
> offhand, that is.  I'm curious.

$2 was the traditional static chain pointer, and _mcount would preserve it
so that calls from nested functions would work correctly.  We since changed
GCC's own static pointer to $15, so we now have to move $15 to $2 before
calling _mcount and restore it afterwards, since there's no guarantee
that _mcount itself will preserve $15.

Or at least, that's the theory.  I have to admit to never using it in
"real world" situations.

Richard


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]