This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug inline-asm/66631] inability to clobber segment regs makes tls problematic
- From: "stsp at users dot sourceforge.net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 22 Jun 2015 23:45:10 +0000
- Subject: [Bug inline-asm/66631] inability to clobber segment regs makes tls problematic
- Auto-submitted: auto-generated
- References: <bug-66631-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66631
--- Comment #11 from Stas Sergeev <stsp at users dot sourceforge.net> ---
(In reply to Andrew Pinski from comment #9)
> Clang is not GCC. Really you should not be using the fs segment register
> for your own use as it is part of the ABI that is the TLS segment. Any
> other use it of it is outside of the ABI and will break everything else.
> Why can't you not use fs segment?
Alien code in place (think of wine/dosemu).
> Also why can't you write your segfault handler in assembly when you fixup
> the fs segment and then call the C functions?
In principle - yes, but in practice - looking into a source -
too much work. It is large, and it also uses a syscalls:
sys_prctl(ARCH_SET_FS, eflags_fs_gs.fsbase);
Do syscalls in asm too? :(
Of course this all is possible, but...
Should I really resort to always using -O1 till that also break? :(
Let me ask you from the other side: why not simply to
allow clobber also segregs? Improvement for everyone IMHO.
clang did that for chromium it seems - likely a jit either.
IMHO gcc should allow writing the specific things like
signal handlers, interrupt handlers in embedded systems,
etc - they all have suprises and deviations from ABI, yet
gcc usually has an extensions to cover all these needs. Why
to suddenly change that good practice?