[compiler-rt] [RISCV][compiler-rt] Small fixes for __riscv_feature_bits (PR #99958)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 23 13:05:36 PDT 2024


preames wrote:

> I think the compiler-rt building is fine now. But a little concern on behavior description on another patch.
> 
> > Before this can make it into a release, we need a change such as #99958. The gcc docs claim that cpu_support can be called by "normal" code without calling the cpu_init routine because the init routine will have been called by a high priority constructor. Our current compiler-rt mechanism does not do this.
> 
> Does it mean we could use the `__builtin_cpu_supports` without call `__builtin_cpu_init` explicitly?

Yes, it does.

> In my local test, if I didn't invoke `__builtin_cpu_init` explicitly, every `__builtin_cpu_supports` return false even with CONSTRUCTOR_ATTRIBUTE.

And this is just normal code?  Not like an ifunc resolver or something?  That's very surprising.  

> Maybe we missing something, or I misunderstand the behavior.

Sounds like we're missing something.  I have no idea what though.  To start debugging:
* Which compiler are you using?  What linker?


https://github.com/llvm/llvm-project/pull/99958


More information about the llvm-commits mailing list