On 10/06/2024 12.43, Peter Zijlstra wrote: > On Sat, Jun 08, 2024 at 12:35:05PM -0700, Linus Torvalds wrote: >> Comments? > > It obviously has the constraint of never running the code before the > corresponding runtime_const_init() has been done, otherwise things will > go sideways in a hurry, but this also makes the whole thing a *lot* > simpler. > > The only thing I'm not sure about is it having a section per symbol, > given how jump_label and static_call took off, this might not be > scalable. > > Yes, the approach is super simple and straight forward, but imagine > there being like a 100 symbols soon :/ > > The below hackery -- it very much needs cleanup and is only compiled on > x86_64 and does not support modules, boots for me. As can be seen in my other reply, yes, I'm also worried about the scalability and would like to see this applied to more stuff. But if we do this, surely that's what scripts/sorttable is for, right? Alternatively, if we just keep emitting to per-symbol __runtime_const_##sym sections but collect them in one __runtime_const, just using __runtime_const { *(SORT_BY_NAME(__runtime_const_*)) } in the linker script should already be enough to allow that binary search to work (with whatever : AT(ADDR() ... ) magic is also required), with no post-processing at build or runtime required. Rasmus