[PATCH] D136000: [lld-macho] Don't fold subsections with symbols at nonzero offsets

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 14 17:06:23 PDT 2022


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

Symbols occur at non-zero offsets in a subsection if they are
`.alt_entry` symbols, or if `.subsections_via_symbols` is omitted.

It doesn't seem like ld64 supports folding those subsections either.
Moreover, supporting this it makes `foldIdentical` a lot more
complicated to implement. The existing implementation has some
questionable behavior around STABS omission -- if a section with an
non-zero offset symbol was folded into one without, we would omit the
STABS entry for the non-zero offset symbol.

I will be following up with a diff that makes `foldIdentical` zero out
the symbol sizes for folded symbols. Again, this is much easier to
implement if we don't have to worry about non-zero offsets.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D136000

Files:
  lld/MachO/ICF.cpp
  lld/MachO/InputFiles.cpp
  lld/MachO/InputSection.cpp
  lld/MachO/InputSection.h
  lld/test/MachO/icf.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136000.467971.patch
Type: text/x-patch
Size: 5434 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221015/6efe85b8/attachment.bin>


More information about the llvm-commits mailing list