[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 06:03:15 PST 2020


avl added a comment.

> I wonder if that is really important to split patches that much (this patch seems have no functionality at all?). It would be good to see at least some benefit, but perhaps
> it is not that easy to do... Anyways:
> Personally I'd probably prefer to see a full set of patches for the feature. A reviewer should be able to apply them and debug (if he/she wants to) probably.

Hi George,

I follow the idea is that small patches are easier to review and easier to integrate. That concrete patch does not have a functionality but it includes DWARLinker library, creates option and creates placeholders for the functionality. Which looks like a small amount of things that could be reviewed.

Creating full set of patches which could be any time applied to the upstream and to the each other  is quite time consuming thing because of time for synchronization/merging/rebasing. As an alternative we could discuss main points of future patches[0]. And iteratively apply patches step by step. If that plan is not good - then OK, I would start to work on preparing full set of patches for that feature.

[0] 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