gdb: add target_ops::supports_displaced_step
[deliverable/binutils-gdb.git] / gold / mips.cc
index 543a23462f71c140809770f28d531ed2dec99210..9d5052162cf8973a6925ba69dab931973eeca1de 100644 (file)
@@ -1,6 +1,6 @@
 // mips.cc -- mips target support for gold.
 
-// Copyright (C) 2011-2018 Free Software Foundation, Inc.
+// Copyright (C) 2011-2020 Free Software Foundation, Inc.
 // Written by Sasa Stankovic <sasa.stankovic@imgtec.com>
 //        and Aleksandar Simeonov <aleksandar.simeonov@rt-rk.com>.
 // This file contains borrowed and adapted code from bfd/elfxx-mips.c.
@@ -631,11 +631,11 @@ struct Got_page_range
 struct Got_page_entry
 {
   Got_page_entry()
-    : object(NULL), symndx(-1U), ranges(NULL), num_pages(0)
+    : object(NULL), symndx(-1U), ranges(NULL)
   { }
 
   Got_page_entry(Object* object_, unsigned int symndx_)
-    : object(object_), symndx(symndx_), ranges(NULL), num_pages(0)
+    : object(object_), symndx(symndx_), ranges(NULL)
   { }
 
   // The input object that needs the GOT page entry.
@@ -644,8 +644,6 @@ struct Got_page_entry
   unsigned int symndx;
   // The ranges for this page entry.
   Got_page_range* ranges;
-  // The maximum number of page entries needed for RANGES.
-  unsigned int num_pages;
 };
 
 // Hash for Got_page_entry.
@@ -775,7 +773,7 @@ class Mips_got_info
 
   // Add FROM's GOT page entries.
   void
-  add_got_page_entries(Mips_got_info<size, big_endian>* from);
+  add_got_page_count(Mips_got_info<size, big_endian>* from);
 
   // Return GOT size.
   unsigned int
@@ -928,7 +926,7 @@ class Mips_got_info
   Global_got_entry_set global_got_symbols_;
   // A hash table holding GOT entries.
   Got_entry_set got_entries_;
-  // A hash table of GOT page entries.
+  // A hash table of GOT page entries (only used in master GOT).
   Got_page_entry_set got_page_entries_;
   // The offset of first GOT page entry for this GOT.
   unsigned int got_page_offset_start_;
@@ -3984,7 +3982,9 @@ class Target_mips : public Sized_target<size, big_endian>
     mach_mips5                = 5,
     mach_mips_loongson_2e     = 3001,
     mach_mips_loongson_2f     = 3002,
-    mach_mips_loongson_3a     = 3003,
+    mach_mips_gs464           = 3003,
+    mach_mips_gs464e          = 3004,
+    mach_mips_gs264e          = 3005,
     mach_mips_sb1             = 12310201, // octal 'SB', 01
     mach_mips_octeon          = 6501,
     mach_mips_octeonp         = 6601,
@@ -4150,7 +4150,9 @@ class Target_mips : public Sized_target<size, big_endian>
     this->add_extension(mach_mips_octeon2, mach_mips_octeonp);
     this->add_extension(mach_mips_octeonp, mach_mips_octeon);
     this->add_extension(mach_mips_octeon, mach_mipsisa64r2);
-    this->add_extension(mach_mips_loongson_3a, mach_mipsisa64r2);
+    this->add_extension(mach_mips_gs264e, mach_mips_gs464e);
+    this->add_extension(mach_mips_gs464e, mach_mips_gs464);
+    this->add_extension(mach_mips_gs464, mach_mipsisa64r2);
 
     // MIPS64 extensions.
     this->add_extension(mach_mipsisa64r2, mach_mipsisa64);
