2009/3/16 Daniel Jacobowitz <d...@false.org>:
> On Mon, Mar 16, 2009 at 06:19:01PM +0100, Joel Porquet wrote:
>> 2009/3/12 Daniel Jacobowitz <d...@false.org>:
>> > On Thu, Mar 12, 2009 at 02:02:36PM +0100, Joel Porquet wrote:
>> >> > Check what symbol is at, or near, 0x40030000 + 22368.  It's probably
>> >> > the GOT plus a constant bias.
>> >>
>> >> It seems there is nothing at this address. Here is the program header:
>> >
>> > Don't know then.  Look at compiler-generated assembly instead of
>> > disassembly; that often helps.
>>
>> Do you mean the object file produced by gcc before linkage?
>
> That will do, but the actual assembly (-S) is more helpful sometimes.
>
>> > This is a *module* relocation.  In local dynamic the module is always
>> > the current DSO; it does not need a symbol.
>>
>> But what if the DSO access other module's TLS?
>
> Then it does not use "Local" Dynamic to do so.

I don't understand how the runtime loader could know that! As far as I
know, the tls model is not embedded in reloc information.

>>
>> Finally, I noticed another problem. GCC seems to not make room for the
>> 4 arguments as specified in the ABI, when calling __get_tls_addr.
>> For example, here is an extract of the code for calling (we see that
>> data are stored directly at the top of the stack):
>>
>> ...
>> 5ffe0bfc:     27bdfff0        addiu   sp,sp,-16
>> 5ffe0c00:     afbf000c        sw      ra,12(sp)
>> 5ffe0c04:     afbc0000        sw      gp,0(sp)
>
> That line is bogus.  Figure out where it came from; the cprestore
> offset should not be zero.

I don't know how to figure this out (actually, that's why I'm writing
on this ml). I just wrote a small function which uses a tls variable
and gcc did the rest.

__thread unsigned int *tty;
void puts(char *str)
{
    while(*str)
        *tty = *str++;
}

Reply via email to