diff options
author | Ian Lance Taylor <ian@airs.com> | 2011-06-28 23:12:31 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 2011-06-28 23:12:31 +0000 |
commit | 03ef7571fc6524b38bfbb99ffdfa72418d03d02c (patch) | |
tree | db7978009cae555afe0e9bdb633d543f2e3c3664 /gold/target-select.cc | |
parent | 200b2bb9e8930d9d47fa5f378cf595328ee9c9bc (diff) | |
download | gdb-03ef7571fc6524b38bfbb99ffdfa72418d03d02c.zip gdb-03ef7571fc6524b38bfbb99ffdfa72418d03d02c.tar.gz gdb-03ef7571fc6524b38bfbb99ffdfa72418d03d02c.tar.bz2 |
PR gold/12934
* target-select.cc (Target_selector::Target_selector): Add
emulation parameter. Change all callers.
(select_target_by_bfd_name): Rename from select_target_by_name.
Change all callers.
(select_target_by_emulation): New function.
(supported_emulation_names): New function.
* target-select.h (class Target_selector): Add emulation_ field.
Update declarations.
(Target_selector::recognize_by_bfd_name): Rename from
recognize_by_name. Change all callers.
(Target_selector::supported_bfd_names): Rename from
supported_names. Change all callers.
(Target_selector::recognize_by_emulation): New function.
(Target_selector::supported_emulations): New function.
(Target_selector::emulation): New function.
(Target_selector::do_recognize_by_bfd_name): Rename from
do_recognize_by_name. Change all callers.
(Target_selector::do_supported_bfd_names): Rename from
do_supported_names. Change all callers.
(Target_selector::do_recognize_by_emulation): New function.
(Target_selector::do_supported_emulations): New function.
(select_target_by_bfd_name): Change name in declaration.
(select_target_by_emulation): Declare.
(supported_emulation_names): Declare.
* parameters.cc (parameters_force_valid_target): Try to find
target based on emulation from -m option.
* options.h (class General_options): Change doc string for -m.
* options.cc (help): Print emulations.
(General_options::parse_V): Likewise.
* freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
Add emulation parameter. Change all callers.
Diffstat (limited to 'gold/target-select.cc')
-rw-r--r-- | gold/target-select.cc | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/gold/target-select.cc b/gold/target-select.cc index 859bc3b..b8a9f40 100644 --- a/gold/target-select.cc +++ b/gold/target-select.cc @@ -1,6 +1,6 @@ // target-select.cc -- select a target for an object file -// 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>. // This file is part of gold. @@ -52,9 +52,10 @@ Set_target_once::do_run_once(void*) // fast. Target_selector::Target_selector(int machine, int size, bool is_big_endian, - const char* bfd_name) + const char* bfd_name, const char* emulation) : machine_(machine), size_(size), is_big_endian_(is_big_endian), - bfd_name_(bfd_name), instantiated_target_(NULL), set_target_once_(this) + bfd_name_(bfd_name), emulation_(emulation), instantiated_target_(NULL), + set_target_once_(this) { this->next_ = target_selectors; target_selectors = this; @@ -104,14 +105,33 @@ select_target(int machine, int size, bool is_big_endian, int osabi, // --oformat option. Target* -select_target_by_name(const char* name) +select_target_by_bfd_name(const char* name) { for (Target_selector* p = target_selectors; p != NULL; p = p->next()) { const char* pname = p->bfd_name(); if (pname == NULL || strcmp(pname, name) == 0) { - Target* ret = p->recognize_by_name(name); + Target* ret = p->recognize_by_bfd_name(name); + if (ret != NULL) + return ret; + } + } + return NULL; +} + +// Find a target using a GNU linker emulation. This is used to +// support the -m option. + +Target* +select_target_by_emulation(const char* name) +{ + for (Target_selector* p = target_selectors; p != NULL; p = p->next()) + { + const char* pname = p->emulation(); + if (pname == NULL || strcmp(pname, name) == 0) + { + Target* ret = p->recognize_by_emulation(name); if (ret != NULL) return ret; } @@ -125,7 +145,16 @@ void supported_target_names(std::vector<const char*>* names) { for (Target_selector* p = target_selectors; p != NULL; p = p->next()) - p->supported_names(names); + p->supported_bfd_names(names); +} + +// Push all the supported emulations onto a vector. + +void +supported_emulation_names(std::vector<const char*>* names) +{ + for (Target_selector* p = target_selectors; p != NULL; p = p->next()) + p->supported_emulations(names); } } // End namespace gold. |