[lld] [lld-macho][arm64] Enhance safe ICF with thunk-based deduplication (PR #106573)

Pengying Xu via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 16 00:32:46 PST 2025


Colibrow wrote:

@alx32 Does the options.td need to be more clear?
```
diff --git a/lld/MachO/Options.td b/lld/MachO/Options.td
index 4b1e9e439107..bc2a8d18f14b 100644
--- a/lld/MachO/Options.td
+++ b/lld/MachO/Options.td
@@ -83,7 +83,7 @@ def print_dylib_search: Flag<["--"], "print-dylib-search">,
     Group<grp_lld>;
 def icf_eq: Joined<["--"], "icf=">,
     HelpText<"Set level for identical code folding (default: none)">,
-    MetaVarName<"[none,safe,all]">,
+    MetaVarName<"[none,safe,safe_thunks,all]">,
     Group<grp_lld>;
 def keep_icf_stabs: Joined<["--"], "keep-icf-stabs">,
     HelpText<"Generate STABS entries for symbols folded by ICF. These entries can then be used by dsymutil to discover the address range where folded symbols are located.">,
```
I plan to port this into ELF and test it on some projects to evaluate the code size improvements. Does this approach sound reasonable?

If so, I will draft a proposal for the LLVM discussion group and prepare a PR for the ELF-specific changes.
@ellishg cc


https://github.com/llvm/llvm-project/pull/106573


More information about the llvm-commits mailing list