// 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.
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.
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.
// 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
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_;
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,
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);
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.
range->max_addend = addend;
*range_ptr = range;
- ++entry->num_pages;
- if (entry2 != NULL)
- ++entry2->num_pages;
++this->page_gotno_;
++g2->page_gotno_;
return;
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;
}
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.
// 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);
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;
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;
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;
&& 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;
}
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: