Joern Rennecke <amyl...@spamcop.net> writes: > So I was wodering if we could get a good first-order approximation > by placing library code that is called frequently together with the > code that is calling it.
A co-worker of mine at Google did some experiments along those lines using gold. He was not able to demonstrate any performance improvements, unfortunately (x86_64 target, proprietary test cases). He was hacking linker scripts. That said, with the --gc-sections support that is about to go into gold, it should be quite easy to have gold layout code using a DFS of references from one section to another. That will give you a simple-minded version of putting code near its caller (obviously it will work best for code which is only called from one place). So there is a convenient test bed if anybody wants to try it. I would also be very much in favor of adding support to gold for reading a partial placement file, saying something like "section X should be near section Y," with unmentioned sections being laid out by default. This should also be fairly straightforward to implement in gold's layout code. Ian