*** empty log message ***
[deliverable/binutils-gdb.git] / gold / target-reloc.h
index 3205e3666d8ef7fee1639e9591aa0d5c1cae06ba..d93e7552888bb71a432d7cc8324964e967354c45 100644 (file)
@@ -218,12 +218,14 @@ relocate_section(
           // If the local symbol belongs to a section we are discarding,
           // and that section is a debug section, try to find the
           // corresponding kept section and map this symbol to its
-          // counterpart in the kept section.
+          // counterpart in the kept section.  The symbol must not 
+          // correspond to a section we are folding.
          bool is_ordinary;
          unsigned int shndx = psymval->input_shndx(&is_ordinary);
          if (is_ordinary
              && shndx != elfcpp::SHN_UNDEF
-             && !object->is_section_included(shndx))
+             && !object->is_section_included(shndx) 
+              && !(relinfo->symtab->is_section_folded(object, shndx)))
            {
              if (comdat_behavior == CB_UNDETERMINED)
                {
@@ -268,8 +270,9 @@ relocate_section(
          psymval = &symval;
        }
 
-      if (!relocate.relocate(relinfo, target, i, reloc, r_type, sym, psymval,
-                            view + offset, view_address + offset, view_size))
+      if (!relocate.relocate(relinfo, target, output_section, i, reloc,
+                            r_type, sym, psymval, view + offset,
+                            view_address + offset, view_size))
        continue;
 
       if (offset < 0 || static_cast<section_size_type>(offset) >= view_size)
@@ -286,7 +289,7 @@ relocate_section(
           && !target->is_defined_by_abi(sym)
          && (!parameters->options().shared()       // -shared
               || parameters->options().defs()))     // -z defs
-       gold_undefined_symbol(sym, relinfo, i, offset);
+       gold_undefined_symbol_at_location(sym, relinfo, i, offset);
 
       if (sym != NULL && sym->has_warning())
        relinfo->symtab->issue_warning(sym, relinfo, i, offset);
@@ -308,11 +311,11 @@ class Default_scan_relocatable_relocs
   // Return the strategy to use for a local symbol which is not a
   // section symbol, given the relocation type.
   inline Relocatable_relocs::Reloc_strategy
-  local_non_section_strategy(unsigned int r_type, Relobj*)
+  local_non_section_strategy(unsigned int r_type, Relobj*, unsigned int r_sym)
   {
     // We assume that relocation type 0 is NONE.  Targets which are
     // different must override.
-    if (r_type == 0)
+    if (r_type == 0 && r_sym == 0)
       return Relocatable_relocs::RELOC_DISCARD;
     return Relocatable_relocs::RELOC_COPY;
   }
@@ -322,10 +325,6 @@ class Default_scan_relocatable_relocs
   inline Relocatable_relocs::Reloc_strategy
   local_section_strategy(unsigned int r_type, Relobj* object)
   {
-    // We assume that relocation type 0 is NONE.  Targets which are
-    // different must override.
-    if (r_type == 0)
-      return Relocatable_relocs::RELOC_DISCARD;
     if (sh_type == elfcpp::SHT_RELA)
       return Relocatable_relocs::RELOC_ADJUST_FOR_SECTION_RELA;
     else
@@ -352,14 +351,8 @@ class Default_scan_relocatable_relocs
   // Return the strategy to use for a global symbol, given the
   // relocation type, the object, and the symbol index.
   inline Relocatable_relocs::Reloc_strategy
-  global_strategy(unsigned int r_type, Relobj*, unsigned int)
-  {
-    // We assume that relocation type 0 is NONE.  Targets which are
-    // different must override.
-    if (r_type == 0)
-      return Relocatable_relocs::RELOC_DISCARD;
-    return Relocatable_relocs::RELOC_COPY;
-  }
+  global_strategy(unsigned int, Relobj*, unsigned int)
+  { return Relocatable_relocs::RELOC_COPY; }
 };
 
 // Scan relocs during a relocatable link.  This is a default
@@ -429,7 +422,8 @@ scan_relocatable_relocs(
                  strategy = Relocatable_relocs::RELOC_DISCARD;
                }
              else if (lsym.get_st_type() != elfcpp::STT_SECTION)
-               strategy = scan.local_non_section_strategy(r_type, object);
+               strategy = scan.local_non_section_strategy(r_type, object,
+                                                          r_sym);
              else
                {
                  strategy = scan.local_section_strategy(r_type, object);
This page took 0.029883 seconds and 4 git commands to generate.