linker: catching up on section pgo-reordering modes
Frank Ch. Eigler
fche@redhat.com
Mon Jul 14 18:10:21 GMT 2025
Hi -
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.
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? Maybe
focusing on the infrastructure of sharing a corpus of profiling data?
[1] https://people.redhat.com/wcohen/sediment/html/index.html
[2] https://github.com/wcohen/sediment
[3] https://reviews.llvm.org/D36351
[4] https://llvm.org/devmtg/2018-10/slides/Spencer-Profile%20Guided%20Function%20Layout%20in%20LLVM%20and%20LLD.pdf
More information about the Binutils
mailing list