aboutsummaryrefslogtreecommitdiff
path: root/gold/object.h
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2011-05-24 21:57:28 +0000
committerCary Coutant <ccoutant@google.com>2011-05-24 21:57:28 +0000
commit0f1c85a62235edfbe68c78b197dcdbbe94b0b160 (patch)
tree8354c13bf8f71048d9120527cac3493e9aafd0f3 /gold/object.h
parent6fa2a40bf45fcc738eb580a6b644ac74b42c2d6a (diff)
downloadgdb-0f1c85a62235edfbe68c78b197dcdbbe94b0b160.zip
gdb-0f1c85a62235edfbe68c78b197dcdbbe94b0b160.tar.gz
gdb-0f1c85a62235edfbe68c78b197dcdbbe94b0b160.tar.bz2
* dynobj.h (Dynobj::do_dynobj): New function.
* incremental-dump.cc (dump_incremental_inputs): Print as_needed flag and soname for shared objects. * incremental.cc (Incremental_inputs::report_object): Make either Incremental_object_entry or Incremental_dynobj_entry; add soname to string table. (Incremental_inputs::report_input_section): Add assertion. (Output_section_incremental_inputs::set_final_data_size): Adjust type of input file entry for shared libraries; adjust size of shared library info entry. (Output_section_incremental_inputs::write_input_files): Write as_needed flag for shared libraries. (Output_section_incremental_inputs::write_info_blocks): Adjust type of input file entry for shared libraries; write soname. (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and soname from incremental info. * incremental.h (enum Incremental_input_flags): Add INCREMENTAL_INPUT_AS_NEEDED. (Incremental_input_entry::Incremental_input_entry): Initialize new data member. (Incremental_input_entry::set_as_needed): New function. (Incremental_input_entry::as_needed): New function. (Incremental_input_entry::do_dynobj_entry): New function. (Incremental_input_entry::as_needed_): New data member. (Incremental_object_entry::Incremental_object_entry): Don't check for shared library. (Incremental_object_entry::do_type): Likewise. (class Incremental_dynobj_entry): New class. (Incremental_input_entry_reader::as_needed): New function. (Incremental_input_entry_reader::get_soname): New function. (Incremental_input_entry_reader::get_global_symbol_count): Rewrite. (Incremental_input_entry_reader::get_output_symbol_index): Adjust size of shared library info entry. * layout.cc (Layout::finish_dynamic_section): Don't test for incremental link when adding DT_NEEDED entries. * object.h (Object::Object): Initialize new data member. (Object::dynobj): New function. (Object::set_as_needed): New function. (Object::as_needed): New function. (Object::do_dynobj): New function. (Object::as_needed_): New data member.
Diffstat (limited to 'gold/object.h')
-rw-r--r--gold/object.h27
1 files changed, 26 insertions, 1 deletions
diff --git a/gold/object.h b/gold/object.h
index d9be4b5..1031833 100644
--- a/gold/object.h
+++ b/gold/object.h
@@ -332,12 +332,13 @@ class Object
: name_(name), input_file_(input_file), offset_(offset), shnum_(-1U),
is_dynamic_(is_dynamic), is_needed_(false), uses_split_stack_(false),
has_no_split_stack_(false), no_export_(false),
- is_in_system_directory_(false), xindex_(NULL)
+ is_in_system_directory_(false), as_needed_(false), xindex_(NULL)
{
if (input_file != NULL)
{
input_file->file().add_object();
this->is_in_system_directory_ = input_file->is_in_system_directory();
+ this->as_needed_ = input_file->options().as_needed();
}
}
@@ -386,6 +387,12 @@ class Object
has_no_split_stack() const
{ return this->has_no_split_stack_; }
+ // Returns NULL for Objects that are not dynamic objects. This method
+ // is overridden in the Dynobj class.
+ Dynobj*
+ dynobj()
+ { return this->do_dynobj(); }
+
// Returns NULL for Objects that are not plugin objects. This method
// is overridden in the Pluginobj class.
Pluginobj*
@@ -688,6 +695,16 @@ class Object
is_in_system_directory() const
{ return this->is_in_system_directory_; }
+ // Set flag that this object was linked with --as-needed.
+ void
+ set_as_needed()
+ { this->as_needed_ = true; }
+
+ // Return whether this object was linked with --as-needed.
+ bool
+ as_needed() const
+ { return this->as_needed_; }
+
// Return whether we found this object by searching a directory.
bool
searched_for() const
@@ -719,6 +736,12 @@ class Object
{ return this->do_get_incremental_reloc_count(symndx); }
protected:
+ // Returns NULL for Objects that are not dynamic objects. This method
+ // is overridden in the Dynobj class.
+ virtual Dynobj*
+ do_dynobj()
+ { return NULL; }
+
// Returns NULL for Objects that are not plugin objects. This method
// is overridden in the Pluginobj class.
virtual Pluginobj*
@@ -911,6 +934,8 @@ class Object
bool no_export_ : 1;
// True if the object was found in a system directory.
bool is_in_system_directory_ : 1;
+ // True if the object was linked with --as-needed.
+ bool as_needed_ : 1;
// Many sections for objects with more than SHN_LORESERVE sections.
Xindex* xindex_;
};