[AArch64][PATCH 12/14] Support FP16 Adv.SIMD Scalar Pairwise instructions.
[deliverable/binutils-gdb.git] / gold / target-reloc.h
index d609bcbaa8b2319f1db516eb990dd88027125c7f..63b884f29e1a7c2926ba06b39965e4021f1b0381 100644 (file)
@@ -1,7 +1,6 @@
 // target-reloc.h -- target specific relocation support  -*- C++ -*-
 
-// Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
-// Free Software Foundation, Inc.
+// Copyright (C) 2006-2015 Free Software Foundation, Inc.
 // Written by Ian Lance Taylor <iant@google.com>.
 
 // This file is part of gold.
@@ -144,12 +143,6 @@ class Default_comdat_behavior
   }
 };
 
-inline bool
-is_strong_undefined(const Symbol* sym)
-{
-  return sym->is_undefined() && sym->binding() != elfcpp::STB_WEAK;
-}
-
 // Give an error for a symbol with non-default visibility which is not
 // defined locally.
 
@@ -191,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.
@@ -217,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())
@@ -300,7 +297,6 @@ relocate_section(
 
       typename elfcpp::Elf_types<size>::Elf_WXword r_info = reloc.get_r_info();
       unsigned int r_sym = elfcpp::elf_r_sym<size>(r_info);
-      unsigned int r_type = elfcpp::elf_r_type<size>(r_info);
 
       const Sized_symbol<size>* sym;
 
@@ -403,9 +399,9 @@ relocate_section(
       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, v, view_address + offset,
-                            view_size))
+      if (!relocate.relocate(relinfo, sh_type, target, output_section,
+                            i, prelocs, sym, psymval,
+                            v, view_address + offset, view_size))
        continue;
 
       if (v == NULL)
@@ -420,7 +416,7 @@ relocate_section(
        gold_undefined_symbol_at_location(sym, relinfo, i, offset);
       else if (sym != NULL
               && sym->visibility() != elfcpp::STV_DEFAULT
-              && (is_strong_undefined(sym) || sym->is_from_dynobj()))
+              && (sym->is_strong_undefined() || sym->is_from_dynobj()))
        visibility_error(sym);
 
       if (sym != NULL && sym->has_warning())
@@ -446,7 +442,6 @@ apply_relocation(const Relocate_info<size, big_endian>* relinfo,
   // Construct the ELF relocation in a temporary buffer.
   const int reloc_size = elfcpp::Elf_sizes<size>::rela_size;
   unsigned char relbuf[reloc_size];
-  elfcpp::Rela<size, big_endian> rel(relbuf);
   elfcpp::Rela_write<size, big_endian> orel(relbuf);
   orel.put_r_offset(r_offset);
   orel.put_r_info(elfcpp::elf_r_info<size>(0, r_type));
@@ -464,7 +459,8 @@ apply_relocation(const Relocate_info<size, big_endian>* relinfo,
     symval.set_is_ifunc_symbol();
 
   Relocate relocate;
-  relocate.relocate(relinfo, target, NULL, -1U, rel, r_type, sym, &symval,
+  relocate.relocate(relinfo, elfcpp::SHT_RELA, target, NULL,
+                   -1U, relbuf, sym, &symval,
                    view + r_offset, address + r_offset, view_size);
 }
 
@@ -622,7 +618,6 @@ relocate_relocs(
     size_t reloc_count,
     Output_section* 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,
     section_size_type view_size,
@@ -643,7 +638,7 @@ relocate_relocs(
 
   for (size_t i = 0; i < reloc_count; ++i, prelocs += reloc_size)
     {
-      Relocatable_relocs::Reloc_strategy strategy = rr->strategy(i);
+      Relocatable_relocs::Reloc_strategy strategy = relinfo->rr->strategy(i);
       if (strategy == Relocatable_relocs::RELOC_DISCARD)
        continue;
 
@@ -669,6 +664,7 @@ relocate_relocs(
 
       // Get the new symbol index.
 
+      Output_section* os = NULL;
       unsigned int new_symndx;
       if (r_sym < local_count)
        {
@@ -701,7 +697,7 @@ relocate_relocs(
                unsigned int shndx =
                  object->local_symbol_input_shndx(r_sym, &is_ordinary);
                gold_assert(is_ordinary);
-               Output_section* os = object->output_section(shndx);
+               os = object->output_section(shndx);
                gold_assert(os != NULL);
                gold_assert(os->needs_symtab_index());
                new_symndx = os->symtab_index();
@@ -783,7 +779,8 @@ relocate_relocs(
                typename elfcpp::Elf_types<size>::Elf_Swxword addend;
                addend = Reloc_types<sh_type, size, big_endian>::
                           get_reloc_addend(&reloc);
-               addend = psymval->value(object, addend);
+               gold_assert(os != NULL);
+               addend = psymval->value(object, addend) - os->address();
                Reloc_types<sh_type, size, big_endian>::
                  set_reloc_addend(&reloc_write, addend);
              }
This page took 0.029724 seconds and 4 git commands to generate.