aboutsummaryrefslogtreecommitdiff
path: root/gold/object.h
diff options
context:
space:
mode:
authorDoug Kwan <dougkwan@google.com>2010-01-20 17:29:52 +0000
committerDoug Kwan <dougkwan@google.com>2010-01-20 17:29:52 +0000
commit5ac169d4b6e2d88c670298a3246fc2a5d8a94aa4 (patch)
tree02c188debc6532be6476d7de9cb86cc6309ea963 /gold/object.h
parenta21620630edb456511a2467466814ecffa158b2f (diff)
downloadfsf-binutils-gdb-5ac169d4b6e2d88c670298a3246fc2a5d8a94aa4.zip
fsf-binutils-gdb-5ac169d4b6e2d88c670298a3246fc2a5d8a94aa4.tar.gz
fsf-binutils-gdb-5ac169d4b6e2d88c670298a3246fc2a5d8a94aa4.tar.bz2
2010-01-20 Doug Kwan <dougkwan@google.com>
* arm.cc (Target_arm::Arm_input_section_map): Change key type from Input_section_specifier to Section_id. (Target_arm::new_arm_input_section: Adjust code for change of key type. (Target_arm::find_arm_input_section): Ditto. * gc.h (object.h): Include for Section_id nand Section_id_hash. (Section_id): Remove. (Garbage_collection::Section_id_hash): Remove. * icf.h (object.h): Include for Section_id nand Section_id_hash. (Section_id): Remove. (Icf::Section_id_hash): Remove. * object.h (Section_id, Const_section_id, Section_id_hash, Const_section_id_hash): New type definitions. * output.cc (Output_section::add_relaxed_input_section): Change to use Const_section_id instead of Input_section_specifier as key type. (Output_section::add_merge_input_section): Ditto. (Output_section::build_relaxation_map): Change to use Section_id instead of Input_section_specifier as key type. (Output_section::convert_input_sections_in_list_to_relaxed_sections): Ditto. (Output_section::convert_input_sections_to_relaxed_sections): Change to use Const_section_id instead of Input_section_specifier as key type. (Output_section::find_merge_section): Ditto. (Output_section::find_relaxed_input_section): Ditto. * output.h (Input_section_specifier): Remove class. (Output_section::Output_section_data_by_input_section_map): Change key type to Const_section_id. (Output_section::Output_relaxed_input_section_by_input_section_map): Ditto. (Output_section::Relaxation_map): Change key type to Section_id.
Diffstat (limited to 'gold/object.h')
-rw-r--r--gold/object.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/gold/object.h b/gold/object.h
index 26e85f5..d006856 100644
--- a/gold/object.h
+++ b/gold/object.h
@@ -2050,6 +2050,31 @@ struct Relocate_info
location(size_t relnum, off_t reloffset) const;
};
+// This is used to represent a section in an object and is used as the
+// key type for various section maps.
+typedef std::pair<Object*, unsigned int> Section_id;
+
+// This is similar to Section_id but is used when the section
+// pointers are const.
+typedef std::pair<const Object*, unsigned int> Const_section_id;
+
+// The hash value is based on the address of an object in memory during
+// linking. It is okay to use this for looking up sections but never use
+// this in an unordered container that we want to traverse in a repeatable
+// manner.
+
+struct Section_id_hash
+{
+ size_t operator()(const Section_id& loc) const
+ { return reinterpret_cast<uintptr_t>(loc.first) ^ loc.second; }
+};
+
+struct Const_section_id_hash
+{
+ size_t operator()(const Const_section_id& loc) const
+ { return reinterpret_cast<uintptr_t>(loc.first) ^ loc.second; }
+};
+
// Return whether INPUT_FILE contains an ELF object start at file
// offset OFFSET. This sets *START to point to a view of the start of
// the file. It sets *READ_SIZE to the number of bytes in the view.