On 2021-05-07, Xi Ruoyao via Binutils wrote:
On Fri, 2021-05-07 at 00:06 +0800, 陈云星 via Gcc-help wrote:
From llvm community:
https://reviews.llvm.org/rG1a33c0f2422c97dbfdbf11e561bb7823d71e3145 ;<
https://reviews.llvm.org/rG1a33c0f2422c97dbfdbf11e561bb7823d71e3145>
LLD linker has an option : --symbol-ordering-file
Which support direct linker to sort symbol in result object by a user
supplied file;
This improve performance by reduce instruction cache miss.
The hottest function will cluster and code cache hit rate will be high.
Does gnu linker can support this ?
I think with -ffunction-sections and -fdata-sections, and a ld script it
can be achieved. But it may be very painful.
Cc binutils, as it's a more proper location to discuss this.
--
Xi Ruoyao <xry111@xxxxxxxxxxxxxxxx>
School of Aerospace Science and Technology, Xidian University
gold has a --section-ordering-file, sorted by section name. It is less
useful than --symbol-ordering-file. In practice, text/data sections are
required to have different names (you cannot use clang
-funique-section-names; GCC feature request
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95095). For sorting based
on symbol names, you can use -funique-section-names.