[PATCH] D71819: [ELF] Support input section description .gnu.version* in /DISCARD/

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 26 00:33:09 PST 2019


MaskRay added inline comments.


================
Comment at: lld/ELF/SyntheticSections.cpp:1447
   }
-  if (hasVerNeed) {
+  if (hasVerNeed && part.verNeed->isLive()) {
     addInSec(DT_VERNEED, part.verNeed);
----------------
grimar wrote:
> grimar wrote:
> > Can't you remove `hasVerNeed` variable and use `verNeed->isNeeded()` here too?
> You perhaps need to add `isLive()` condition to `bool VersionNeedSection<ELFT>::isNeeded()` for that.
Yes.. I was a bit hesitant whether we should move isLive() to `VersionNeedSection<ELFT>::isNeeded()`.  Note that we don't check isLive() in `SyntheticSection::isNeeded()`, the base member function.

It seems moving `isLive()` makes the code look better. So I will do that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71819





More information about the llvm-commits mailing list