https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66240
Jeffrey A. Law <law at redhat dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |law at redhat dot com --- Comment #8 from Jeffrey A. Law <law at redhat dot com> --- In response to c#2 and c#3, you're more likely to get that kind of "ideal" solution by hacking the linker rather than the compiler or assembler. The linker is in an ideal position to make these kinds of decisions. You can even use the linker to fill in padding at the end of a function with a nearby teeny-tiny function. You don't want to do that too aggressively though because often functions in the same CU often call each other and you can easily muck up locality if you move a teeny-tiny function too far from its parents or children in the call graph/chain. If you want to get really smart, you start collecting data about the call graph, chains and frequencies, icache and itlb behavior and use that to drive general code layout to improve icache/itlb behavior as well as smart alignments of functions. Been there, done that :-)