Don't include options.h in fileread.h. Remove General_options

reference from Output_file class.
This commit is contained in:
Ian Lance Taylor
2008-01-18 23:26:48 +00:00
parent 6c0784b28f
commit 14144f39e4
7 changed files with 27 additions and 23 deletions

View File

@ -27,6 +27,7 @@
#endif #endif
#include "parameters.h" #include "parameters.h"
#include "options.h"
#include "compressed_output.h" #include "compressed_output.h"
namespace gold namespace gold

View File

@ -27,6 +27,8 @@
#include "elfcpp.h" #include "elfcpp.h"
#include "parameters.h" #include "parameters.h"
#include "options.h"
#include "script.h"
#include "symtab.h" #include "symtab.h"
#include "dynobj.h" #include "dynobj.h"

View File

@ -581,6 +581,20 @@ Input_file::Input_file(const Task* task, const char* name,
gold_assert(ok); 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. // Open the file.
// If the filename is not absolute, we assume it is in the current // If the filename is not absolute, we assume it is in the current

View File

@ -29,12 +29,13 @@
#include <map> #include <map>
#include <string> #include <string>
#include "options.h"
#include "token.h" #include "token.h"
namespace gold namespace gold
{ {
class Position_dependent_options;
class Input_file_argument;
class Dirsearch; class Dirsearch;
class File_view; class File_view;
@ -383,8 +384,7 @@ class Input_file
// Return the name given by the user. For -lc this will return "c". // Return the name given by the user. For -lc this will return "c".
const char* const char*
name() const name() const;
{ return this->input_argument_->name(); }
// Return the file name. For -lc this will return something like // Return the file name. For -lc this will return something like
// "/usr/lib/libc.so". // "/usr/lib/libc.so".
@ -401,8 +401,7 @@ class Input_file
// Return the position dependent options. // Return the position dependent options.
const Position_dependent_options& const Position_dependent_options&
options() const options() const;
{ return this->input_argument_->options(); }
// Return the file. // Return the file.
File_read& File_read&

View File

@ -28,6 +28,7 @@
#include <utility> #include <utility>
#include "parameters.h" #include "parameters.h"
#include "options.h"
#include "output.h" #include "output.h"
#include "symtab.h" #include "symtab.h"
#include "dynobj.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 // Now we know the final size of the output file and we know where
// each piece of information goes. // each piece of information goes.
Output_file* of = new Output_file(this->options_, Output_file* of = new Output_file(parameters->output_file_name());
this->input_objects_->target());
of->open(file_size); of->open(file_size);
// Queue up the final set of tasks. // Queue up the final set of tasks.

View File

@ -1861,7 +1861,7 @@ Output_section::do_write(Output_file* of)
p != this->fills_.end(); p != this->fills_.end();
++p) ++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(), of->write(output_section_file_offset + p->section_offset(),
fill_data.data(), fill_data.size()); fill_data.data(), fill_data.size());
} }
@ -2372,10 +2372,8 @@ Output_segment::write_section_headers_list(const Layout* layout,
// Output_file methods. // Output_file methods.
Output_file::Output_file(const General_options& options, Target* target) Output_file::Output_file(const char* name)
: options_(options), : name_(name),
target_(target),
name_(options.output_file_name()),
o_(-1), o_(-1),
file_size_(0), file_size_(0),
base_(NULL), base_(NULL),

View File

@ -2297,12 +2297,7 @@ class Output_segment
class Output_file class Output_file
{ {
public: public:
Output_file(const General_options& options, Target*); Output_file(const char* name);
// Get a pointer to the target.
Target*
target() const
{ return this->target_; }
// Open the output file. FILE_SIZE is the final size of the file. // Open the output file. FILE_SIZE is the final size of the file.
void void
@ -2372,11 +2367,6 @@ class Output_file
void void
unmap(); unmap();
// General options.
const General_options& options_;
// Target.
Target* target_;
// File name. // File name.
const char* name_; const char* name_;
// File descriptor. // File descriptor.