[PATCH] D78389: [ELF] Keep local symbols when both --emit-relocs and --discard-all are specified

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 17 21:16:45 PDT 2020


MaskRay marked an inline comment as done.
MaskRay added inline comments.


================
Comment at: lld/ELF/Writer.cpp:649-650
   // copied because they may be referenced by relocations.
   if (config->emitRelocs)
     return true;
 
----------------
ikudrin wrote:
> For the purpose of this fix, it would be simpler to extend the condition at the beginning of `getDiscard()` in `Driver.cpp` and remove this condition. The other changes are not required.
Do you mean
```
-  if (args.hasArg(OPT_relocatable))
+ if (args.hasArg(OPT_relocatable) || config->emitRelocs)
    return DiscardPolicy::None;
```

? That would increase the amount of differences for D77807.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78389





More information about the llvm-commits mailing list