[PATCH] D60321: [llvm-readobj] Add helper functions `printVersionSymbol()`, `printVersionDefinition()` and `printVersionDependency()`

Xing via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 16 04:43:15 PDT 2019


Higuoxing updated this revision to Diff 195355.
Higuoxing added a comment.

Sorry for not respounding on this patch for a long time.

I have tried several methods to simplify some shared logic of `LLVMStyle` and `GNUStyle`.

In this patch, I add another 3 functions to place some shared logic or variables. I met a problem which is, in `LLVMStyle`, we should print empty closure for empty `versym`, `verneed`, `verdef` sections. But `DictScope` cannot be used to forward-declare. For examle:

  DictScope D; // to extend D's lifetime.
  if (opts::Output == opts::LLVM)
    D = DictScope(W, "XXX");
  if (!Sec)
    return;

So, I have to write empty closure by hand. Like:

  if (!Sec) {
    if (opts::Output == opts::LLVM)
      W.startLine() << "ScopeName {\n}\n";
    return;
  }

In lld, some tests detect the empty closures, so we have to keep this feature.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D60321

Files:
  llvm/test/tools/llvm-readobj/elf-empty-version-info.test
  llvm/tools/llvm-readobj/ELFDumper.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60321.195355.patch
Type: text/x-patch
Size: 13483 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190416/8f366827/attachment.bin>


More information about the llvm-commits mailing list