aboutsummaryrefslogtreecommitdiff
path: root/gold/icf.h
diff options
context:
space:
mode:
authorSriraman Tallam <tmsriram@google.com>2010-02-21 00:57:59 +0000
committerSriraman Tallam <tmsriram@google.com>2010-02-21 00:57:59 +0000
commitb487ad64e5aa3da0c80b8648f7079b5415c45a3a (patch)
treedb254f4182cc73c2abc52dc46c266b495265654f /gold/icf.h
parent307d2493b8685a7f69b85dc48db0df13921f0665 (diff)
downloadgdb-b487ad64e5aa3da0c80b8648f7079b5415c45a3a.zip
gdb-b487ad64e5aa3da0c80b8648f7079b5415c45a3a.tar.gz
gdb-b487ad64e5aa3da0c80b8648f7079b5415c45a3a.tar.bz2
2010-02-20 Sriraman Tallam <tmsriram@google.com>
* gc.h (gc_process_relocs): Change vectors to point to the new list. Add reloc offset information. * icf.cc (get_section_contents): Change iterators to point to the new vectors. Add reloc offset information to the contents. * icf.h (Icf::Sections_reachable_info): New typedef. (Icf::Sections_reachable_list): New typedef. (Icf::Offset_info): New typedef. (Icf::Reloc_info): New struct typedef. (Icf::Reloc_info_list): New typedef. (Icf::symbol_reloc_list): Delete method. (Icf::addend_reloc_list): Delete method. (Icf::section_reloc_list): Delete method. (Icf::reloc_info_list): New method. (Icf::reloc_info_list_): New member.
Diffstat (limited to 'gold/icf.h')
-rw-r--r--gold/icf.h53
1 files changed, 23 insertions, 30 deletions
diff --git a/gold/icf.h b/gold/icf.h
index 76e491c..c1db8e5 100644
--- a/gold/icf.h
+++ b/gold/icf.h
@@ -39,25 +39,34 @@ class Symbol_table;
class Icf
{
public:
- typedef std::vector<Section_id> Sections_reachable_list;
+ typedef std::vector<Section_id> Sections_reachable_info;
typedef std::vector<Symbol*> Symbol_info;
typedef std::vector<std::pair<long long, long long> > Addend_info;
- typedef Unordered_map<Section_id,
- Sections_reachable_list,
- Section_id_hash> Section_list;
- typedef Unordered_map<Section_id, Symbol_info, Section_id_hash> Symbol_list;
- typedef Unordered_map<Section_id, Addend_info, Section_id_hash> Addend_list;
+ typedef std::vector<uint64_t> Offset_info;
typedef Unordered_map<Section_id,
unsigned int,
Section_id_hash> Uniq_secn_id_map;
typedef Unordered_set<Section_id, Section_id_hash> Secn_fptr_taken_set;
+ typedef struct
+ {
+ // This stores the section corresponding to the reloc.
+ Sections_reachable_info section_info;
+ // This stores the symbol corresponding to the reloc.
+ Symbol_info symbol_info;
+ // This stores the symbol value and the addend for a reloc.
+ Addend_info addend_info;
+ Offset_info offset_info;
+ } Reloc_info;
+
+ typedef Unordered_map<Section_id, Reloc_info,
+ Section_id_hash> Reloc_info_list;
+
Icf()
: id_section_(), section_id_(), kept_section_id_(),
fptr_section_id_(),
num_tracked_relocs(NULL), icf_ready_(false),
- section_reloc_list_(), symbol_reloc_list_(),
- addend_reloc_list_()
+ reloc_info_list_()
{ }
// Returns the kept folded identical section corresponding to
@@ -121,23 +130,10 @@ class Icf
&& !is_prefix_of(".eh_frame", section_name.c_str()));
}
- // Returns a map of a section to a list of all sections referenced
- // by its relocations.
- Section_list&
- section_reloc_list()
- { return this->section_reloc_list_; }
-
- // Returns a map of a section to a list of all symbols referenced
- // by its relocations.
- Symbol_list&
- symbol_reloc_list()
- { return this->symbol_reloc_list_; }
-
- // Returns a maps of a section to a list of symbol values and addends
- // of its relocations.
- Addend_list&
- addend_reloc_list()
- { return this->addend_reloc_list_; }
+ // Returns a map of a section to info (Reloc_info) about its relocations.
+ Reloc_info_list&
+ reloc_info_list()
+ { return this->reloc_info_list_; }
// Returns a mapping of each section to a unique integer.
Uniq_secn_id_map&
@@ -161,11 +157,8 @@ class Icf
unsigned int* num_tracked_relocs;
// Flag to indicate if ICF has been run.
bool icf_ready_;
-
- // These lists are populated by gc_process_relocs in gc.h.
- Section_list section_reloc_list_;
- Symbol_list symbol_reloc_list_;
- Addend_list addend_reloc_list_;
+ // This list is populated by gc_process_relocs in gc.h.
+ Reloc_info_list reloc_info_list_;
};
// This function returns true if this section corresponds to a function that