[PATCH] D134794: [lld-macho] Do not error out on dead stripped duplicate symbols

Vincent Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 28 00:08:20 PDT 2022


thevinster created this revision.
Herald added projects: lld-macho, All.
Herald added a reviewer: lld-macho.
thevinster edited the summary of this revision.
thevinster published this revision for review.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Builds that error out on duplicate symbols can still succeed if the symbols
will be dead stripped. Currently, this is the current behavior in ld64.
https://github.com/apple-oss-distributions/ld64/blob/main/src/ld/Resolver.cpp#L2018.
While it's strange for a linker to require `-dead_strip` in order for a link to succeed,
it's far better to align with ld64's behavior to be closer as a drop-in replacement. 
Move the duplicate symbol check after mark live so we can use this information to 
determine whether we should error on the specified duplicate symbol.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134794

Files:
  lld/MachO/SymbolTable.cpp
  lld/MachO/SymbolTable.h
  lld/MachO/Writer.cpp
  lld/test/MachO/abs-duplicate.s
  lld/test/MachO/dead-strip.s
  lld/test/MachO/invalid/abs-duplicate.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134794.463444.patch
Type: text/x-patch
Size: 6696 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220928/6228eef6/attachment.bin>


More information about the llvm-commits mailing list