[PATCH] D132051: [BOLT] Track fragment info for all split fragments

Fabian Parzefall via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 22 17:28:28 PDT 2022


FPar added inline comments.


================
Comment at: bolt/lib/Rewrite/RewriteInstance.cpp:4477-4491
+        if (FF.getAddress()) {
+          ELFSymTy NewColdSym = FunctionSymbol;
+          const SmallString<256> SymbolName = formatv(
+              "{0}.cold.{1}", cantFail(FunctionSymbol.getName(StringSection)),
+              FF.getFragmentNum().get() - 1);
+          NewColdSym.st_name = AddToStrTab(SymbolName);
+          NewColdSym.st_shndx =
----------------
rafauler wrote:
> Can we add a simple test to check that this is working as intended?
> 
> Mistakes in the symbol table update are nasty because the program will not crash and we may take a long time to detect (since it takes a human to read the symbol table and see that it doesn't make sense). For this case, a test is a good way of making sure this code won't break in the future.
I have added a test at `bolt/test/X86/fragmented-symbols.s` in D132052 (easier to test in this diff). Does that cover what you were thinking of?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132051



More information about the llvm-commits mailing list