class Object;
template<int size, bool big_endian>
-class Sized_relobj;
+class Sized_relobj_file;
template<int sh_type, int size, bool big_endian>
class Reloc_types;
section_size_type symbol_names_size;
};
+// Relocations of type SHT_REL store the addend value in their bytes.
+// This function returns the size of the embedded addend which is
+// nothing but the size of the relocation.
+
+template<typename Classify_reloc>
+inline unsigned int
+get_embedded_addend_size(int sh_type, int r_type, Relobj* obj)
+{
+ if (sh_type != elfcpp::SHT_REL)
+ return 0;
+ Classify_reloc classify_reloc;
+ return classify_reloc.get_size_for_reloc(r_type, obj);
+}
+
// This function implements the generic part of reloc
// processing to map a section to all the sections it
// references through relocs. It is called only during
// folding (--icf).
template<int size, bool big_endian, typename Target_type, int sh_type,
- typename Scan>
+ typename Scan, typename Classify_reloc>
inline void
gc_process_relocs(
Symbol_table* symtab,
Layout*,
Target_type* target,
- Sized_relobj<size, big_endian>* src_obj,
+ Sized_relobj_file<size, big_endian>* src_obj,
unsigned int src_indx,
const unsigned char* prelocs,
size_t reloc_count,
size_t local_count,
const unsigned char* plocal_syms)
{
- Object *dst_obj;
+ Object* dst_obj;
unsigned int dst_indx;
Scan scan;
Icf::Symbol_info* symvec = NULL;
Icf::Addend_info* addendvec = NULL;
Icf::Offset_info* offsetvec = NULL;
+ Icf::Reloc_addend_size_info* reloc_addend_size_vec = NULL;
bool is_icf_tracked = false;
const char* cident_section_name = NULL;
symvec = &reloc_info->symbol_info;
addendvec = &reloc_info->addend_info;
offsetvec = &reloc_info->offset_info;
+ reloc_addend_size_vec = &reloc_info->reloc_addend_size_info;
}
check_section_for_function_pointers =
uint64_t reloc_offset =
convert_to_section_size_type(reloc.get_r_offset());
(*offsetvec).push_back(reloc_offset);
+ (*reloc_addend_size_vec).push_back(
+ get_embedded_addend_size<Classify_reloc>(sh_type, r_type,
+ src_obj));
}
// When doing safe folding, check to see if this relocation is that
uint64_t reloc_offset =
convert_to_section_size_type(reloc.get_r_offset());
(*offsetvec).push_back(reloc_offset);
+ (*reloc_addend_size_vec).push_back(
+ get_embedded_addend_size<Classify_reloc>(sh_type, r_type,
+ src_obj));
}
if (gsym->source() != Symbol::FROM_OBJECT)