[PATCH] D109400: [LLD] Add archive Name to relocaiton overflow printout

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 7 16:38:16 PDT 2021


MaskRay added a subscriber: evgeny777.
MaskRay added a comment.

Oh, yes. This occasionally tripped over me as well. I'd like to simply use

  -  // First check if we can get desired values from debugging information.
  -  if (Optional<DILineInfo> info = getFile<ELFT>()->getDILineInfo(this, offset))
  -    return info->FileName + ":" + std::to_string(info->Line) + ":(" +
  -           secAndOffset + ")";
  -
  -  // File->sourceFile contains STT_FILE symbol that contains a
  -  // source file name. If it's missing, we use an object file name.
  -  std::string srcFile = std::string(getFile<ELFT>()->sourceFile);
  -  if (srcFile.empty())
  -    srcFile = toString(file);
  +  std::string srcFile = toString(file);

Object/archive filenames seem always better than source filenames since one source filename can map to multiple `.o`

The code was from D25826 <https://reviews.llvm.org/D25826> by @evgeny777


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109400



More information about the llvm-commits mailing list