diff options
author | Snehasish Kumar <snehasishk@google.com> | 2020-09-17 10:04:03 -0700 |
---|---|---|
committer | Snehasish Kumar <snehasishk@google.com> | 2020-09-24 15:02:48 -0700 |
commit | 070555c6c008c57c408c1e99025b12c5d71c9848 (patch) | |
tree | 99d6c9c0fa954411ae5e8336e10fe8cf50756f8d /lld | |
parent | 5213576fa25e6deb7c649032b2893726de2f8b6c (diff) | |
download | llvm-070555c6c008c57c408c1e99025b12c5d71c9848.zip llvm-070555c6c008c57c408c1e99025b12c5d71c9848.tar.gz llvm-070555c6c008c57c408c1e99025b12c5d71c9848.tar.bz2 |
[lld] Make -z keep-text-section-prefix recognize .text.split. as a prefix.
".text.split." holds symbols which are split out from functions in
other input sections. For example, with -fsplit-machine-functions,
placing the cold parts in .text.split instead of .text.unlikely mitigates
against poor profile inaccuracy. Techniques such as hugepage remapping can
make conservative decisions at the section granularity.
Differential Revision: https://reviews.llvm.org/D87840
Diffstat (limited to 'lld')
-rw-r--r-- | lld/ELF/Writer.cpp | 7 | ||||
-rw-r--r-- | lld/test/ELF/text-section-prefix.s | 11 |
2 files changed, 14 insertions, 4 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index f42686f..78d6cd0 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -131,9 +131,14 @@ StringRef elf::getOutputSectionName(const InputSectionBase *s) { // SampleFDO is used, if a function doesn't have sample, it could be very // cold or it could be a new function never being sampled. Those functions // will be kept in the ".text.unknown" section. + // ".text.split." holds symbols which are split out from functions in other + // input sections. For example, with -fsplit-machine-functions, placing the + // cold parts in .text.split instead of .text.unlikely mitigates against poor + // profile inaccuracy. Techniques such as hugepage remapping can make + // conservative decisions at the section granularity. if (config->zKeepTextSectionPrefix) for (StringRef v : {".text.hot.", ".text.unknown.", ".text.unlikely.", - ".text.startup.", ".text.exit."}) + ".text.startup.", ".text.exit.", ".text.split."}) if (isSectionPrefix(v, s->name)) return v.drop_back(); diff --git a/lld/test/ELF/text-section-prefix.s b/lld/test/ELF/text-section-prefix.s index 5ef2b4b..950f9d7 100644 --- a/lld/test/ELF/text-section-prefix.s +++ b/lld/test/ELF/text-section-prefix.s @@ -15,9 +15,10 @@ # KEEP: [ 1] .text # KEEP-NEXT: [ 2] .text.hot # KEEP-NEXT: [ 3] .text.unknown -# KEEP-NEXT: [ 4] .text.startup -# KEEP-NEXT: [ 5] .text.exit -# KEEP-NEXT: [ 6] .text.unlikely +# KEEP-NEXT: [ 4] .text.split +# KEEP-NEXT: [ 5] .text.startup +# KEEP-NEXT: [ 6] .text.exit +# KEEP-NEXT: [ 7] .text.unlikely # NOKEEP: [ 1] .text # NOKEEP-NOT: .text @@ -32,6 +33,7 @@ # SCRIPT-NEXT: .text.f # SCRIPT-NEXT: .text.hot.f_hot # SCRIPT-NEXT: .text.unknown.f_unknown +# SCRIPT-NEXT: .text.split.f_split # SCRIPT-NEXT: .text.startup.f_startup # SCRIPT-NEXT: .text.exit.f_exit # SCRIPT-NEXT: .text.unlikely.f_unlikely @@ -49,6 +51,9 @@ _start: .section .text.unknown.f_unknown,"ax" nop +.section .text.split.f_split,"ax" + nop + .section .text.startup.f_startup,"ax" nop |