[lld] 1c3c655 - [lld-macho] Document '-icf' flag options (#123372)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 17 10:48:36 PST 2025


Author: alx32
Date: 2025-01-17T10:48:32-08:00
New Revision: 1c3c65590d1635ab1b50c89dc8379c42a5d535bd

URL: https://github.com/llvm/llvm-project/commit/1c3c65590d1635ab1b50c89dc8379c42a5d535bd
DIFF: https://github.com/llvm/llvm-project/commit/1c3c65590d1635ab1b50c89dc8379c42a5d535bd.diff

LOG: [lld-macho] Document '-icf' flag options (#123372)

Adding the `safe_thunks` option in `Options.td` as it was missing there
- mentioned by @Colibrow in
https://github.com/llvm/llvm-project/pull/106573
Also documenting what the various options mean. 

Help now looks like this:
```
..........
  --error-limit=<value>   Maximum number of errors to print before exiting (default: 20)
  --help-hidden           Display help for hidden options
  --icf=[none,safe,safe_thunks,all]
                          Set level for identical code folding (default: none). Possible values:
                            none        - Disable ICF
                            safe        - Only folds non-address significant functions (as described by `__addrsig` section)
                            safe_thunks - Like safe, but replaces address-significant functions with thunks
                            all         - Fold all identical functions
  --ignore-auto-link-option=<value>
                          Ignore a single auto-linked library or framework. Useful to ignore invalid options that ld64 ignores
  --irpgo-profile-sort=<profile>
                          Deprecated. Please use --irpgo-profile and --bp-startup-sort=function
..........
```

Added: 
    

Modified: 
    lld/MachO/Options.td

Removed: 
    


################################################################################
diff  --git a/lld/MachO/Options.td b/lld/MachO/Options.td
index 4b1e9e4391070d..39191af7dc1692 100644
--- a/lld/MachO/Options.td
+++ b/lld/MachO/Options.td
@@ -82,8 +82,12 @@ def print_dylib_search: Flag<["--"], "print-dylib-search">,
     HelpText<"Print which paths lld searched when trying to find dylibs">,
     Group<grp_lld>;
 def icf_eq: Joined<["--"], "icf=">,
-    HelpText<"Set level for identical code folding (default: none)">,
-    MetaVarName<"[none,safe,all]">,
+    HelpText<"Set level for identical code folding (default: none). Possible values:\n"
+            "  none        - Disable ICF\n"
+            "  safe        - Only folds non-address significant functions (as described by `__addrsig` section)\n"
+            "  safe_thunks - Like safe, but replaces address-significant functions with thunks\n"
+            "  all         - Fold all identical functions">,
+    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.">,


        


More information about the llvm-commits mailing list