Remove "fix" call for "long long" from ARI
[deliverable/binutils-gdb.git] / gold / arm-reloc-property.cc
index ae93c4736c3dad72f005a91750dfe0195d3c4596..c5ac206fbb5c5f79e90ceae887b077fd4ed46329 100644 (file)
@@ -1,6 +1,6 @@
 // arm-reloc-property.cc -- ARM relocation property.
 
-// Copyright 2010 Free Software Foundation, Inc.
+// Copyright (C) 2010-2019 Free Software Foundation, Inc.
 // Written by Doug Kwan <dougkwan@google.com>.
 
 // This file is part of gold.
@@ -22,6 +22,7 @@
 
 #include "gold.h"
 
+#include <cstdio>
 #include <cstring>
 #include <stack>
 #include <string>
@@ -103,7 +104,8 @@ Arm_reloc_property::Arm_reloc_property(
     relative_address_base_(RAB_NONE), is_deprecated_(is_deprecated),
     is_implemented_(is_implemented), checks_overflow_(checks_overflow),
     uses_got_entry_(false), uses_got_origin_(false), uses_plt_entry_(false),
-    uses_thumb_bit_(false), uses_symbol_base_(false), uses_addend_(false)
+    uses_thumb_bit_(false), uses_symbol_base_(false), uses_addend_(false),
+    uses_symbol_(false)
 {
   // Set size and alignment of static and dynamic relocations.
   if (rtype == RT_STATIC)
@@ -245,6 +247,7 @@ Arm_reloc_property::Arm_reloc_property(
     }
 
   gold_assert(node->is_leaf() && node->name() == "S");
+  this->uses_symbol_ = true;
 
   delete root_node;
 }
@@ -256,7 +259,7 @@ Arm_reloc_property::Arm_reloc_property(
 
 Arm_reloc_property_table::Arm_reloc_property_table()
 {
-  // These appers in arm-reloc.def.  Do not rename them.
+  // These appear in arm-reloc.def.  Do not rename them.
   Parse_expression A("A"), GOT_ORG("GOT_ORG"), NONE("NONE"), P("P"),
                   Pa("Pa"), S("S"), T("T"), TLS("TLS"), tp("tp");
   const bool Y(true), N(false);
@@ -284,4 +287,47 @@ Arm_reloc_property_table::Arm_reloc_property_table()
 #undef RD
 }
 
+// Return a string describing a relocation code that fails to get a
+// relocation property in get_implemented_static_reloc_property().
+
+std::string
+Arm_reloc_property_table::reloc_name_in_error_message(unsigned int code)
+{
+  gold_assert(code < Property_table_size);
+
+  const Arm_reloc_property* arp = this->table_[code];
+
+  if (arp == NULL)
+    {
+      char buffer[100];
+      sprintf(buffer, _("invalid reloc %u"), code);
+      return std::string(buffer);
+    }
+  
+  // gold only implements static relocation codes.
+  Arm_reloc_property::Reloc_type reloc_type = arp->reloc_type();
+  gold_assert(reloc_type == Arm_reloc_property::RT_STATIC
+             || !arp->is_implemented());
+
+  const char* prefix = NULL;
+  switch (reloc_type)
+    {
+    case Arm_reloc_property::RT_STATIC:
+      prefix = arp->is_implemented() ? _("reloc ") : _("unimplemented reloc ");
+      break;
+    case Arm_reloc_property::RT_DYNAMIC:
+      prefix = _("dynamic reloc ");
+      break;
+    case Arm_reloc_property::RT_PRIVATE:
+      prefix = _("private reloc ");
+      break;
+    case Arm_reloc_property::RT_OBSOLETE:
+      prefix = _("obsolete reloc ");
+      break;
+    default:
+      gold_unreachable();
+    }
+  return std::string(prefix) + arp->name();
+}
+
 } // End namespace gold.
This page took 0.02518 seconds and 4 git commands to generate.