From f1ddb6008e405707f7025369cfd7ec0ba442d128 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 15 Jul 2011 21:43:08 +0000 Subject: * options.h (class General_options): Add --print-output-format. Move -EL next to -EB, for better --help output. * target-select.cc: Include , "options.h", and "parameters.h". (Target_selector::do_target_bfd_name): New function. (print_output_format): New function. * target-select.h (class Target_selector): Update declarations. (Target_selector::target_bfd_name): New function. (print_output_format): Declare. * main.cc: Include "target-select.h". (main): Handle --print-output-format. * gold.cc: Include "target-select.h". (queue_initial_tasks): Handle --print-output-format when there are no input files. * parameters.cc (parameters_force_valid_target): Give a better error message if -EB/-EL does not match target. * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New function. --- gold/target-select.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'gold/target-select.h') diff --git a/gold/target-select.h b/gold/target-select.h index e16afd2..310c0b9 100644 --- a/gold/target-select.h +++ b/gold/target-select.h @@ -140,6 +140,13 @@ class Target_selector emulation() const { return this->emulation_; } + // The reverse mapping, for --print-output-format: if we + // instantiated TARGET, return our BFD_NAME. If we did not + // instantiate it, return NULL. + const char* + target_bfd_name(const Target* target) + { return this->do_target_bfd_name(target); } + protected: // Return an instance of the real target. This must be implemented // by the child class. @@ -192,10 +199,19 @@ class Target_selector emulations->push_back(this->emulation_); } + // Map from target to BFD name. + virtual const char* + do_target_bfd_name(const Target*); + // Instantiate the target and return it. Target* instantiate_target(); + // Return whether TARGET is the target we instantiated. + bool + is_our_target(const Target* target) + { return target == this->instantiated_target_; } + private: // Set the target. void @@ -249,6 +265,11 @@ supported_target_names(std::vector*); extern void supported_emulation_names(std::vector*); +// Print the output format, for the --print-output-format option. + +extern void +print_output_format(); + } // End namespace gold. #endif // !defined(GOLD_TARGET_SELECT_H) -- cgit v1.1