From 14144f39e4581f4f39bcd44c2f8336fee28b0220 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 18 Jan 2008 23:26:48 +0000 Subject: Don't include options.h in fileread.h. Remove General_options reference from Output_file class. --- gold/compressed_output.cc | 1 + gold/dynobj.cc | 2 ++ gold/fileread.cc | 14 ++++++++++++++ gold/fileread.h | 9 ++++----- gold/layout.cc | 4 ++-- gold/output.cc | 8 +++----- gold/output.h | 12 +----------- 7 files changed, 27 insertions(+), 23 deletions(-) (limited to 'gold') diff --git a/gold/compressed_output.cc b/gold/compressed_output.cc index d12bfda..6904077 100644 --- a/gold/compressed_output.cc +++ b/gold/compressed_output.cc @@ -27,6 +27,7 @@ #endif #include "parameters.h" +#include "options.h" #include "compressed_output.h" namespace gold diff --git a/gold/dynobj.cc b/gold/dynobj.cc index 90abbe7..78594a9 100644 --- a/gold/dynobj.cc +++ b/gold/dynobj.cc @@ -27,6 +27,8 @@ #include "elfcpp.h" #include "parameters.h" +#include "options.h" +#include "script.h" #include "symtab.h" #include "dynobj.h" diff --git a/gold/fileread.cc b/gold/fileread.cc index ac96f5f..668151a 100644 --- a/gold/fileread.cc +++ b/gold/fileread.cc @@ -581,6 +581,20 @@ Input_file::Input_file(const Task* task, const char* name, gold_assert(ok); } +// Return the position dependent options in force for this file. + +const Position_dependent_options& +Input_file::options() const +{ + return this->input_argument_->options(); +} + +// Return the name given by the user. For -lc this will return "c". + +const char* +Input_file::name() const +{ return this->input_argument_->name(); } + // Open the file. // If the filename is not absolute, we assume it is in the current diff --git a/gold/fileread.h b/gold/fileread.h index 428c2f0..d430876 100644 --- a/gold/fileread.h +++ b/gold/fileread.h @@ -29,12 +29,13 @@ #include #include -#include "options.h" #include "token.h" namespace gold { +class Position_dependent_options; +class Input_file_argument; class Dirsearch; class File_view; @@ -383,8 +384,7 @@ class Input_file // Return the name given by the user. For -lc this will return "c". const char* - name() const - { return this->input_argument_->name(); } + name() const; // Return the file name. For -lc this will return something like // "/usr/lib/libc.so". @@ -401,8 +401,7 @@ class Input_file // Return the position dependent options. const Position_dependent_options& - options() const - { return this->input_argument_->options(); } + options() const; // Return the file. File_read& diff --git a/gold/layout.cc b/gold/layout.cc index 63fd2b8..9f4c922 100644 --- a/gold/layout.cc +++ b/gold/layout.cc @@ -28,6 +28,7 @@ #include #include "parameters.h" +#include "options.h" #include "output.h" #include "symtab.h" #include "dynobj.h" @@ -52,8 +53,7 @@ Layout_task_runner::run(Workqueue* workqueue, const Task* task) // Now we know the final size of the output file and we know where // each piece of information goes. - Output_file* of = new Output_file(this->options_, - this->input_objects_->target()); + Output_file* of = new Output_file(parameters->output_file_name()); of->open(file_size); // Queue up the final set of tasks. diff --git a/gold/output.cc b/gold/output.cc index 4c6959e..1060de6 100644 --- a/gold/output.cc +++ b/gold/output.cc @@ -1861,7 +1861,7 @@ Output_section::do_write(Output_file* of) p != this->fills_.end(); ++p) { - std::string fill_data(of->target()->code_fill(p->length())); + std::string fill_data(parameters->target()->code_fill(p->length())); of->write(output_section_file_offset + p->section_offset(), fill_data.data(), fill_data.size()); } @@ -2372,10 +2372,8 @@ Output_segment::write_section_headers_list(const Layout* layout, // Output_file methods. -Output_file::Output_file(const General_options& options, Target* target) - : options_(options), - target_(target), - name_(options.output_file_name()), +Output_file::Output_file(const char* name) + : name_(name), o_(-1), file_size_(0), base_(NULL), diff --git a/gold/output.h b/gold/output.h index f384c8c..96c0247 100644 --- a/gold/output.h +++ b/gold/output.h @@ -2297,12 +2297,7 @@ class Output_segment class Output_file { public: - Output_file(const General_options& options, Target*); - - // Get a pointer to the target. - Target* - target() const - { return this->target_; } + Output_file(const char* name); // Open the output file. FILE_SIZE is the final size of the file. void @@ -2372,11 +2367,6 @@ class Output_file void unmap(); - - // General options. - const General_options& options_; - // Target. - Target* target_; // File name. const char* name_; // File descriptor. -- cgit v1.1