[PATCH] D116946: [ELF] Use tombstone values for discarded symbols in relocatable output

Igor Kudrin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 11 04:05:49 PST 2022


ikudrin updated this revision to Diff 398895.
ikudrin marked 2 inline comments as done.
ikudrin edited the summary of this revision.
ikudrin added a comment.

- Add `.o` in the test
- Swap `then` and `else` branches in `InputSection::relocateNonAlloc()`

In D116946#3233496 <https://reviews.llvm.org/D116946#3233496>, @MaskRay wrote:

> Now a relocatable link runs both relocateNonAllocForRelocatable and relocateNonAlloc, making it slower. -r performance is less important than executable/shared, so I think if there is no better choice (readability/performance trade-off) paying the cost if fine, but I wonder whether we can do something better.

As `copyRelocations()` already detects the case, it could store some information for `relocateNonAllocForRelocatable()` so that the latter apply tombstone values. But that looked more complicated than the taken way, and I agree with you that the performance of `-r` is not that important to sacrifice readability.

> Unrelated to this patch, I have the question whether we can make relocateNonAlloc faster for executable/shared.

As for now, I do not see obvious ways to improve.


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

https://reviews.llvm.org/D116946

Files:
  lld/ELF/InputSection.cpp
  lld/test/ELF/debug-dead-reloc-relocatable.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116946.398895.patch
Type: text/x-patch
Size: 5539 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220111/cf19765d/attachment.bin>


More information about the llvm-commits mailing list