summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/ELF/OutputSections.cpp16
-rw-r--r--lld/ELF/OutputSections.h1
-rw-r--r--lld/ELF/Writer.cpp12
3 files changed, 13 insertions, 16 deletions
diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp
index b456ac6fe79..fd68ab5dcb4 100644
--- a/lld/ELF/OutputSections.cpp
+++ b/lld/ELF/OutputSections.cpp
@@ -90,14 +90,22 @@ GotSection<ELFT>::GotSection()
}
template <class ELFT> void GotSection<ELFT>::addEntry(SymbolBody &Sym) {
+ if (Config->EMachine == EM_MIPS) {
+ if (Sym.isPreemptible())
+ // All symbols with MIPS GOT entries should be represented
+ // in the dynamic symbols table. See "Global Offset Table" in Chapter 5:
+ // ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf
+ Sym.MustBeInDynSym = true;
+ else {
+ // FIXME (simon): Do not add so many redundant entries.
+ ++MipsLocalEntries;
+ return;
+ }
+ }
Sym.GotIndex = Entries.size();
Entries.push_back(&Sym);
}
-template <class ELFT> void GotSection<ELFT>::addMipsLocalEntry() {
- ++MipsLocalEntries;
-}
-
template <class ELFT> bool GotSection<ELFT>::addDynTlsEntry(SymbolBody &Sym) {
if (Sym.hasGlobalDynIndex())
return false;
diff --git a/lld/ELF/OutputSections.h b/lld/ELF/OutputSections.h
index 13259bde088..0b4edb9e355 100644
--- a/lld/ELF/OutputSections.h
+++ b/lld/ELF/OutputSections.h
@@ -100,7 +100,6 @@ public:
void finalize() override;
void writeTo(uint8_t *Buf) override;
void addEntry(SymbolBody &Sym);
- void addMipsLocalEntry();
bool addDynTlsEntry(SymbolBody &Sym);
bool addTlsIndex();
bool empty() const { return MipsLocalEntries == 0 && Entries.empty(); }
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 377eed4c838..a5887f73c44 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -335,14 +335,6 @@ void Writer<ELFT>::scanRelocs(InputSectionBase<ELFT> &C,
Out<ELFT>::RelaDyn->addReloc({Target->RelativeRel, &C, RI.r_offset, true,
&Body, getAddend<ELFT>(RI)});
- // MIPS has a special rule to create GOTs for local symbols.
- if (Config->EMachine == EM_MIPS && !Preemptible &&
- Target->needsGot(Type, Body)) {
- // FIXME (simon): Do not add so many redundant entries.
- Out<ELFT>::Got->addMipsLocalEntry();
- continue;
- }
-
// If a symbol in a DSO is referenced directly instead of through GOT,
// we need to create a copy relocation for the symbol.
if (auto *B = dyn_cast<SharedSymbol<ELFT>>(&Body)) {
@@ -407,15 +399,13 @@ void Writer<ELFT>::scanRelocs(InputSectionBase<ELFT> &C,
continue;
Out<ELFT>::Got->addEntry(Body);
- if (Config->EMachine == EM_MIPS) {
+ if (Config->EMachine == EM_MIPS)
// MIPS ABI has special rules to process GOT entries
// and doesn't require relocation entries for them.
// See "Global Offset Table" in Chapter 5 in the following document
// for detailed description:
// ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf
- Body.MustBeInDynSym = true;
continue;
- }
bool Dynrel = Config->Pic && !Target->isRelRelative(Type) &&
!Target->isSizeRel(Type);
OpenPOWER on IntegriCloud