[EXT] Re: [PATCH] RISC-V: Add vector registers to __SYSCALL_CLOBBERS

Peter Bergner bergner@tenstorrent.com
Wed Aug 20 01:27:41 GMT 2025


On 8/19/25 7:22 PM, Palmer Dabbelt wrote:
> It's only a correctness bug if you build GCC with V enabled globally.  
> For some reason I thought we'd forbidden that at configure time, but I 
> don't see it in preconfigure.ac so maybe I'm just misremembering?  
> That's why I'd punted on this earlier, but I guess I dropped the ball 
> there...
> 
> So ya, I think we should backport these basically forever.  Seems like 
> the patch would just apply all the way back, so I guess it's just
> 
> Fixes: 36960f0c76 ("RISC-V: Linux Syscall Interface")

Ok, I can add that to the git log entry.  Thanks.

There is the case of GLIBC explicitly enabling vector globally...or via
target attribute/#pragma to get vector code.  There is also the case
in the (hopefully not too far) future when RISC-V vector support is so
stable, that we'll enable vector automatically by default (modulo the
-march setting).  Either way, we want the GLIBC code now to "just work"
regardless of whether vector is enabled or not.




>> +#ifdef __riscv_v
>> +# define __SYSCALL_CLOBBERS "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", \
>> +			     "v10", "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19", \
>> +			     "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", \
>> +			     "v30", "v31", "memory"
> 
> There's a few more of these, GCC has "vl", "vtype", "vxrm", and 
> "vxsat".  With those

Ok, I'll add them too. 


> IIRC we added the extra ones later, but maybe it's worth throwing 
> together some autoconf that forbids GCC versions before 15?  Autovec is 
> pretty buggy in 14 and unlikely to be profitable, so I think users who 
> try would just be asking for trouble...

I'll take a look at when those were added and what it will take to disallow
that for the old compilers.  Do I need to worry about old clang compilers too?


Peter




More information about the Libc-alpha mailing list