* configure.ac: Add --with-lib-path option. Define LIB_PATH and
[deliverable/binutils-gdb.git] / gold / gc.h
index 77ac6dad9e599e0683f842522d31f4b79623aa26..4688781fd7a65b4475995c0700f3a18ab7bd2bd5 100644 (file)
--- a/gold/gc.h
+++ b/gold/gc.h
@@ -37,7 +37,7 @@ namespace gold
 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;
@@ -151,6 +151,20 @@ struct Symbols_data
   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
@@ -158,13 +172,13 @@ struct Symbols_data
 // 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,
@@ -173,7 +187,7 @@ gc_process_relocs(
     size_t local_count,
     const unsigned char* plocal_syms)
 {
-  Object *dst_obj;
+  Objectdst_obj;
   unsigned int dst_indx;
   Scan scan;
 
@@ -185,6 +199,7 @@ gc_process_relocs(
   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;
 
@@ -205,6 +220,7 @@ gc_process_relocs(
       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 =
@@ -243,6 +259,9 @@ gc_process_relocs(
               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
@@ -316,6 +335,9 @@ gc_process_relocs(
               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)
This page took 0.024645 seconds and 4 git commands to generate.