Doing [runtime detection] correctly is very hard and something I don’t particularly want to dig deeply into here.
It’s kinda not that hard, especially not in Rust which gives you #[target_feature(..)] and std::arch macros (sadly doesn’t make it easy to use ifuncs instead of if statements but oh well the benefit from rtld-time resolution shouldn’t be that big performance wise)
It’s kinda not that hard, especially not in Rust which gives you
#[target_feature(..)]
and std::arch macros (sadly doesn’t make it easy to use ifuncs instead of if statements but oh well the benefit from rtld-time resolution shouldn’t be that big performance wise)There is
ifunky
. The much more widely usedmemchr
does something similar, though I suppose that doesn’t count as easy.“without the need for loader support” yeah those aren’t really it either.
Don’t you use
cfg_feature_enabled
for runtime feature detection, andtarget_feature
for compile-time feature detection?It’s not compile-time detection, it enables that feature for codegen inside of a function.
[Comment removed by author]