summaryrefslogtreecommitdiff
path: root/lld/docs
diff options
context:
space:
mode:
authorVincent Lee <leevince@fb.com>2022-09-27 23:42:47 -0700
committerVincent Lee <leevince@fb.com>2022-09-30 15:09:27 -0700
commit58edaef3fe08b81d9e3c172dd38338508be7ac79 (patch)
treea78674264ed0f8caf4f3ccd07d31f8f917ecfb2a /lld/docs
parente898be2f6edbb886af2f6b23e2f5db5210535620 (diff)
downloadllvm-58edaef3fe08b81d9e3c172dd38338508be7ac79.tar.gz
[lld-macho] Do not error out on dead stripped duplicate symbols
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. In order to provide an easier to path for adoption, introduce a new flag that will retain compatibility with ld64's behavior (similar to `--deduplicate-literals`). This is turned off by default since we do not encourage this behavior in the linker. Reviewed By: #lld-macho, thakis, int3 Differential Revision: https://reviews.llvm.org/D134794
Diffstat (limited to 'lld/docs')
-rw-r--r--lld/docs/MachO/ld64-vs-lld.rst9
1 files changed, 9 insertions, 0 deletions
diff --git a/lld/docs/MachO/ld64-vs-lld.rst b/lld/docs/MachO/ld64-vs-lld.rst
index f571e6a62b36..6ee48715b2ec 100644
--- a/lld/docs/MachO/ld64-vs-lld.rst
+++ b/lld/docs/MachO/ld64-vs-lld.rst
@@ -14,6 +14,15 @@ some programs which have (incorrectly) relied on string deduplication always
occurring. In particular, programs which compare string literals via pointer
equality must be fixed to use value equality instead.
+Dead Stripping Duplicate Symbols
+********************************
+ld64 strips dead code before reporting duplicate symbols. By default, LLD does
+the opposite. ld64's behavior hides ODR violations, so we have chosen not
+to follow it. But, to make adoption easy, LLD can mimic this behavior via
+the ``--dead-strip-duplicates`` flag. Usage of this flag is discouraged, and
+this behavior should be fixed in the source. However, for sources that are not
+within the user's control, this will mitigate users for adoption.
+
``-no_deduplicate`` Flag
************************
- ld64: This turns off ICF (deduplication pass) in the linker.