[PATCH] D155604: [BOLT] Calculate input to output address map using BOLTLinker

Job Noorman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 27 02:32:39 PDT 2023


jobnoorman marked 4 inline comments as done.
jobnoorman added inline comments.


================
Comment at: bolt/lib/Core/AddressMap.cpp:45
+  Parsed.Map.reserve(Buffer.size() / 16);
+  const auto *const MapData = Buffer.data();
+
----------------
maksfb wrote:
> You can also use `DataExtractor` class for parsing and derive endianness from `BC.AsmInfo->isLittleEndian()`.
TIL about `DataExtractor`. Thanks!


================
Comment at: bolt/lib/Rewrite/RewriteInstance.cpp:3194
   emitBinaryContext(*Streamer, *BC, getOrgSecPrefix());
+  AddressMap::emit(*Streamer, *BC);
 
----------------
maksfb wrote:
> Can we make this call from inside `emitBinaryContext()`?
Yes, the reason I didn't do this is because it currently doesn't work for Mach-O (because `BinaryContext::getDataSection` doesn't support it). I moved the call but guarded it by `isELF()`.


================
Comment at: bolt/lib/Rewrite/RewriteInstance.cpp:4032
 
+    if (isLinkOnlySection(Section.getName()))
+      continue;
----------------
maksfb wrote:
> Do we need this check and the one below despite calling `deregisterSection()`?
We don't :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155604



More information about the llvm-commits mailing list