5 This doc lists all significant deliberate differences in behavior between ld64
8 Dead Stripping Duplicate Symbols
9 ********************************
10 ld64 strips dead code before reporting duplicate symbols. By default, LLD does
11 the opposite. ld64's behavior hides ODR violations, so we have chosen not
12 to follow it. But, to make adoption easy, LLD can mimic this behavior via
13 the ``--dead-strip-duplicates`` flag. Usage of this flag is discouraged, and
14 this behavior should be fixed in the source. However, for sources that are not
15 within the user's control, this will mitigate users for adoption.
17 ``-no_deduplicate`` Flag
18 ************************
19 - ld64: This turns off ICF (deduplication pass) in the linker.
20 - LLD: This turns off ICF and string merging in the linker.
24 LLD is `slightly less conservative about aligning cstrings
25 <https://reviews.llvm.org/D121342>`_, allowing it to pack them more compactly.
26 This should not result in any meaningful semantic difference.
28 ObjC Symbols Treatment
29 **********************
30 There are differences in how LLD and ld64 handle ObjC symbols loaded from
34 1. Duplicate ObjC symbols from the same archives will not raise an error.
35 ld64 will pick the first one.
36 2. Duplicate ObjC symbols from different archives will raise a "duplicate
38 - LLD: Duplicate symbols, regardless of which archives they are from, will
43 ld64 treats all aliases as strong extern definitions. Having two aliases of the
44 same name, or an alias plus a regular extern symbol of the same name, both
45 result in duplicate symbol errors. LLD does not check for duplicate aliases;
46 instead we perform alias resolution first, and only then do we check for
47 duplicate symbols. In particular, we will not report a duplicate symbol error if
48 the aliased symbols turn out to be weak definitions, but ld64 will.
50 ``ZERO_AR_DATE`` enabled by default
51 ***********************************
52 ld64 has a special mode where it sets some stabs modification times to 0 for
53 hermetic builds, enabled by setting any value for the ``ZERO_AR_DATE``
54 environment variable. LLD flips this default to prefer hermetic builds, but
55 allows disabling this behavior by setting ``ZERO_AR_DATE=0``. Any other value
56 of ``ZERO_AR_DATE`` will be ignored.