diff options
author | Ian Lance Taylor <ian@airs.com> | 2009-06-23 06:39:47 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 2009-06-23 06:39:47 +0000 |
commit | e6a307bae3aac48d98d01f51308e238aeabbdfd4 (patch) | |
tree | 757dcf3896fda91c7ffc280de3add37f3ca7eb41 /gold/options.cc | |
parent | * script-sections.cc (Script_sections::create_segments): Don't put (diff) | |
download | binutils-gdb-e6a307bae3aac48d98d01f51308e238aeabbdfd4.tar.gz binutils-gdb-e6a307bae3aac48d98d01f51308e238aeabbdfd4.tar.bz2 binutils-gdb-e6a307bae3aac48d98d01f51308e238aeabbdfd4.zip |
PR 10030
* yyscript.y: Parse TARGET.
* script.cc (script_set_target): New function.
* script-c.h (script_set_target): Declare.
* options.cc (General_options::string_to_object_format): Rename
from string_to_object_format in anonymous namespace. Change
callers.
* options.h (class General_options): Declare
string_to_object_format.
Diffstat (limited to 'gold/options.cc')
-rw-r--r-- | gold/options.cc | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/gold/options.cc b/gold/options.cc index 0844d53ed60..ef2aa7163f0 100644 --- a/gold/options.cc +++ b/gold/options.cc @@ -466,6 +466,29 @@ General_options::check_excluded_libs (const std::string &name) const return false; } +// Recognize input and output target names. The GNU linker accepts +// these with --format and --oformat. This code is intended to be +// minimally compatible. In practice for an ELF target this would be +// the same target as the input files; that name always start with +// "elf". Non-ELF targets would be "srec", "symbolsrec", "tekhex", +// "binary", "ihex". + +General_options::Object_format +General_options::string_to_object_format(const char* arg) +{ + if (strncmp(arg, "elf", 3) == 0) + return gold::General_options::OBJECT_FORMAT_ELF; + else if (strcmp(arg, "binary") == 0) + return gold::General_options::OBJECT_FORMAT_BINARY; + else + { + gold::gold_error(_("format '%s' not supported; treating as elf " + "(supported formats: elf, binary)"), + arg); + return gold::General_options::OBJECT_FORMAT_ELF; + } +} + } // End namespace gold. namespace @@ -489,29 +512,6 @@ usage(const char* msg, const char *opt) usage(); } -// Recognize input and output target names. The GNU linker accepts -// these with --format and --oformat. This code is intended to be -// minimally compatible. In practice for an ELF target this would be -// the same target as the input files; that name always start with -// "elf". Non-ELF targets would be "srec", "symbolsrec", "tekhex", -// "binary", "ihex". - -gold::General_options::Object_format -string_to_object_format(const char* arg) -{ - if (strncmp(arg, "elf", 3) == 0) - return gold::General_options::OBJECT_FORMAT_ELF; - else if (strcmp(arg, "binary") == 0) - return gold::General_options::OBJECT_FORMAT_BINARY; - else - { - gold::gold_error(_("format '%s' not supported; treating as elf " - "(supported formats: elf, binary)"), - arg); - return gold::General_options::OBJECT_FORMAT_ELF; - } -} - // If the default sysroot is relocatable, try relocating it based on // the prefix FROM. @@ -717,13 +717,13 @@ General_options::General_options() General_options::Object_format General_options::format_enum() const { - return string_to_object_format(this->format()); + return General_options::string_to_object_format(this->format()); } General_options::Object_format General_options::oformat_enum() const { - return string_to_object_format(this->oformat()); + return General_options::string_to_object_format(this->oformat()); } // Add the sysroot, if any, to the search paths. |