Obviously doing this by hand is insane. That was not my thought.
That's funny, given that's exactly what you have now.
DWARF information is the way you get this stuff out of the compiler.
That is what it's *there for*. If you don't want to keep it around you
can distill out the information you need and then remove it. However,
as I have said about six times now:
THE RIGHT WAY TO DO THIS IS WITH COMPILER SUPPORT.
All these problems is because you're trying to do something behind the
back of the compiler, but not *completely* so.
This is somewhat nice in theory; I've found that gcc tends to interlace
them pretty heavily and so the cache interference even of gcc "out of
line" code is sizable. Furthermore, modern CPUs often speculatively
fetch *both* branches of a conditional.
This is actually the biggest motivation for patching static branches.
Nice theory. Doesn't work in practice as long as you rely on gcc unlikey().
-hpa
--