https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115172

--- Comment #3 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Jakub Jelinek from comment #1)

> What the kernel does is terrible, why they just don't declare the extern
> with __seg_gs attribute?

This is how kernel currently handles percpu variables. They are redefined to a
named address space just before use, because the percpu infrastructure can't
handle AS qualified variables, mainly due to the extensive use of __typeof__,
please see [1].

The solution is to use __typeof_unqual__ with gcc-14. The prototype patch at
[2] declares percpu variables as __seg_gs during decl time, as you proposed
above.

[1] https://lore.kernel.org/lkml/87bk7ux4e9.ffs@tglx/

[2]
https://lore.kernel.org/lkml/cafuld4z-sthtu2uwv02s+nbx51qqytguo8zew50fc_pbsff...@mail.gmail.com/

Reply via email to