[PATCH] D118077: Print C-string literals in mapfile

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 11 12:14:48 PST 2022


int3 added inline comments.


================
Comment at: lld/MachO/MapFile.cpp:86
+      const auto *isec = cast<CStringInputSection>(sym->isec);
+      const StringPiece &piece = isec->getStringPiece(sym->value);
+      StringRef str = isec->getStringRef(&piece - &(*isec->pieces.begin()));
----------------
By "assert the offset is zero" I meant `assert(sym->value == piece.inSecOff)`... since we are locating the StringPiece via binary search, we are not guaranteed to find a string who starts at the exact location of the symbol

Even if strings don't overlap, we can have a symbol that starts in the middle of an existing string -- that's what the assert would catch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118077



More information about the llvm-commits mailing list