include "llvm/Option/OptParser.td" multiclass BB { def NAME: Flag<["--"], name>, HelpText; def no_ # NAME: Flag<["--"], "no-" # name>, HelpText; } // Flags that lld/MachO understands but ld64 doesn't. These take // '--' instead of '-' and use dashes instead of underscores, so // they don't collide with the ld64 compat options. def grp_lld : OptionGroup<"kind">, HelpText<"LLD-SPECIFIC">; def help : Flag<["-", "--"], "help">, Group; def help_hidden : Flag<["--"], "help-hidden">, HelpText<"Display help for hidden options">, Group; def verbose : Flag<["--"], "verbose">, Group; def error_limit_eq : Joined<["--"], "error-limit=">, HelpText<"Maximum number of errors to print before exiting (default: 20)">, Group; def color_diagnostics: Flag<["--"], "color-diagnostics">, HelpText<"Alias for --color-diagnostics=always">, Group; def no_color_diagnostics: Flag<["--"], "no-color-diagnostics">, HelpText<"Alias for --color-diagnostics=never">, Group; def color_diagnostics_eq: Joined<["--"], "color-diagnostics=">, HelpText<"Use colors in diagnostics (default: auto)">, MetaVarName<"[auto,always,never]">, Group; def threads_eq : Joined<["--"], "threads=">, HelpText<"Number of threads. '1' disables multi-threading. By default all available hardware threads are used">, Group; def thinlto_emit_imports_files: Flag<["--"], "thinlto-emit-imports-files">, Group; def thinlto_emit_index_files: Flag<["--"], "thinlto-emit-index-files">, Group; def thinlto_index_only: Flag<["--"], "thinlto-index-only">, Group; def thinlto_index_only_eq: Joined<["--"], "thinlto-index-only=">, Group; def thinlto_jobs_eq : Joined<["--"], "thinlto-jobs=">, HelpText<"Number of ThinLTO jobs. Default to --threads=">, Group; def thinlto_object_suffix_replace_eq: Joined<["--"], "thinlto-object-suffix-replace=">, Group; def thinlto_prefix_replace_eq: Joined<["--"], "thinlto-prefix-replace=">, Group; def reproduce: Separate<["--"], "reproduce">, Group; def reproduce_eq: Joined<["--"], "reproduce=">, Alias(reproduce)>, HelpText<"Write tar file containing inputs and command to reproduce link">, Group; def version: Flag<["--"], "version">, HelpText<"Display the version number and exit">, Group; def time_trace_eq: Joined<["--"], "time-trace=">, HelpText<"Record time trace to ">, MetaVarName<"">, Group; def : Flag<["--"], "time-trace">, Alias, HelpText<"Record time trace to file next to output">, Group; def time_trace_granularity_eq: Joined<["--"], "time-trace-granularity=">, HelpText<"Minimum time granularity (in microseconds) traced by time profiler">, Group; def deduplicate_strings: Flag<["--"], "deduplicate-strings">, HelpText<"Enable string deduplication">, Group; def no_deduplicate_strings: Flag<["--"], "no-deduplicate-strings">, HelpText<"Disable string deduplication. This helps uncover cases of comparing string addresses instead of equality and might have a link time performance benefit.">, Group; def dead_strip_duplicates: Flag<["--"], "dead-strip-duplicates">, HelpText<"Do not error on duplicate symbols that will be dead stripped.">, Group; def print_dylib_search: Flag<["--"], "print-dylib-search">, HelpText<"Print which paths lld searched when trying to find dylibs">, Group; def icf_eq: Joined<["--"], "icf=">, HelpText<"Set level for identical code folding (default: none)">, MetaVarName<"[none,safe,all]">, Group; 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.">, Group; def lto_O: Joined<["--"], "lto-O">, HelpText<"Set optimization level for LTO (default: 2)">, MetaVarName<"">, Group; def lto_CGO: Joined<["--"], "lto-CGO">, HelpText<"Set codegen optimization level for LTO (default: 2)">, MetaVarName<"">, Group; def thinlto_cache_policy_eq: Joined<["--"], "thinlto-cache-policy=">, HelpText<"Pruning policy for the ThinLTO cache">, Group; def O : JoinedOrSeparate<["-"], "O">, HelpText<"Optimize output file size">; def start_lib: Flag<["--"], "start-lib">, HelpText<"Start a grouping of objects that should be treated as if they were together in an archive">; def end_lib: Flag<["--"], "end-lib">, HelpText<"End a grouping of objects that should be treated as if they were together in an archive">; def no_warn_dylib_install_name: Flag<["--"], "no-warn-dylib-install-name">, HelpText<"Do not warn on -install_name if -dylib is not passed (default)">, Group; def warn_dylib_install_name: Flag<["--"], "warn-dylib-install-name">, HelpText<"Warn on -install_name if -dylib is not passed">, Group; def warn_duplicate_rpath: Flag<["--"], "warn-duplicate-rpath">, HelpText<"Warn if the same -rpath is specified multiple times (default)">, Group; def no_warn_duplicate_rpath: Flag<["--"], "no-warn-duplicate-rpath">, HelpText<"Do not warn if the same -rpath is specified multiple times">, Group; def call_graph_profile_sort: Flag<["--"], "call-graph-profile-sort">, HelpText<"Reorder sections with call graph profile (default)">, Group; def no_call_graph_profile_sort : Flag<["--"], "no-call-graph-profile-sort">, HelpText<"Do not reorder sections with call graph profile">, Group; def print_symbol_order_eq: Joined<["--"], "print-symbol-order=">, HelpText<"Print a symbol order specified by --call-graph-profile-sort into the specified file">, Group; def ignore_auto_link_option : Separate<["--"], "ignore-auto-link-option">, Group; def ignore_auto_link_option_eq : Joined<["--"], "ignore-auto-link-option=">, Alias(ignore_auto_link_option)>, HelpText<"Ignore a single auto-linked library or framework. Useful to ignore invalid options that ld64 ignores">, Group; def strict_auto_link : Flag<["--"], "strict-auto-link">, HelpText<"Always warn for missing frameworks or libraries if they are loaded via LC_LINKER_OPTIONS">, Group; def check_category_conflicts : Flag<["--"], "check-category-conflicts">, HelpText<"Check for conflicts between category & class methods">, Group; def objc_category_merging : Flag<["-"], "objc_category_merging">, HelpText<"Merge Objective-C categories that share the same base class">, Group; def no_objc_category_merging : Flag<["-"], "no_objc_category_merging">, HelpText<"Do not merge Objective-C categories">, Group; def lto_debug_pass_manager: Flag<["--"], "lto-debug-pass-manager">, HelpText<"Debug new pass manager">, Group; def cs_profile_generate: Flag<["--"], "cs-profile-generate">, HelpText<"Perform context sensitive PGO instrumentation">, Group; def cs_profile_path: Joined<["--"], "cs-profile-path=">, HelpText<"Context sensitive profile file path">, Group; defm pgo_warn_mismatch: BB<"pgo-warn-mismatch", "turn on warnings about profile cfg mismatch (default)", "turn off warnings about profile cfg mismatch">, Group; defm warn_thin_archive_missing_members : BB<"warn-thin-archive-missing-members", "Warn on missing object files referenced by thin archives (default)", "Do not warn on missing object files referenced by thin archives">, Group; // This is a complete Options.td compiled from Apple's ld(1) manpage // dated 2018-03-07 and cross checked with ld64 source code in repo // https://github.com/apple-opensource/ld64 at git tag "512.4" dated // 2018-03-18. // Flags<[HelpHidden]> marks options that are not yet ported to lld, // and serve as a scoreboard for annotating our progress toward // implementing ld64 options in lld. As you add implementions to // Driver.cpp, please remove the hidden flag here. def grp_kind : OptionGroup<"kind">, HelpText<"OUTPUT KIND">; def execute : Flag<["-"], "execute">, HelpText<"Produce a main executable (default)">, Group; def dylib : Flag<["-"], "dylib">, HelpText<"Produce a shared library">, Group; def bundle : Flag<["-"], "bundle">, HelpText<"Produce a bundle">, Group; def r : Flag<["-"], "r">, HelpText<"Merge multiple object files into one, retaining relocations">, Flags<[HelpHidden]>, Group; def dylinker : Flag<["-"], "dylinker">, HelpText<"Produce a dylinker only used when building dyld">, Flags<[HelpHidden]>, Group; def dynamic : Flag<["-"], "dynamic">, HelpText<"Link dynamically (default)">, Group; def static : Flag<["-"], "static">, HelpText<"Link statically">, Flags<[HelpHidden]>, Group; def preload : Flag<["-"], "preload">, HelpText<"Produce an unsegmented binary for embedded systems">, Flags<[HelpHidden]>, Group; def arch : Separate<["-"], "arch">, MetaVarName<"">, HelpText<"The architecture (e.g. ppc, ppc64, i386, x86_64)">, Group; def o : Separate<["-"], "o">, MetaVarName<"">, HelpText<"The name of the output file (default: `a.out')">, Group; def grp_libs : OptionGroup<"libs">, HelpText<"LIBRARIES">; def l : Joined<["-"], "l">, MetaVarName<"">, HelpText<"Search for lib.dylib or lib.a on the library search path">, Group; def weak_l : Joined<["-"], "weak-l">, MetaVarName<"">, HelpText<"Like -l, but mark library and its references as weak imports">, Group; def weak_library : Separate<["-"], "weak_library">, MetaVarName<"">, HelpText<"Like bare , but mark library and its references as weak imports">, Group; def needed_l : Joined<["-"], "needed-l">, MetaVarName<"">, HelpText<"Like -l, but link library even if its symbols are not used and -dead_strip_dylibs is active">, Group; def needed_library : Separate<["-"], "needed_library">, MetaVarName<"">, HelpText<"Like bare , but link library even if its symbols are not used and -dead_strip_dylibs is active">, Group; def reexport_l : Joined<["-"], "reexport-l">, MetaVarName<"">, HelpText<"Like -l, but export all symbols of from newly created library">, Group; def reexport_library : Separate<["-"], "reexport_library">, MetaVarName<"">, HelpText<"Like bare , but export all symbols of from newly created library">, Group; def upward_l : Joined<["-"], "upward-l">, MetaVarName<"">, HelpText<"Like -l, but specify dylib as an upward dependency">, Flags<[HelpHidden]>, Group; def upward_library : Separate<["-"], "upward_library">, MetaVarName<"">, HelpText<"Like bare , but specify dylib as an upward dependency">, Flags<[HelpHidden]>, Group; def L : JoinedOrSeparate<["-"], "L">, MetaVarName<"">, HelpText<"Add dir to the library search path">, Group; def Z : Flag<["-"], "Z">, HelpText<"Remove standard directories from the library and framework search paths">, Group; def syslibroot : Separate<["-"], "syslibroot">, MetaVarName<"">, HelpText<"Prepend to all library and framework search paths">, Group; def search_paths_first : Flag<["-"], "search_paths_first">, HelpText<"Search for lib.dylib and lib.a at each step in traversing search path (default for Xcode 4 and later)">, Group; def search_dylibs_first : Flag<["-"], "search_dylibs_first">, HelpText<"Search for lib.dylib on first pass, then for lib.a on second pass through search path (default for Xcode 3 and earlier)">, Group; def framework : Separate<["-"], "framework">, MetaVarName<"">, HelpText<"Search for .framework/ on the framework search path">, Group; def weak_framework : Separate<["-"], "weak_framework">, MetaVarName<"">, HelpText<"Like -framework , but mark framework and its references as weak imports">, Group; def needed_framework : Separate<["-"], "needed_framework">, MetaVarName<"">, HelpText<"Like -framework , but link even if none of its symbols are used and -dead_strip_dylibs is active">, Group; def reexport_framework : Separate<["-"], "reexport_framework">, MetaVarName<"">, HelpText<"Like -framework , but export all symbols of from the newly created library">, Group; def upward_framework : Separate<["-"], "upward_framework">, MetaVarName<"">, HelpText<"Like -framework , but specify the framework as an upward dependency">, Flags<[HelpHidden]>, Group; def F : JoinedOrSeparate<["-"], "F">, MetaVarName<"">, HelpText<"Add dir to the framework search path">, Group; def all_load : Flag<["-"], "all_load">, HelpText<"Load all members of all static archive libraries">, Group; def noall_load : Flag<["-"], "noall_load">, HelpText<"Don't load all static members from archives, this is the default, this negates -all_load">, Group; def ObjC : Flag<["-"], "ObjC">, HelpText<"Load all members of static archives that are an Objective-C class or category.">, Group; def force_load : Separate<["-"], "force_load">, MetaVarName<"">, HelpText<"Load all members static archive library at ">, Group; def force_load_swift_libs : Flag<["-"], "force_load_swift_libs">, HelpText<"Apply -force_load to libraries listed in LC_LINKER_OPTIONS whose names start with 'swift'">, Group; def load_hidden : Separate<["-"], "load_hidden">, MetaVarName<"">, HelpText<"Load all symbols from static library with hidden visibility">, Group; def hidden_l : Joined<["-"], "hidden-l">, MetaVarName<"">, HelpText<"Like -l, but load all symbols with hidden visibility">, Group; def grp_content : OptionGroup<"content">, HelpText<"ADDITIONAL CONTENT">; def sectcreate : MultiArg<["-"], "sectcreate", 3>, MetaVarName<"
">, HelpText<"Create
in from the contents of ">, Group; def segcreate : MultiArg<["-"], "segcreate", 3>, MetaVarName<"
">, Alias, HelpText<"Alias for -sectcreate">, Group; def add_empty_section : MultiArg<["-"], "add_empty_section", 2>, MetaVarName<"
">, HelpText<"Create an empty
in ">, Group; def filelist : Separate<["-"], "filelist">, MetaVarName<"">, HelpText<"Read names of files to link from ">, Group; def dtrace : Separate<["-"], "dtrace">, MetaVarName<"