Line 1... |
Line 1... |
// options.c -- handle command line options for gold
|
// options.c -- handle command line options for gold
|
|
|
// 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 168... |
Line 168... |
p != supported_names.end();
|
p != supported_names.end();
|
++p)
|
++p)
|
printf(" %s", *p);
|
printf(" %s", *p);
|
printf("\n");
|
printf("\n");
|
|
|
|
printf(_("%s: supported emulations:"), gold::program_name);
|
|
supported_names.clear();
|
|
gold::supported_emulation_names(&supported_names);
|
|
for (std::vector<const char*>::const_iterator p = supported_names.begin();
|
|
p != supported_names.end();
|
|
++p)
|
|
printf(" %s", *p);
|
|
printf("\n");
|
|
|
// REPORT_BUGS_TO is defined in bfd/bfdver.h.
|
// REPORT_BUGS_TO is defined in bfd/bfdver.h.
|
const char* report = REPORT_BUGS_TO;
|
const char* report = REPORT_BUGS_TO;
|
if (*report != '\0')
|
if (*report != '\0')
|
printf(_("Report bugs to %s\n"), report);
|
printf(_("Report bugs to %s\n"), report);
|
}
|
}
|
Line 224... |
Line 233... |
"(expected a floating point number): %s"),
|
"(expected a floating point number): %s"),
|
option_name, arg);
|
option_name, arg);
|
}
|
}
|
|
|
void
|
void
|
|
parse_percent(const char* option_name, const char* arg, double* retval)
|
|
{
|
|
char* endptr;
|
|
*retval = strtod(arg, &endptr) / 100.0;
|
|
if (*endptr != '\0')
|
|
gold_fatal(_("%s: invalid option value "
|
|
"(expected a floating point number): %s"),
|
|
option_name, arg);
|
|
}
|
|
|
|
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)
|
{
|
{
|
if (*arg == '\0')
|
if (*arg == '\0')
|
gold_fatal(_("%s: must take a non-empty argument"), option_name);
|
gold_fatal(_("%s: must take a non-empty argument"), option_name);
|
*retval = arg;
|
*retval = arg;
|
Line 298... |
Line 318... |
void
|
void
|
General_options::parse_V(const char*, const char*, Command_line*)
|
General_options::parse_V(const char*, const char*, Command_line*)
|
{
|
{
|
gold::print_version(true);
|
gold::print_version(true);
|
this->printed_version_ = true;
|
this->printed_version_ = true;
|
|
|
printf(_(" Supported targets:\n"));
|
printf(_(" Supported targets:\n"));
|
std::vector<const char*> supported_names;
|
std::vector<const char*> supported_names;
|
gold::supported_target_names(&supported_names);
|
gold::supported_target_names(&supported_names);
|
for (std::vector<const char*>::const_iterator p = supported_names.begin();
|
for (std::vector<const char*>::const_iterator p = supported_names.begin();
|
p != supported_names.end();
|
p != supported_names.end();
|
++p)
|
++p)
|
printf(" %s\n", *p);
|
printf(" %s\n", *p);
|
|
|
|
printf(_(" Supported emulations:\n"));
|
|
supported_names.clear();
|
|
gold::supported_emulation_names(&supported_names);
|
|
for (std::vector<const char*>::const_iterator p = supported_names.begin();
|
|
p != supported_names.end();
|
|
++p)
|
|
printf(" %s\n", *p);
|
}
|
}
|
|
|
void
|
void
|
General_options::parse_defsym(const char*, const char* arg,
|
General_options::parse_defsym(const char*, const char* arg,
|
Command_line* cmdline)
|
Command_line* cmdline)
|
Line 367... |
Line 396... |
this->implicit_incremental_ = true;
|
this->implicit_incremental_ = true;
|
this->incremental_disposition_ = INCREMENTAL_CHECK;
|
this->incremental_disposition_ = INCREMENTAL_CHECK;
|
}
|
}
|
|
|
void
|
void
|
|
General_options::parse_incremental_startup_unchanged(const char*, const char*,
|
|
Command_line*)
|
|
{
|
|
this->implicit_incremental_ = true;
|
|
this->incremental_startup_disposition_ = INCREMENTAL_UNCHANGED;
|
|
}
|
|
|
|
void
|
General_options::parse_library(const char*, const char* arg,
|
General_options::parse_library(const char*, const char* arg,
|
Command_line* cmdline)
|
Command_line* cmdline)
|
{
|
{
|
Input_file_argument::Input_file_type type;
|
Input_file_argument::Input_file_type type;
|
const char* name;
|
const char* name;
|
Line 879... |
Line 916... |
static_(false),
|
static_(false),
|
do_demangle_(false),
|
do_demangle_(false),
|
plugins_(NULL),
|
plugins_(NULL),
|
dynamic_list_(),
|
dynamic_list_(),
|
incremental_mode_(INCREMENTAL_OFF),
|
incremental_mode_(INCREMENTAL_OFF),
|
incremental_disposition_(INCREMENTAL_CHECK),
|
incremental_disposition_(INCREMENTAL_STARTUP),
|
|
incremental_startup_disposition_(INCREMENTAL_CHECK),
|
implicit_incremental_(false),
|
implicit_incremental_(false),
|
excluded_libs_(),
|
excluded_libs_(),
|
symbols_to_retain_(),
|
symbols_to_retain_(),
|
section_starts_(),
|
section_starts_(),
|
fix_v4bx_(FIX_V4BX_NONE),
|
fix_v4bx_(FIX_V4BX_NONE),
|
Line 1128... |
Line 1166... |
this->symbols_to_retain_.insert(line);
|
this->symbols_to_retain_.insert(line);
|
std::getline(in, line);
|
std::getline(in, line);
|
}
|
}
|
}
|
}
|
|
|
|
// -Bgroup implies --unresolved-symbols=report-all.
|
|
if (this->Bgroup() && !this->user_set_unresolved_symbols())
|
|
this->set_unresolved_symbols("report-all");
|
|
|
|
// -shared implies --allow-shlib-undefined. Currently
|
|
// ---allow-shlib-undefined controls warnings issued based on the
|
|
// -symbol table. --unresolved-symbols controls warnings issued
|
|
// -based on relocations.
|
if (this->shared() && !this->user_set_allow_shlib_undefined())
|
if (this->shared() && !this->user_set_allow_shlib_undefined())
|
this->set_allow_shlib_undefined(true);
|
this->set_allow_shlib_undefined(true);
|
|
|
// Normalize library_path() by adding the sysroot to all directories
|
// Normalize library_path() by adding the sysroot to all directories
|
// in the path, as appropriate.
|
// in the path, as appropriate.
|
Line 1146... |
Line 1192... |
if (this->shared() && this->relocatable())
|
if (this->shared() && this->relocatable())
|
gold_fatal(_("-shared and -r are incompatible"));
|
gold_fatal(_("-shared and -r are incompatible"));
|
if (this->pie() && this->relocatable())
|
if (this->pie() && this->relocatable())
|
gold_fatal(_("-pie and -r are incompatible"));
|
gold_fatal(_("-pie and -r are incompatible"));
|
|
|
|
if (!this->shared())
|
|
{
|
|
if (this->filter() != NULL)
|
|
gold_fatal(_("-F/--filter may not used without -shared"));
|
|
if (this->any_auxiliary())
|
|
gold_fatal(_("-f/--auxiliary may not be used without -shared"));
|
|
}
|
|
|
// TODO: implement support for -retain-symbols-file with -r, if needed.
|
// TODO: implement support for -retain-symbols-file with -r, if needed.
|
if (this->relocatable() && this->retain_symbols_file())
|
if (this->relocatable() && this->retain_symbols_file())
|
gold_fatal(_("-retain-symbols-file does not yet work with -r"));
|
gold_fatal(_("-retain-symbols-file does not yet work with -r"));
|
|
|
if (this->oformat_enum() != General_options::OBJECT_FORMAT_ELF
|
if (this->oformat_enum() != General_options::OBJECT_FORMAT_ELF
|