Line 1... |
Line 1... |
// options.h -- handle command line options for gold -*- C++ -*-
|
// options.h -- handle command line options for gold -*- C++ -*-
|
|
|
// Copyright 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
|
// Copyright 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
|
// Written by Ian Lance Taylor <iant@google.com>.
|
// Written by Ian Lance Taylor <iant@google.com>.
|
|
|
// This file is part of gold.
|
// This file is part of gold.
|
|
|
// This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
Line 61... |
Line 61... |
|
|
// Incremental build action for a specific file, as selected by the user.
|
// Incremental build action for a specific file, as selected by the user.
|
|
|
enum Incremental_disposition
|
enum Incremental_disposition
|
{
|
{
|
|
// Startup files that appear before the first disposition option.
|
|
// These will default to INCREMENTAL_CHECK unless the
|
|
// --incremental-startup-unchanged option is given.
|
|
// (For files added implicitly by gcc before any user options.)
|
|
INCREMENTAL_STARTUP,
|
// Determine the status from the timestamp (default).
|
// Determine the status from the timestamp (default).
|
INCREMENTAL_CHECK,
|
INCREMENTAL_CHECK,
|
// Assume the file changed from the previous build.
|
// Assume the file changed from the previous build.
|
INCREMENTAL_CHANGED,
|
INCREMENTAL_CHANGED,
|
// Assume the file didn't change from the previous build.
|
// Assume the file didn't change from the previous build.
|
Line 96... |
Line 101... |
|
|
extern void
|
extern void
|
parse_double(const char* option_name, const char* arg, double* retval);
|
parse_double(const char* option_name, const char* arg, double* retval);
|
|
|
extern void
|
extern void
|
|
parse_percent(const char* option_name, const char* arg, double* retval);
|
|
|
|
extern void
|
parse_string(const char* option_name, const char* arg, const char** retval);
|
parse_string(const char* option_name, const char* arg, const char** retval);
|
|
|
extern void
|
extern void
|
parse_optional_string(const char* option_name, const char* arg,
|
parse_optional_string(const char* option_name, const char* arg,
|
const char** retval);
|
const char** retval);
|
Line 370... |
Line 378... |
helpstring__, helparg__) \
|
helpstring__, helparg__) \
|
DEFINE_var(varname__, dashes__, shortname__, default_value__, \
|
DEFINE_var(varname__, dashes__, shortname__, default_value__, \
|
#default_value__, helpstring__, helparg__, false, \
|
#default_value__, helpstring__, helparg__, false, \
|
double, double, options::parse_double)
|
double, double, options::parse_double)
|
|
|
|
#define DEFINE_percent(varname__, dashes__, shortname__, default_value__, \
|
|
helpstring__, helparg__) \
|
|
DEFINE_var(varname__, dashes__, shortname__, default_value__ / 100.0, \
|
|
#default_value__, helpstring__, helparg__, false, \
|
|
double, double, options::parse_percent)
|
|
|
#define DEFINE_string(varname__, dashes__, shortname__, default_value__, \
|
#define DEFINE_string(varname__, dashes__, shortname__, default_value__, \
|
helpstring__, helparg__) \
|
helpstring__, helparg__) \
|
DEFINE_var(varname__, dashes__, shortname__, default_value__, \
|
DEFINE_var(varname__, dashes__, shortname__, default_value__, \
|
default_value__, helpstring__, helparg__, false, \
|
default_value__, helpstring__, helparg__, false, \
|
const char*, const char*, options::parse_string)
|
const char*, const char*, options::parse_string)
|
Line 627... |
Line 641... |
DEFINE_bool_alias(dy, Bdynamic, options::ONE_DASH, '\0',
|
DEFINE_bool_alias(dy, Bdynamic, options::ONE_DASH, '\0',
|
N_("alias for -Bdynamic"), NULL, false);
|
N_("alias for -Bdynamic"), NULL, false);
|
DEFINE_bool_alias(dn, Bdynamic, options::ONE_DASH, '\0',
|
DEFINE_bool_alias(dn, Bdynamic, options::ONE_DASH, '\0',
|
N_("alias for -Bstatic"), NULL, true);
|
N_("alias for -Bstatic"), NULL, true);
|
|
|
|
DEFINE_bool(Bgroup, options::ONE_DASH, '\0', false,
|
|
N_("Use group name lookup rules for shared library"), NULL);
|
|
|
DEFINE_bool(Bsymbolic, options::ONE_DASH, '\0', false,
|
DEFINE_bool(Bsymbolic, options::ONE_DASH, '\0', false,
|
N_("Bind defined symbols locally"), NULL);
|
N_("Bind defined symbols locally"), NULL);
|
|
|
DEFINE_bool(Bsymbolic_functions, options::ONE_DASH, '\0', false,
|
DEFINE_bool(Bsymbolic_functions, options::ONE_DASH, '\0', false,
|
N_("Bind defined function symbols locally"), NULL);
|
N_("Bind defined function symbols locally"), NULL);
|
Line 661... |
Line 678... |
|
|
DEFINE_bool(cref, options::TWO_DASHES, '\0', false,
|
DEFINE_bool(cref, options::TWO_DASHES, '\0', false,
|
N_("Output cross reference table"),
|
N_("Output cross reference table"),
|
N_("Do not output cross reference table"));
|
N_("Do not output cross reference table"));
|
|
|
|
DEFINE_bool(ctors_in_init_array, options::TWO_DASHES, '\0', true,
|
|
N_("Use DT_INIT_ARRAY for all constructors (default)"),
|
|
N_("Handle constructors as directed by compiler"));
|
|
|
DEFINE_bool(define_common, options::TWO_DASHES, 'd', false,
|
DEFINE_bool(define_common, options::TWO_DASHES, 'd', false,
|
N_("Define common symbols"),
|
N_("Define common symbols"),
|
N_("Do not define common symbols"));
|
N_("Do not define common symbols"));
|
DEFINE_bool(dc, options::ONE_DASH, '\0', false,
|
DEFINE_bool(dc, options::ONE_DASH, '\0', false,
|
N_("Alias for -d"), NULL);
|
N_("Alias for -d"), NULL);
|
Line 719... |
Line 740... |
N_("Do not export all dynamic symbols (default)"));
|
N_("Do not export all dynamic symbols (default)"));
|
|
|
DEFINE_special(EB, options::ONE_DASH, '\0',
|
DEFINE_special(EB, options::ONE_DASH, '\0',
|
N_("Link big-endian objects."), NULL);
|
N_("Link big-endian objects."), NULL);
|
|
|
DEFINE_bool(eh_frame_hdr, options::TWO_DASHES, '\0', false,
|
|
N_("Create exception frame header"), NULL);
|
|
|
|
DEFINE_special(EL, options::ONE_DASH, '\0',
|
DEFINE_special(EL, options::ONE_DASH, '\0',
|
N_("Link little-endian objects."), NULL);
|
N_("Link little-endian objects."), NULL);
|
|
|
|
DEFINE_bool(eh_frame_hdr, options::TWO_DASHES, '\0', false,
|
|
N_("Create exception frame header"), NULL);
|
|
|
DEFINE_bool(enum_size_warning, options::TWO_DASHES, '\0', true, NULL,
|
DEFINE_bool(enum_size_warning, options::TWO_DASHES, '\0', true, NULL,
|
N_("(ARM only) Do not warn about objects with incompatible "
|
N_("(ARM only) Do not warn about objects with incompatible "
|
"enum sizes"));
|
"enum sizes"));
|
|
|
|
DEFINE_set(auxiliary, options::TWO_DASHES, 'f',
|
|
N_("Auxiliary filter for shared object symbol table"),
|
|
N_("SHLIB"));
|
|
|
|
DEFINE_string(filter, options::TWO_DASHES, 'F', NULL,
|
|
N_("Filter for shared object symbol table"),
|
|
N_("SHLIB"));
|
|
|
DEFINE_bool(fatal_warnings, options::TWO_DASHES, '\0', false,
|
DEFINE_bool(fatal_warnings, options::TWO_DASHES, '\0', false,
|
N_("Treat warnings as errors"),
|
N_("Treat warnings as errors"),
|
N_("Do not treat warnings as errors"));
|
N_("Do not treat warnings as errors"));
|
|
|
DEFINE_string(fini, options::ONE_DASH, '\0', "_fini",
|
DEFINE_string(fini, options::ONE_DASH, '\0', "_fini",
|
Line 799... |
Line 828... |
N_("Assume files didn't change"), NULL);
|
N_("Assume files didn't change"), NULL);
|
|
|
DEFINE_special(incremental_unknown, options::TWO_DASHES, '\0',
|
DEFINE_special(incremental_unknown, options::TWO_DASHES, '\0',
|
N_("Use timestamps to check files (default)"), NULL);
|
N_("Use timestamps to check files (default)"), NULL);
|
|
|
|
DEFINE_special(incremental_startup_unchanged, options::TWO_DASHES, '\0',
|
|
N_("Assume startup files unchanged "
|
|
"(files preceding this option)"), NULL);
|
|
|
|
DEFINE_percent(incremental_patch, options::TWO_DASHES, '\0', 10,
|
|
N_("Amount of extra space to allocate for patches"),
|
|
N_("PERCENT"));
|
|
|
DEFINE_string(init, options::ONE_DASH, '\0', "_init",
|
DEFINE_string(init, options::ONE_DASH, '\0', "_init",
|
N_("Call SYMBOL at load-time"), N_("SYMBOL"));
|
N_("Call SYMBOL at load-time"), N_("SYMBOL"));
|
|
|
DEFINE_special(just_symbols, options::TWO_DASHES, '\0',
|
DEFINE_special(just_symbols, options::TWO_DASHES, '\0',
|
N_("Read only symbol values from FILE"), N_("FILE"));
|
N_("Read only symbol values from FILE"), N_("FILE"));
|
Line 814... |
Line 851... |
"hosts)"));
|
"hosts)"));
|
DEFINE_bool(keep_files_mapped, options::TWO_DASHES, '\0', true,
|
DEFINE_bool(keep_files_mapped, options::TWO_DASHES, '\0', true,
|
N_("Keep files mapped across passes (default)"),
|
N_("Keep files mapped across passes (default)"),
|
N_("Release mapped files after each pass"));
|
N_("Release mapped files after each pass"));
|
|
|
|
DEFINE_bool(ld_generated_unwind_info, options::TWO_DASHES, '\0', true,
|
|
N_("Generate unwind information for PLT (default)"),
|
|
N_("Do not generate unwind information for PLT"));
|
|
|
DEFINE_special(library, options::TWO_DASHES, 'l',
|
DEFINE_special(library, options::TWO_DASHES, 'l',
|
N_("Search for library LIBNAME"), N_("LIBNAME"));
|
N_("Search for library LIBNAME"), N_("LIBNAME"));
|
|
|
DEFINE_dirlist(library_path, options::TWO_DASHES, 'L',
|
DEFINE_dirlist(library_path, options::TWO_DASHES, 'L',
|
N_("Add directory to search path"), N_("DIR"));
|
N_("Add directory to search path"), N_("DIR"));
|
Line 829... |
Line 870... |
DEFINE_bool(rosegment, options::TWO_DASHES, '\0', false,
|
DEFINE_bool(rosegment, options::TWO_DASHES, '\0', false,
|
N_(" Put read-only non-executable sections in their own segment"),
|
N_(" Put read-only non-executable sections in their own segment"),
|
NULL);
|
NULL);
|
|
|
DEFINE_string(m, options::EXACTLY_ONE_DASH, 'm', "",
|
DEFINE_string(m, options::EXACTLY_ONE_DASH, 'm', "",
|
N_("Ignored for compatibility"), N_("EMULATION"));
|
N_("Set GNU linker emulation; obsolete"), N_("EMULATION"));
|
|
|
DEFINE_bool(print_map, options::TWO_DASHES, 'M', false,
|
DEFINE_bool(print_map, options::TWO_DASHES, 'M', false,
|
N_("Write map file on standard output"), NULL);
|
N_("Write map file on standard output"), NULL);
|
DEFINE_string(Map, options::ONE_DASH, '\0', NULL, N_("Write map file"),
|
DEFINE_string(Map, options::ONE_DASH, '\0', NULL, N_("Write map file"),
|
N_("MAPFILENAME"));
|
N_("MAPFILENAME"));
|
Line 884... |
Line 925... |
#endif
|
#endif
|
|
|
DEFINE_bool(preread_archive_symbols, options::TWO_DASHES, '\0', false,
|
DEFINE_bool(preread_archive_symbols, options::TWO_DASHES, '\0', false,
|
N_("Preread archive symbols when multi-threaded"), NULL);
|
N_("Preread archive symbols when multi-threaded"), NULL);
|
|
|
|
DEFINE_bool(print_output_format, options::TWO_DASHES, '\0', false,
|
|
N_("Print default output format"), NULL);
|
|
|
DEFINE_string(print_symbol_counts, options::TWO_DASHES, '\0', NULL,
|
DEFINE_string(print_symbol_counts, options::TWO_DASHES, '\0', NULL,
|
N_("Print symbols defined and used for each input"),
|
N_("Print symbols defined and used for each input"),
|
N_("FILENAME"));
|
N_("FILENAME"));
|
|
|
DEFINE_bool(Qy, options::EXACTLY_ONE_DASH, '\0', false,
|
DEFINE_bool(Qy, options::EXACTLY_ONE_DASH, '\0', false,
|
Line 1029... |
Line 1073... |
N_("Set the address of the text segment"), N_("ADDRESS"));
|
N_("Set the address of the text segment"), N_("ADDRESS"));
|
|
|
DEFINE_set(undefined, options::TWO_DASHES, 'u',
|
DEFINE_set(undefined, options::TWO_DASHES, 'u',
|
N_("Create undefined reference to SYMBOL"), N_("SYMBOL"));
|
N_("Create undefined reference to SYMBOL"), N_("SYMBOL"));
|
|
|
|
DEFINE_enum(unresolved_symbols, options::TWO_DASHES, '\0', NULL,
|
|
N_("How to handle unresolved symbols"),
|
|
("ignore-all,report-all,ignore-in-object-files,"
|
|
"ignore-in-shared-libs"),
|
|
{"ignore-all", "report-all", "ignore-in-object-files",
|
|
"ignore-in-shared-libs"});
|
|
|
DEFINE_bool(verbose, options::TWO_DASHES, '\0', false,
|
DEFINE_bool(verbose, options::TWO_DASHES, '\0', false,
|
N_("Synonym for --debug=files"), NULL);
|
N_("Synonym for --debug=files"), NULL);
|
|
|
DEFINE_special(version_script, options::TWO_DASHES, '\0',
|
DEFINE_special(version_script, options::TWO_DASHES, '\0',
|
N_("Read version script"), N_("FILE"));
|
N_("Read version script"), N_("FILE"));
|
Line 1160... |
Line 1211... |
DEFINE_bool(relro, options::DASH_Z, '\0', false,
|
DEFINE_bool(relro, options::DASH_Z, '\0', false,
|
N_("Where possible mark variables read-only after relocation"),
|
N_("Where possible mark variables read-only after relocation"),
|
N_("Don't mark variables read-only after relocation"));
|
N_("Don't mark variables read-only after relocation"));
|
DEFINE_bool(text, options::DASH_Z, '\0', false,
|
DEFINE_bool(text, options::DASH_Z, '\0', false,
|
N_("Do not permit relocations in read-only segments"),
|
N_("Do not permit relocations in read-only segments"),
|
NULL);
|
N_("Permit relocations in read-only segments (default)"));
|
DEFINE_bool_alias(textoff, text, options::DASH_Z, '\0',
|
DEFINE_bool_alias(textoff, text, options::DASH_Z, '\0',
|
N_("Permit relocations in read-only segments (default)"),
|
N_("Permit relocations in read-only segments (default)"),
|
NULL, true);
|
NULL, true);
|
|
|
public:
|
public:
|
Line 1311... |
Line 1362... |
// value may change as we proceed parsing the command line flags.
|
// value may change as we proceed parsing the command line flags.
|
Incremental_disposition
|
Incremental_disposition
|
incremental_disposition() const
|
incremental_disposition() const
|
{ return this->incremental_disposition_; }
|
{ return this->incremental_disposition_; }
|
|
|
|
// The disposition to use for startup files (those that precede the
|
|
// first --incremental-changed, etc. option).
|
|
Incremental_disposition
|
|
incremental_startup_disposition() const
|
|
{ return this->incremental_startup_disposition_; }
|
|
|
// Return true if S is the name of a library excluded from automatic
|
// Return true if S is the name of a library excluded from automatic
|
// symbol export.
|
// symbol export.
|
bool
|
bool
|
check_excluded_libs(const std::string &s) const;
|
check_excluded_libs(const std::string &s) const;
|
|
|
Line 1428... |
Line 1485... |
Incremental_mode incremental_mode_;
|
Incremental_mode incremental_mode_;
|
// The disposition given by the --incremental-changed,
|
// The disposition given by the --incremental-changed,
|
// --incremental-unchanged or --incremental-unknown option. The
|
// --incremental-unchanged or --incremental-unknown option. The
|
// value may change as we proceed parsing the command line flags.
|
// value may change as we proceed parsing the command line flags.
|
Incremental_disposition incremental_disposition_;
|
Incremental_disposition incremental_disposition_;
|
|
// The disposition to use for startup files (those marked
|
|
// INCREMENTAL_STARTUP).
|
|
Incremental_disposition incremental_startup_disposition_;
|
// Whether we have seen one of the options that require incremental
|
// Whether we have seen one of the options that require incremental
|
// build (--incremental-changed, --incremental-unchanged or
|
// build (--incremental-changed, --incremental-unchanged,
|
// --incremental-unknown)
|
// --incremental-unknown, or --incremental-startup-unchanged).
|
bool implicit_incremental_;
|
bool implicit_incremental_;
|
// Libraries excluded from automatic export, via --exclude-libs.
|
// Libraries excluded from automatic export, via --exclude-libs.
|
Unordered_set<std::string> excluded_libs_;
|
Unordered_set<std::string> excluded_libs_;
|
// List of symbol-names to keep, via -retain-symbol-info.
|
// List of symbol-names to keep, via -retain-symbol-info.
|
Unordered_set<std::string> symbols_to_retain_;
|
Unordered_set<std::string> symbols_to_retain_;
|