- is_section_folded(Object* obj, unsigned int shndx);
-
- // 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_; }
-
+ is_section_folded(Relobj* obj, unsigned int shndx);
+
+ // Given an object and a section index, this returns true if the
+ // pointer of the function defined in this section is taken.
+ bool
+ section_has_function_pointers(Relobj* obj, unsigned int shndx)
+ {
+ return (this->fptr_section_id_.find(Section_id(obj, shndx))
+ != this->fptr_section_id_.end());
+ }
+
+ // Records that a pointer of the function defined in this section
+ // is taken.
+ void
+ set_section_has_function_pointers(Relobj* obj, unsigned int shndx)
+ {
+ this->fptr_section_id_.insert(Section_id(obj, shndx));
+ }
+
+ // Checks if the section_name should be searched for relocs
+ // corresponding to taken function pointers. Ignores eh_frame
+ // and vtable sections.
+ inline bool
+ check_section_for_function_pointers(const std::string& section_name,
+ Target* target)
+ {
+ return (parameters->options().icf_safe_folding()
+ && target->can_check_for_function_pointers()
+ && target->section_may_have_icf_unsafe_pointers(
+ section_name.c_str()));
+ }
+
+ // 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 map from section to region of a different section that should
+ // be considered part of the key section for ICF purposes.
+ Extra_identity_list&
+ extra_identity_list()
+ { return this->extra_identity_list_; }
+