-// Helper macros used to specify the options. We could also do this
-// using constructors, but then g++ would generate code to initialize
-// the array. We want the array to be initialized statically so that
-// we get better startup time.
-
-#define GENERAL_NOARG(short_option, long_option, doc, help, dash, func) \
- { short_option, long_option, doc, help, options::One_option::dash, \
- NULL, func, NULL, NULL, NULL }
-#define GENERAL_ARG(short_option, long_option, doc, help, dash, func) \
- { short_option, long_option, doc, help, options::One_option::dash, \
- NULL, NULL, func, NULL, NULL }
-#define POSDEP_NOARG(short_option, long_option, doc, help, dash, func) \
- { short_option, long_option, doc, help, options::One_option::dash, \
- NULL, NULL, NULL, func, NULL }
-#define POSDEP_ARG(short_option, long_option, doc, help, dash, func) \
- { short_option, long_option, doc, help, options::One_option::dash, \
- NULL, NULL, NULL, NULL, func }
-#define SPECIAL(short_option, long_option, doc, help, dash, func) \
- { short_option, long_option, doc, help, options::One_option::dash, \
- func, NULL, NULL, NULL, NULL }
-
-// Here is the actual list of options which we accept.
-
-const options::One_option
-options::Command_line_options::options[] =
-{
- GENERAL_NOARG('\0', "allow-shlib-undefined",
- N_("Allow unresolved references in shared libraries"),
- NULL, TWO_DASHES,
- &General_options::set_allow_shlib_undefined),
- GENERAL_NOARG('\0', "no-allow-shlib-undefined",
- N_("Do not allow unresolved references in shared libraries"),
- NULL, TWO_DASHES,
- &General_options::set_no_allow_shlib_undefined),
- POSDEP_NOARG('\0', "as-needed",
- N_("Only set DT_NEEDED for dynamic libs if used"),
- NULL, TWO_DASHES, &Position_dependent_options::set_as_needed),
- POSDEP_NOARG('\0', "no-as-needed",
- N_("Always DT_NEEDED for dynamic libs (default)"),
- NULL, TWO_DASHES, &Position_dependent_options::clear_as_needed),
- POSDEP_NOARG('\0', "Bdynamic",
- N_("-l searches for shared libraries"),
- NULL, ONE_DASH,
- &Position_dependent_options::set_dynamic_search),
- POSDEP_NOARG('\0', "Bstatic",
- N_("-l does not search for shared libraries"),
- NULL, ONE_DASH,
- &Position_dependent_options::set_static_search),
- GENERAL_NOARG('\0', "Bsymbolic", N_("Bind defined symbols locally"),
- NULL, ONE_DASH, &General_options::set_symbolic),
- GENERAL_NOARG('\0', "demangle", N_("Demangle C++ symbols in log messages"),
- NULL, TWO_DASHES, &General_options::set_demangle),
- GENERAL_NOARG('\0', "no-demangle",
- N_("Do not demangle C++ symbols in log messages"),
- NULL, TWO_DASHES, &General_options::clear_demangle),
- GENERAL_NOARG('\0', "detect-odr-violations",
- N_("Try to detect violations of the One Definition Rule"),
- NULL, TWO_DASHES, &General_options::set_detect_odr_violations),
- GENERAL_NOARG('E', "export-dynamic", N_("Export all dynamic symbols"),
- NULL, TWO_DASHES, &General_options::set_export_dynamic),
- GENERAL_NOARG('\0', "eh-frame-hdr", N_("Create exception frame header"),
- NULL, TWO_DASHES, &General_options::set_create_eh_frame_hdr),
- GENERAL_ARG('I', "dynamic-linker", N_("Set dynamic linker path"),
- N_("-I PROGRAM, --dynamic-linker PROGRAM"), TWO_DASHES,
- &General_options::set_dynamic_linker),
- SPECIAL('l', "library", N_("Search for library LIBNAME"),
- N_("-lLIBNAME, --library LIBNAME"), TWO_DASHES,
- &library),
- GENERAL_ARG('L', "library-path", N_("Add directory to search path"),
- N_("-L DIR, --library-path DIR"), TWO_DASHES,
- &General_options::add_to_search_path),
- GENERAL_ARG('m', NULL, N_("Ignored for compatibility"), NULL, ONE_DASH,
- &General_options::ignore),
- GENERAL_ARG('o', "output", N_("Set output file name"),
- N_("-o FILE, --output FILE"), TWO_DASHES,
- &General_options::set_output_file_name),
- GENERAL_ARG('O', NULL, N_("Optimize output file size"),
- N_("-O level"), ONE_DASH,
- &General_options::set_optimization_level),
- GENERAL_NOARG('r', NULL, N_("Generate relocatable output"), NULL,
- ONE_DASH, &General_options::set_relocatable),
- GENERAL_ARG('R', "rpath", N_("Add DIR to runtime search path"),
- N_("-R DIR, -rpath DIR"), ONE_DASH,
- &General_options::add_to_rpath),
- GENERAL_ARG('\0', "rpath-link",
- N_("Add DIR to link time shared library search path"),
- N_("--rpath-link DIR"), TWO_DASHES,
- &General_options::add_to_rpath_link),
- GENERAL_NOARG('s', "strip-all", N_("Strip all symbols"), NULL,
- TWO_DASHES, &General_options::set_strip_all),
- GENERAL_NOARG('S', "strip-debug", N_("Strip debugging information"), NULL,
- TWO_DASHES, &General_options::set_strip_debug),
- GENERAL_NOARG('\0', "shared", N_("Generate shared library"),
- NULL, ONE_DASH, &General_options::set_shared),
- GENERAL_NOARG('\0', "static", N_("Do not link against shared libraries"),
- NULL, ONE_DASH, &General_options::set_static),
- GENERAL_NOARG('\0', "stats", N_("Print resource usage statistics"),
- NULL, TWO_DASHES, &General_options::set_stats),
- GENERAL_ARG('\0', "sysroot", N_("Set target system root directory"),
- N_("--sysroot DIR"), TWO_DASHES, &General_options::set_sysroot),
- GENERAL_ARG('\0', "Ttext", N_("Set the address of the .text section"),
- N_("-Ttext ADDRESS"), ONE_DASH,
- &General_options::set_text_segment_address),
- // This must come after -Ttext since it's a prefix of it.
- SPECIAL('T', "script", N_("Read linker script"),
- N_("-T FILE, --script FILE"), TWO_DASHES,
- &invoke_script),
- GENERAL_NOARG('\0', "threads", N_("Run the linker multi-threaded"),
- NULL, TWO_DASHES, &General_options::set_threads),
- GENERAL_NOARG('\0', "no-threads", N_("Do not run the linker multi-threaded"),
- NULL, TWO_DASHES, &General_options::clear_threads),
- GENERAL_ARG('\0', "thread-count", N_("Number of threads to use"),
- N_("--thread-count COUNT"), TWO_DASHES,
- &General_options::set_thread_count),
- GENERAL_ARG('\0', "thread-count-initial",
- N_("Number of threads to use in initial pass"),
- N_("--thread-count-initial COUNT"), TWO_DASHES,
- &General_options::set_thread_count_initial),
- GENERAL_ARG('\0', "thread-count-middle",
- N_("Number of threads to use in middle pass"),
- N_("--thread-count-middle COUNT"), TWO_DASHES,
- &General_options::set_thread_count_middle),
- GENERAL_ARG('\0', "thread-count-final",
- N_("Number of threads to use in final pass"),
- N_("--thread-count-final COUNT"), TWO_DASHES,
- &General_options::set_thread_count_final),
- POSDEP_NOARG('\0', "whole-archive",
- N_("Include all archive contents"),
- NULL, TWO_DASHES,
- &Position_dependent_options::set_whole_archive),
- POSDEP_NOARG('\0', "no-whole-archive",
- N_("Include only needed archive contents"),
- NULL, TWO_DASHES,
- &Position_dependent_options::clear_whole_archive),
-
- GENERAL_ARG('z', NULL,
- N_("Subcommands as follows:\n\
- -z execstack Mark output as requiring executable stack\n\
- -z noexecstack Mark output as not requiring executable stack"),
- N_("-z SUBCOMMAND"), ONE_DASH,
- &General_options::handle_z_option),
-
- SPECIAL('(', "start-group", N_("Start a library search group"), NULL,
- TWO_DASHES, &start_group),
- SPECIAL(')', "end-group", N_("End a library search group"), NULL,
- TWO_DASHES, &end_group),
- SPECIAL('\0', "help", N_("Report usage information"), NULL,
- TWO_DASHES, &help),
- SPECIAL('v', "version", N_("Report version information"), NULL,
- TWO_DASHES, &version)
-};
-
-const int options::Command_line_options::options_size =
- sizeof (options) / sizeof (options[0]);
-
-// The -z options.
-
-const options::One_z_option
-options::Command_line_options::z_options[] =
-{
- { "execstack", &General_options::set_execstack },
- { "noexecstack", &General_options::set_noexecstack },
-};
-
-const int options::Command_line_options::z_options_size =
- sizeof(z_options) / sizeof(z_options[0]);
-
-// The default values for the general options.
-