[PATCH] D140606: [lld-macho] Only fold private-label aliases that do not have flags

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 22 21:14:03 PST 2022


int3 created this revision.
int3 added a reviewer: lld-macho.
Herald added subscribers: jeroen.dobbelaere, kristof.beyls.
Herald added projects: lld-macho, All.
int3 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This will enable us to re-land D139069: [lld-macho] Private label aliases to weak symbols should not retain section data <https://reviews.llvm.org/D139069>.

The issue with the original diff was that we were folding all
private-label symbols. We were not merging the symbol flags during this
folding; instead we just made all references to the folded symbol point
to its aliasee. This caused some flags to be incorrectly discarded. This
surfaced as code that was incorrectly stripped due to LLD dropping the
`.no_dead_strip` flag.

This diff fixes things by only folding flag-less private-label aliases.
Most (maybe all) of the `ltmp<N>` symbols that are generated by the MC
aarch64 backend are flag-less, so this conservative folding behavior
does the job.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D140606

Files:
  lld/MachO/InputFiles.cpp
  lld/test/MachO/weak-def-alias-private-label.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140606.485035.patch
Type: text/x-patch
Size: 5339 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221223/1bf91a85/attachment.bin>


More information about the llvm-commits mailing list