On 10/10/2017 09:09 PM, Jiří Zárevúcky wrote:
> The problem is that we use userspace thread switching (i.e. fibrils), and the
> ABI uses segment registers for TLS on x86, which cannot be set from userspace.
> 
> So to answer your question, support for tls-direct-seg-refs would require us
> to do an architecture-specific syscall on fibril switches.
> 
> Note that it did work that way in the past, but was later changed to the 
> current
> implementation.

Yes, because we don't want to do an architecture-specific (only amd64
and ia32) syscall for performance and also aesthetic reasons. We like
TLS access code as generated by the compiler either with
-mno-tls-direct-seg-refs (supported only by GCC) or when the target is
not Linux but unknown (reportedly works universally).

Jakub

> 
> -- jzr
> 
> On 10 October 2017 at 09:55, Jiri Svoboda <[email protected]> wrote:
>> Hi JZr,
>>
>> how hard could it be to add support for tls-direct-seg-refs? It should allow
>> the compiler to generate more efficient code. I think I need to do more
>> staring into the TLS spec to understand why it doesn't work for us at the
>> moment...
>>
>> Cheers,
>> Jiri
>> ---------- Původní e-mail ----------
>> Od: Jiří Zárevúcky <[email protected]>
>> Komu: HelenOS development mailing list <[email protected]>
>> Datum: 9. 10. 2017 22:21:48
>> Předmět: [HelenOS-devel] Heads up: Changing crosscompiler target for amd64
>>
>> In order to fix clang build on amd64, I'm changing its target from
>> amd64-linux-gnu to amd64-unknown-elf. The reason for this is that
>> clang doesn't support "-mno-tls-direct-seg-refs", which is necessary
>> for HelenOS to work when using a Linux target. It's an OS-specific
>> optimization, so changing target to unknown fixes the issue.
>>
>> There are no known regressions at this moment, but you'll need to
>> rebuild your amd64 crosscompiler. After this, build using clang should
>> produce a working system.
>>
>>
>> _______________________________________________
>> HelenOS-devel mailing list
>> [email protected]
>> http://lists.modry.cz/listinfo/helenos-devel
>>
> 
> _______________________________________________
> HelenOS-devel mailing list
> [email protected]
> http://lists.modry.cz/listinfo/helenos-devel
> 

_______________________________________________
HelenOS-devel mailing list
[email protected]
http://lists.modry.cz/listinfo/helenos-devel

Reply via email to