On Wed, Aug 31, 2016 at 5:13 PM, Benoît Canet <[email protected]>
wrote:

>    case R_X86_64_TPOFF64:
>        // FIXME: assumes TLS segment comes before DYNAMIC segment
>

I'm not sure this code even runs when loading a shared object. I think it
only runs when loading the kernel, and there is another piece of code with
R_X86_64_TPOFF64 which gets used when loading objects.


>
>
> This is not the case:
>
> See in the dump:
>

I don't understand what I see in that dump.
To understand this FIXME, please refer to commit f09e0059:

I think the FIXME refers to that we need t->tls.size() to have been
previously set. You can add a printout to see if hasn't been set.

I'm more worried about the symbol(sym) part of this code... What if there
is no symbol involved?  In this case (again see readelf --relocs for your
object), there is no object...

I think the code involved is the one added in commit
b9b73661543e614c7dfb3616bd3a75acfa30911e:

    x64: Fix R_X86_64_TPOFF64 relocation without symbol

Maybe this code (the no-symbol case) has a bug?



>
> 00000000000c8d90 <runtime.c128hash>:
>   c8d90:       48 8b 0d 29 72 38 00    mov    0x387229(%rip),%rcx        #
> 44ffc0 <_DYNAMIC+0x200>
>   c8d97:       64 48 8b 09             mov    %fs:(%rcx),%rcx
>   c8d9b:       48 3b 61 10             cmp    0x10(%rcx),%rsp
>   c8d9f:       76 60                   jbe    c8e01 <runtime.c128hash+0x71>
>
>        *static_cast<u64*>(addr) = t->dyn_tabs.lookup(sym)->st_value -
> t->tls.size;
>        break;
>    case R_X86_64_IRELATIVE:
>
>
> On Wed, Aug 31, 2016 at 4:07 PM, Benoît Canet <[email protected]
> > wrote:
>
>> This is what I saw in the code managing the flags.
>>
>> By anyway I think you are right and shared is an "impasse".
>>
>> On Wed, Aug 31, 2016 at 4:06 PM, Nadav Har'El <[email protected]> wrote:
>>
>>>
>>> On Wed, Aug 31, 2016 at 4:26 PM, Benoît Canet <
>>> [email protected]> wrote:
>>>
>>>>
>>>> Buildmode shared alone crash.
>>>>
>>>>
>>>>
>>> the flags are |= between them.
>>>>
>>>
>>> This is not what I see in https://golang.org/src/cmd/go/build.go
>>>
>>> But it seems these two options indeed have a funny interaction between
>>> them - shared enables "dynlink" which gets remembered even when the build
>>> mode is switched to PIE.
>>>
>>>
>>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to