Hi Uros,
On Mon, Sep 09, 2024 at 09:30:06PM +0200, Uros Bizjak wrote:
Besides GCC, clang can define various named address space via address_space attribute:
--cut here-- #define __as(N) __attribute__((address_space(N)))
void *foo(void __as(1) *x) { return x; } // error
void *bar(void __as(1) *x) { return (void *)x; } // fine --cut here--
When compiling this, the compiler returns:
clang-as.c:3:37: error: returning '__as(1) void *' from a function with result type 'void *' changes address space of pointer
Super cool. Looking forward to having it all wired up and the bugs we'll find with it.
I think that the best approach is to target this patchset for linux 6.13 via random.git tree. I will prepare a v3 after 6.12rc1, so when committed to random.git, the patchset will be able to spend some time in linux-next. This way, there will be plenty of time for CI robots to do additional checks also for some less popular targets (although individual patches are dead simple, removing these kinds of "legacy" includes can be tricky), and I will also be able to collect Acked-by:s in the meantime.
While the patchset is an improvement by itself, its inclusion is not time sensitive. The follow up percpu named address checking functionality requires a very recent feature (__typeof_unqual__ keyword), which is only supported in recent compilers (gcc-14 and clang-20). Besides compiler support, sparse doesn't know about __typeof_unqual__, resulting in broken type tracing and hundreds of sparse errors with C=1 due to unknown keyword.
So, I think we are not in a hurry and can take the slow and safe path.
Okay, sure, that sounds good to me. I'll keep my eyes open for v3 in a few weeks then.
Jason