[PATCH] D145455: [lld-macho] Coalesce local symbol aliases along with their aliased weak def

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 6 18:01:16 PST 2023


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

This supersedes D139069: [lld-macho] Private label aliases to weak symbols should not retain section data <https://reviews.llvm.org/D139069>. In some ways we are now closer to ld64's
behavior: we previously only did this coalescing for private-label
symbols, but now we do it for all locals, just like ld64. However, we no
longer generate weak binds when a local alias to a weak symbol is
referenced. This is merely for implementation simplicity; it's not clear
to me that any real-world programs depend on us emulating this behavior.

The problem with the previous approach is that we ended up with
duplicate references to the same symbol instance in our InputFiles,
which translated into duplicate symbols in our output. While we could
work around that problem by performing a dedup step before emitting the
symbol table, it seems cleaner to not generate duplicate references in
the first place.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D145455

Files:
  lld/MachO/InputFiles.cpp
  lld/MachO/SymbolTable.cpp
  lld/test/MachO/local-alias-to-weak.s
  lld/test/MachO/private-label-alias.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145455.502881.patch
Type: text/x-patch
Size: 10633 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230307/35fb4086/attachment-0001.bin>


More information about the llvm-commits mailing list