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
#include "parameters.h"
#include "options.h"
#include "compressed_output.h"
namespace gold

View file

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

View file

@ -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

View file

@ -29,12 +29,13 @@
#include <map>
#include <string>
#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&

View file

@ -28,6 +28,7 @@
#include <utility>
#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.

View file

@ -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),

View file

@ -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.