[PATCH] D74169: [LLD][ELF][DebugInfo] Skeleton implementation of removing obsolete debug info.

Alexey Lapshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 7 05:27:22 PST 2020


avl added a comment.

>   How many changes do you expect will be needed to make the feature work?

Hi, following is the approximate list of changes, which assumed to match with corresponding patches :

1. Do not create DWARFContext inplace. Use ObjFile<ELFT>::dwarf and "llvm::call_once(initDwarfLine, [this]() { initializeDwarf(); });" instead.

2. Patch DebugInfoDWARF library to have a possibility to replace the error handler. Someone could already pass own error handler for DWARFContext. But there are places where WithColor::error() is used directly:



  void DWARFUnit::extractDIEsIfNeeded(bool CUDieOnly) {
  if (Error e = tryExtractDIEsIfNeeded(CUDieOnly))
    WithColor::error() << toString(std::move(e));
  }

Thus, it is necessary to have a possibility to replace ErrorHandler here.

3. Replace LLDDwarfObj with DWARFObjInMemory implementation while creating DWARFContext:



  for (InputFile *file : objectFiles) {
    std::unique_ptr<ObjectFile> ObjectFile = createELFObjectFile(file.mb);
  
    std::unique_ptr<DWARFContext> DWARFContext::create (ObjectFile, nullptr, ErrorHandler));
  }

4. Create an implementation for lld/ELF/LLDDwarfLinker.cpp::ObjFileAddressMap.

5. Create special kind of section - "DebugInputSection : public InputSection". To keep the result of debug info linking and to handle relocations.

6. add LLD`s implementation for DWARFLinker/DWARFLinker.h::DwarfEmitter, which would write the output of DWARFLinker into DebugInputSection.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74169





More information about the llvm-commits mailing list