[PATCH] D87840: [lld] Make -z keep-text-section-prefix recognize .text.split. as a prefix.

Snehasish Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 24 15:06:34 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG070555c6c008: [lld] Make -z keep-text-section-prefix recognize .text.split. as a prefix. (authored by snehasish).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87840/new/

https://reviews.llvm.org/D87840

Files:
  lld/ELF/Writer.cpp
  lld/test/ELF/text-section-prefix.s


Index: lld/test/ELF/text-section-prefix.s
===================================================================
--- lld/test/ELF/text-section-prefix.s
+++ 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 @@
 .section .text.unknown.f_unknown,"ax"
   nop
 
+.section .text.split.f_split,"ax"
+  nop
+
 .section .text.startup.f_startup,"ax"
   nop
 
Index: lld/ELF/Writer.cpp
===================================================================
--- lld/ELF/Writer.cpp
+++ lld/ELF/Writer.cpp
@@ -131,9 +131,14 @@
   // 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();
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87840.294183.patch
Type: text/x-patch
Size: 2053 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200924/0b9ea7d5/attachment.bin>


More information about the llvm-commits mailing list