[PATCH] D137620: [BOLT] Don't align .text to pageAlign

Denis Revunov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 21 05:00:34 PST 2022


treapster updated this revision to Diff 484540.
treapster added a comment.

Fix test


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137620

Files:
  bolt/lib/Core/BinaryContext.cpp
  bolt/lib/Rewrite/RewriteInstance.cpp
  bolt/lib/Utils/CommandLineOpts.cpp
  bolt/test/X86/dummy-eh-frame-bug.s


Index: bolt/test/X86/dummy-eh-frame-bug.s
===================================================================
--- bolt/test/X86/dummy-eh-frame-bug.s
+++ bolt/test/X86/dummy-eh-frame-bug.s
@@ -9,7 +9,7 @@
 ## after .text when no update is needed to .eh_frame.
 
 # CHECK: {{ .text}} PROGBITS [[#%x,ADDR:]] [[#%x,OFFSET:]] [[#%x,SIZE:]]
-# CHECK-NEXT: 0000000000000000 [[#%x, OFFSET + SIZE]]
+# CHECK-NEXT: 0000000000000000 [[#%.6x, OFFSET + SIZE]]
 
   .text
   .globl nocfi_function
Index: bolt/lib/Utils/CommandLineOpts.cpp
===================================================================
--- bolt/lib/Utils/CommandLineOpts.cpp
+++ bolt/lib/Utils/CommandLineOpts.cpp
@@ -42,7 +42,7 @@
 
 cl::opt<unsigned> AlignText("align-text",
                             cl::desc("alignment of .text section"), cl::Hidden,
-                            cl::cat(BoltCategory));
+                            cl::init(64), cl::cat(BoltCategory));
 
 cl::opt<unsigned> AlignFunctions(
     "align-functions",
Index: bolt/lib/Rewrite/RewriteInstance.cpp
===================================================================
--- bolt/lib/Rewrite/RewriteInstance.cpp
+++ bolt/lib/Rewrite/RewriteInstance.cpp
@@ -1777,7 +1777,10 @@
     opts::UseOldText = false;
   }
 
-  if (!opts::AlignText.getNumOccurrences())
+  if (opts::Hugify || opts::HotText)
+    BC->PageAlign = BinaryContext::HugePageSize;
+
+  if (opts::Hugify || opts::UseOldText)
     opts::AlignText = BC->PageAlign;
 
   if (opts::AlignText < opts::AlignFunctions)
Index: bolt/lib/Core/BinaryContext.cpp
===================================================================
--- bolt/lib/Core/BinaryContext.cpp
+++ bolt/lib/Core/BinaryContext.cpp
@@ -48,7 +48,7 @@
 
 namespace opts {
 
-cl::opt<bool> NoHugePages("no-huge-pages",
+cl::opt<bool> NoHugePages("no-huge-pages", cl::init(true),
                           cl::desc("use regular size pages for code alignment"),
                           cl::Hidden, cl::cat(BoltCategory));
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137620.484540.patch
Type: text/x-patch
Size: 1984 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221221/6dd4e2b9/attachment.bin>


More information about the llvm-commits mailing list