@@ -5794,14 +5796,8 @@ Mips_got_info<size, big_endian>::record_got_page_entry(
   else
     this->got_page_entries_.insert(entry);
 
-  // Add the same entry to the OBJECT's GOT.
-  Got_page_entry* entry2 = NULL;
+  // Get the object's GOT, but we don't need to insert an entry here.
   Mips_got_info<size, big_endian>* g2 = object->get_or_create_got_info();
-  if (g2->got_page_entries_.find(entry) == g2->got_page_entries_.end())
-    {
-      entry2 = new Got_page_entry(*entry);
-      g2->got_page_entries_.insert(entry2);
-    }
 
   // Skip over ranges whose maximum extent cannot share a page entry
   // with ADDEND.
@@ -5821,9 +5817,6 @@ Mips_got_info<size, big_endian>::record_got_page_entry(
       range->max_addend = addend;
 
       *range_ptr = range;
-      ++entry->num_pages;
-      if (entry2 != NULL)
-        ++entry2->num_pages;
       ++this->page_gotno_;
       ++g2->page_gotno_;
       return;
@@ -5851,9 +5844,6 @@ Mips_got_info<size, big_endian>::record_got_page_entry(
   new_pages = range->get_max_pages();
   if (old_pages != new_pages)
     {
-      entry->num_pages += new_pages - old_pages;
-      if (entry2 != NULL)
-        entry2->num_pages += new_pages - old_pages;
       this->page_gotno_ += new_pages - old_pages;
       g2->page_gotno_ += new_pages - old_pages;
     }
@@ -6353,22 +6343,10 @@ Mips_got_info<size, big_endian>::add_got_entries(
 
 template<int size, bool big_endian>
 void
-Mips_got_info<size, big_endian>::add_got_page_entries(
+Mips_got_info<size, big_endian>::add_got_page_count(
     Mips_got_info<size, big_endian>* from)
 {
-  for (typename Got_page_entry_set::iterator
-       p = from->got_page_entries_.begin();
-       p != from->got_page_entries_.end();
-       ++p)
-    {
-      Got_page_entry* entry = *p;
-      if (this->got_page_entries_.find(entry) == this->got_page_entries_.end())
-        {
-          Got_page_entry* entry2 = new Got_page_entry(*entry);
-          this->got_page_entries_.insert(entry2);
-          this->page_gotno_ += entry->num_pages;
-        }
-    }
+  this->page_gotno_ += from->page_gotno_;
 }
 
 // Mips_output_data_got methods.
@@ -6569,7 +6547,7 @@ Mips_output_data_got<size, big_endian>::merge_got_with(
 
   // Transfer the object's GOT information from FROM to TO.
   to->add_got_entries(from);
-  to->add_got_page_entries(from);
+  to->add_got_page_count(from);
 
   // Record that OBJECT should use output GOT TO.
   object->set_got_info(to);
@@ -8884,8 +8862,14 @@ Target_mips<size, big_endian>::elf_mips_mach(elfcpp::Elf_Word flags)
     case elfcpp::E_MIPS_MACH_LS2F:
       return mach_mips_loongson_2f;
 
-    case elfcpp::E_MIPS_MACH_LS3A:
-      return mach_mips_loongson_3a;
+    case elfcpp::E_MIPS_MACH_GS464:
+      return mach_mips_gs464;
+
+    case elfcpp::E_MIPS_MACH_GS464E:
+      return mach_mips_gs464e;
+
+    case elfcpp::E_MIPS_MACH_GS264E:
+      return mach_mips_gs264e;
 
     case elfcpp::E_MIPS_MACH_OCTEON3:
       return mach_mips_octeon3;
@@ -8985,9 +8969,6 @@ Target_mips<size, big_endian>::mips_isa_ext_mach(unsigned int isa_ext)
     case elfcpp::AFL_EXT_LOONGSON_2F:
       return mach_mips_loongson_2f;
 
-    case elfcpp::AFL_EXT_LOONGSON_3A:
-      return mach_mips_loongson_3a;
-
     case elfcpp::AFL_EXT_SB1:
       return mach_mips_sb1;
 
@@ -9052,9 +9033,6 @@ Target_mips<size, big_endian>::mips_isa_ext(unsigned int mips_mach)
     case mach_mips_loongson_2f:
       return elfcpp::AFL_EXT_LOONGSON_2F;
 
-    case mach_mips_loongson_3a:
-      return elfcpp::AFL_EXT_LOONGSON_3A;
-
     case mach_mips_sb1:
       return elfcpp::AFL_EXT_SB1;
 
@@ -9186,7 +9164,7 @@ Target_mips<size, big_endian>::infer_abiflags(
       && abiflags->fp_abi != elfcpp::Val_GNU_MIPS_ABI_FP_SOFT
       && abiflags->fp_abi != elfcpp::Val_GNU_MIPS_ABI_FP_64A
       && abiflags->isa_level >= 32
-      && abiflags->isa_ext != elfcpp::AFL_EXT_LOONGSON_3A)
+      && abiflags->ases != elfcpp::AFL_ASE_LOONGSON_EXT)
     abiflags->flags1 |= elfcpp::AFL_FLAGS1_ODDSPREG;
 }
 
@@ -12556,8 +12534,12 @@ Target_mips<size, big_endian>::elf_mips_mach_name(elfcpp::Elf_Word e_flags)
       return "mips:loongson_2e";
     case elfcpp::E_MIPS_MACH_LS2F:
       return "mips:loongson_2f";
-    case elfcpp::E_MIPS_MACH_LS3A:
-      return "mips:loongson_3a";
+    case elfcpp::E_MIPS_MACH_GS464:
+      return "mips:gs464";
+    case elfcpp::E_MIPS_MACH_GS464E:
+      return "mips:gs464e";
+    case elfcpp::E_MIPS_MACH_GS264E:
+      return "mips:gs264e";
     case elfcpp::E_MIPS_MACH_OCTEON:
       return "mips:octeon";
     case elfcpp::E_MIPS_MACH_OCTEON2:
@@ -12633,6 +12615,7 @@ const Target::Target_info Target_mips<size, big_endian>::mips_info =
   NULL,                 // attributes_vendor
   "__start",           // entry_symbol_name
   32,                  // hash_entry_size
+  elfcpp::SHT_PROGBITS,        // unwind_section_type
 };
 
 template<int size, bool big_endian>
@@ -12673,6 +12656,7 @@ const Target::Target_info Target_mips_nacl<size, big_endian>::mips_nacl_info =
   NULL,                 // attributes_vendor
   "_start",             // entry_symbol_name
   32,                  // hash_entry_size
+  elfcpp::SHT_PROGBITS,        // unwind_section_type
 };
 
 // Target selector for Mips.  Note this is never instantiated directly.
This page took 0.026806 seconds and 4 git commands to generate.