brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.3 KiB · 4e2f3f2 Raw
57 lines · plain
1=================2ld64 vs LLD-MachO3=================4 5This doc lists all significant deliberate differences in behavior between ld646and LLD-MachO.7 8Dead Stripping Duplicate Symbols9********************************10ld64 strips dead code before reporting duplicate symbols. By default, LLD does11the opposite. ld64's behavior hides ODR violations, so we have chosen not12to follow it. But, to make adoption easy, LLD can mimic this behavior via13the ``--dead-strip-duplicates`` flag. Usage of this flag is discouraged, and14this behavior should be fixed in the source. However, for sources that are not15within the user's control, this will mitigate users for adoption.16 17``-no_deduplicate`` Flag18************************19- ld64: This turns off ICF (deduplication pass) in the linker.20- LLD: This turns off ICF and string merging in the linker.21 22String Alignment23****************24LLD is `slightly less conservative about aligning cstrings25<https://reviews.llvm.org/D121342>`_, allowing it to pack them more compactly.26This should not result in any meaningful semantic difference.27 28ObjC Symbols Treatment29**********************30There are differences in how LLD and ld64 handle ObjC symbols loaded from31archives.32 33- ld64: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 "duplicate37      symbol" error.38- LLD: Duplicate symbols, regardless of which archives they are from, will39  raise errors.40 41Aliases42=======43ld64 treats all aliases as strong extern definitions. Having two aliases of the44same name, or an alias plus a regular extern symbol of the same name, both45result in duplicate symbol errors. LLD does not check for duplicate aliases;46instead we perform alias resolution first, and only then do we check for47duplicate symbols. In particular, we will not report a duplicate symbol error if48the aliased symbols turn out to be weak definitions, but ld64 will.49 50``ZERO_AR_DATE`` enabled by default51***********************************52ld64 has a special mode where it sets some stabs modification times to 0 for53hermetic builds, enabled by setting any value for the ``ZERO_AR_DATE``54environment variable. LLD flips this default to prefer hermetic builds, but55allows disabling this behavior by setting ``ZERO_AR_DATE=0``. Any other value56of ``ZERO_AR_DATE`` will be ignored.57