Update from upstream Automake
[deliverable/binutils-gdb.git] / gold / target-reloc.h
index 769a524f7ad2ddcee738fdcdb293e6e9e43e85f3..e44519b23ce20e1c71854aa17c85add5111736e4 100644 (file)
@@ -1,6 +1,6 @@
 // target-reloc.h -- target specific relocation support  -*- C++ -*-
 
-// Copyright 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+// Copyright (C) 2006-2014 Free Software Foundation, Inc.
 // Written by Ian Lance Taylor <iant@google.com>.
 
 // This file is part of gold.
@@ -87,7 +87,7 @@ scan_relocs(
          //
          // FIXME: We should issue a warning if this is an
          // allocated section; is this the best place to do it?
-         // 
+         //
          // FIXME: The old GNU linker would in some cases look
          // for the linkonce section which caused this section to
          // be discarded, and, if the other section was the same
@@ -184,7 +184,7 @@ issue_undefined_symbol_error(const Symbol* sym)
     return false;
 
   // We don't report weak symbols.
-  if (sym->binding() == elfcpp::STB_WEAK)
+  if (sym->is_weak_undefined())
     return false;
 
   // We don't report symbols defined in discarded sections.
@@ -210,6 +210,10 @@ issue_undefined_symbol_error(const Symbol* sym)
        return false;
     }
 
+  // If the symbol is hidden, report it.
+  if (sym->visibility() == elfcpp::STV_HIDDEN)
+    return true;
+
   // When creating a shared library, only report unresolved symbols if
   // -z defs was used.
   if (parameters->options().shared() && !parameters->options().defs())
@@ -311,7 +315,7 @@ 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.  The symbol must not 
+          // counterpart in the kept section.  The symbol must not
           // correspond to a section we are folding.
          bool is_ordinary;
          shndx = psymval->input_shndx(&is_ordinary);
@@ -388,12 +392,20 @@ relocate_section(
          psymval = &symval2;
        }
 
+      // If OFFSET is out of range, still let the target decide to
+      // ignore the relocation.  Pass in NULL as the VIEW argument so
+      // that it can return quickly without trashing an invalid memory
+      // address.
+      unsigned char *v = view + offset;
+      if (offset < 0 || static_cast<section_size_type>(offset) >= view_size)
+       v = NULL;
+
       if (!relocate.relocate(relinfo, target, output_section, i, reloc,
-                            r_type, sym, psymval, view + offset,
-                            view_address + offset, view_size))
+                            r_type, sym, psymval, v, view_address + offset,
+                            view_size))
        continue;
 
-      if (offset < 0 || static_cast<section_size_type>(offset) >= view_size)
+      if (v == NULL)
        {
          gold_error_at_location(relinfo, i, offset,
                                 _("reloc has bad offset %zu"),
@@ -405,7 +417,7 @@ relocate_section(
        gold_undefined_symbol_at_location(sym, relinfo, i, offset);
       else if (sym != NULL
               && sym->visibility() != elfcpp::STV_DEFAULT
-              && (sym->is_undefined() || sym->is_from_dynobj()))
+              && (sym->is_strong_undefined() || sym->is_from_dynobj()))
        visibility_error(sym);
 
       if (sym != NULL && sym->has_warning())
@@ -606,7 +618,7 @@ relocate_relocs(
     const unsigned char* prelocs,
     size_t reloc_count,
     Output_section* output_section,
-    typename elfcpp::Elf_types<size>::Elf_Addr offset_in_output_section,
+    typename elfcpp::Elf_types<size>::Elf_Off offset_in_output_section,
     const Relocatable_relocs* rr,
     unsigned char* view,
     typename elfcpp::Elf_types<size>::Elf_Addr view_address,
This page took 0.039314 seconds and 4 git commands to generate.