From 029ba973354c8eb02c476d3ba8c7f555344afdce Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 30 Sep 2009 22:21:13 +0000 Subject: * object.h (class Object): Remove target_ field, and target, sized_target, and set_target methods. (Object::sized_target): Remove. (class Sized_relobj): Update declarations. Remove sized_target. * object.cc (Sized_relobj::setup): Remove target parameter. Change all callers. (Input_objects::add_object): Don't do anything with the target. (make_elf_sized_object): Add punconfigured parameter. Change all callers. Set or test parameter target. * dynobj.cc (Sized_dynobj::target): Remove target parameter. Change all callers. * parameters.cc (Parameters::set_target): Change parameter type to be non-const. (Parameters::default_target): Remove. (set_parameters_target): Change parameter type to be non-const. (parameters_force_valid_target): New function. (parameters_clear_target): New function. * parameters.h (class Parameters): Update declarations. Remove default_target method. Add sized_target and clear_target methods. Change target_ to be non-const. (set_parameters_target): Update declaration. (parameters_force_valid_target): Declare. (parameters_clear_target): Declare. * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured as NULL if we aren't searching. (Add_symbols::run): Don't check for compatible target. * fileread.cc (Input_file::open_binary): Call parameters_force_valid_target. * gold.cc (queue_middle_tasks): Likewise. * plugin.cc (make_sized_plugin_object): Likewise. Don't call set_target on object. * dynobj.h (class Sized_dynobj): Update declarations. * archive.cc (Archive::get_elf_object_for_member): Return NULL if make_elf_object returns NULL. (Archive::include_member): Don't check whether object target is compatible. * output.cc (Output_section::add_input_section): Get target from parameters. (Output_section::relax_input_section): Likewise. * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from parameters. (Sized_relobj::do_scan_relocs): Likewise. (Sized_relobj::relocate_sections): Likewise. * resolve.cc (Symbol_table::resolve): Likewise. * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object parameter. Change all callers. (Symbol_table::add_from_object): Get target from parameters. (Symbol_table::add_from_relobj): Don't check object target. (Symbol_table::add_from_dynobj): Likewise. (Symbol_table::define_special_symbol): Get target from parameters. * symtab.h (class Symbol_table): Update declaration. * testsuite/binary_unittest.cc (gold_testsuite): Remove target parameter. Change all callers. Clear parameter target. (Binary_test): Test target here. * testsuite/object_unittest.cc (gold_testsuite): Remove target_test_pointer parameter. Change all callers. (Object_test): Test target here. --- gold/object.h | 40 ++-------------------------------------- 1 file changed, 2 insertions(+), 38 deletions(-) (limited to 'gold/object.h') diff --git a/gold/object.h b/gold/object.h index 4394318..e7d05c7 100644 --- a/gold/object.h +++ b/gold/object.h @@ -195,7 +195,7 @@ class Object Object(const std::string& name, Input_file* input_file, bool is_dynamic, off_t offset = 0) : name_(name), input_file_(input_file), offset_(offset), shnum_(-1U), - is_dynamic_(is_dynamic), target_(NULL), xindex_(NULL), no_export_(false) + is_dynamic_(is_dynamic), xindex_(NULL), no_export_(false) { input_file->file().add_object(); } virtual ~Object() @@ -222,11 +222,6 @@ class Object pluginobj() { return this->do_pluginobj(); } - // Return the target structure associated with this object. - Target* - target() const - { return this->target_; } - // Get the file. We pass on const-ness. Input_file* input_file() @@ -266,13 +261,6 @@ class Object just_symbols() const { return this->input_file()->just_symbols(); } - // Return the sized target structure associated with this object. - // This is like the target method but it returns a pointer of - // appropriate checked type. - template - Sized_target* - sized_target() const; - // Get the number of sections. unsigned int shnum() const @@ -453,11 +441,6 @@ class Object size_t* used) const { this->do_get_global_symbol_counts(symtab, defined, used); } - // Set the target. - void - set_target(Target* target) - { this->target_ = target; } - // Return whether this object was found in a system directory. bool is_in_system_directory() const @@ -589,8 +572,6 @@ class Object unsigned int shnum_; // Whether this is a dynamic object. bool is_dynamic_; - // Target functions--may be NULL if the target is not known. - Target* target_; // Many sections for objects with more than SHN_LORESERVE sections. Xindex* xindex_; // True if exclude this object from automatic symbol export. @@ -598,18 +579,6 @@ class Object bool no_export_; }; -// Implement sized_target inline for efficiency. This approach breaks -// static type checking, but is made safe using asserts. - -template -inline Sized_target* -Object::sized_target() const -{ - gold_assert(this->target_->get_size() == size); - gold_assert(this->target_->is_big_endian() ? big_endian : !big_endian); - return static_cast*>(this->target_); -} - // A regular object (ET_REL). This is an abstract base class itself. // The implementation is the template class Sized_relobj. @@ -1308,7 +1277,7 @@ class Sized_relobj : public Relobj // Set up the object file based on TARGET. void - setup(Target *target); + setup(); // Return the number of symbols. This is only valid after // Object::add_symbols has been called. @@ -1373,11 +1342,6 @@ class Sized_relobj : public Relobj return this->local_values_[sym].input_shndx(is_ordinary); } - // Return the appropriate Sized_target structure. - Sized_target* - sized_target() - { return this->Object::sized_target(); } - // Record that local symbol SYM needs a dynamic symbol entry. void set_needs_output_dynsym_entry(unsigned int sym) -- cgit v1.1