2021-09-25 09:39:30 +08:00
|
|
|
==================
|
|
|
|
LD64 vs LLD-MACHO
|
|
|
|
==================
|
|
|
|
|
|
|
|
This doc lists all significant deliberate differences in behavior between LD64 and LLD-MachO.
|
|
|
|
|
2022-01-20 08:30:52 +08:00
|
|
|
String literal deduplication
|
|
|
|
****************************
|
|
|
|
LD64 always deduplicates string literals. LLD only does it when the `--icf=` or
|
|
|
|
the `--deduplicate-literals` flag is passed. Omitting deduplication by default
|
|
|
|
ensures that our link is as fast as possible. However, it may also break some
|
|
|
|
programs which have (incorrectly) relied on string deduplication always
|
2022-01-20 15:59:12 +08:00
|
|
|
occurring. In particular, programs which compare string literals via pointer
|
2022-01-20 08:30:52 +08:00
|
|
|
equality must be fixed to use value equality instead.
|
|
|
|
|
2022-01-15 15:06:13 +08:00
|
|
|
``-no_deduplicate`` Flag
|
|
|
|
**********************
|
|
|
|
- LD64:
|
|
|
|
* This turns off ICF (deduplication pass) in the linker.
|
|
|
|
- LLD
|
|
|
|
* This turns off ICF and string merging in the linker.
|
|
|
|
|
2021-09-25 09:39:30 +08:00
|
|
|
ObjC symbols treatment
|
|
|
|
**********************
|
|
|
|
There are differences in how LLD and LD64 handle ObjC symbols loaded from archives.
|
|
|
|
|
|
|
|
- LD64:
|
2021-11-15 09:17:08 +08:00
|
|
|
* Duplicate ObjC symbols from the same archives will not raise an error. LD64 will pick the first one.
|
2021-09-25 09:39:30 +08:00
|
|
|
* Duplicate ObjC symbols from different archives will raise a "duplicate symbol" error.
|
|
|
|
- LLD:
|
|
|
|
* Duplicate symbols, regardless of which archives they are from, will raise errors.
|