From: "H. Peter Anvin" <hpa@zytor.com>
To: Nathan Chancellor <nathan@kernel.org>
Cc: Uros Bizjak <ubizjak@gmail.com>,
Nick Desaulniers <nick.desaulniers+lkml@gmail.com>,
Bill Wendling <morbo@google.com>,
Justin Stitt <justinstitt@google.com>,
"x86@kernel.org" <x86@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: Do we still care about compilers without __seg_fs and __seg_gs support??
Date: Fri, 19 Dec 2025 16:47:57 -0800 [thread overview]
Message-ID: <74706dc9-79bf-4f8c-a4e6-88fc5289998e@zytor.com> (raw)
In-Reply-To: <20251220002424.GA3998744@ax162>
On 2025-12-19 16:24, Nathan Chancellor wrote:
> On Fri, Dec 19, 2025 at 03:24:21PM -0800, H. Peter Anvin wrote:
>> As of Linux 6.16, we require:
>>
>> gcc 8.1 or higher
>> clang 15.0.0 or higher
>>
>> If my reading of the release notes is correct, then both versions *should*
>> supported __seg_fs and __seg_gs, but we have:
>>
>> config CC_HAS_NAMED_AS
>> def_bool $(success,echo 'int __seg_fs fs; int __seg_gs gs;' | $(CC) -x
>> c - -S -o /dev/null)
>> depends on CC_IS_GCC
>>
>> We don't even try on clang.
>>
>> Being able to actually rely on the compiler for this would make a lot of
>> things cleaner. For one thing, I'm trying to untangle a bunch of ugliness in
>> the code sharing between realmode and proper flat mode code...
>>
>> Uros, you seem to have touched this code as recently as earlier this year; any
>> thoughts?
>>
>> What about the LLVM people, any insights?
>
> Trying to use __seg_fs or __seg_gs in certain cases crashes the X86
> backend.
>
> https://github.com/llvm/llvm-project/issues/93449
>
> Is there anyone on AMD or Intel's LLVM teams that could look into
> solving that? Nick pinged a couple of Intel's folks but it does not look
>
It looks to me that this is specifically related to static initializers, or is
there something else here that I'm not sure about?
I'm asking because it might still allow at least the boot code improvements,
and/or have some other less painful workaround than carrying these hacks.
As far as I can tell, on x86 gcc will not change the value of the pointer when
cast to a different address space and I believe Linux expects this behavior.
-hpa
next prev parent reply other threads:[~2025-12-20 0:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-19 23:24 H. Peter Anvin
2025-12-20 0:24 ` Nathan Chancellor
2025-12-20 0:43 ` H. Peter Anvin
2025-12-20 0:47 ` H. Peter Anvin [this message]
2025-12-20 7:50 ` Uros Bizjak
2025-12-20 8:47 ` H. Peter Anvin
2025-12-20 7:47 ` Uros Bizjak
2025-12-20 20:53 ` H. Peter Anvin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=74706dc9-79bf-4f8c-a4e6-88fc5289998e@zytor.com \
--to=hpa@zytor.com \
--cc=akpm@linux-foundation.org \
--cc=justinstitt@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=nick.desaulniers+lkml@gmail.com \
--cc=ubizjak@gmail.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®