linker: catching up on section pgo-reordering modes
Nick Clifton
nickc@redhat.com
Tue Jul 15 08:29:54 GMT 2025
Hi Frank,
> I'm searching for advice about how (perhaps: whether) to approach
> adding functionality to gnu-ld to carry out link-time reordering along
> the lines of sediment [1] [2], similar to 2017 lld's [3] [4]
> --call-graph-* options.
This sounds like an excellent goal.
> gnu-ld has a "--section-ordering-file" option, but it requires a
> linker script syntax file fragment containing externally sorted
> section names. That means the enveloping build system must enumerate
> & sort symbols/sections without ld's insight into relationships
> (static call graph). Plus it must prepare a physical file specialized
> for each job, which is disruptive to the normal "make" flow.
>
> In contrast, llvm's way drops off call graph profile data inside
> sections of the object files themselves (.llvm.call-graph-profile) or
> external files. llvm-prof{gen,data} and lld have a convenient set of
> options to convert / manage / consume them.
>
> Is there an appetite in gnu binutils land to catch up a little to this
> part of the llvm toolchain, interoperating or otherwise?
Yes. Well at least in my opinion. One of the goals of gnu-ld is to be
the de facto standard for linkers. Maybe not the fastest, but certainly
the most complete. So any efforts to improve its functionality are
welcome.
Plus any goal that will improve interoperability *and* help customers
generate faster binaries is a big win.
> Maybe
> focusing on the infrastructure of sharing a corpus of profiling data?
This will probably be the best way to start. It will undoubtedly
encourage other uses of the profile data by other tools as well, which
is another bonus.
Cheers
Nick
More information about the Binutils
mailing list