[PATCH] D18302: [ELF][MIPS] Delete GotSection::addMipsLocalEntry method
Simon Atanasyan via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 20 05:03:54 PDT 2016
atanasyan created this revision.
atanasyan added reviewers: ruiu, rafael.
atanasyan added a subscriber: llvm-commits.
atanasyan set the repository for this revision to rL LLVM.
atanasyan added a project: lld.
Now local symbols have SymbolBody so we can handle all kind of symbols in the GotSection::addEntry method. The patch moves the code from addMipsLocalEntry to addEntry.
Repository:
rL LLVM
http://reviews.llvm.org/D18302
Files:
ELF/OutputSections.cpp
ELF/OutputSections.h
ELF/Writer.cpp
Index: ELF/Writer.cpp
===================================================================
--- ELF/Writer.cpp
+++ ELF/Writer.cpp
@@ -335,14 +335,6 @@
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)) {
@@ -413,7 +405,8 @@
// 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;
+ if (Body.isPreemptible())
+ Body.MustBeInDynSym = true;
continue;
}
Index: ELF/OutputSections.h
===================================================================
--- ELF/OutputSections.h
+++ ELF/OutputSections.h
@@ -100,7 +100,6 @@
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(); }
Index: ELF/OutputSections.cpp
===================================================================
--- ELF/OutputSections.cpp
+++ ELF/OutputSections.cpp
@@ -90,14 +90,15 @@
}
template <class ELFT> void GotSection<ELFT>::addEntry(SymbolBody &Sym) {
+ if (Config->EMachine == EM_MIPS && (Sym.isLocal() || !Sym.isPreemptible())) {
+ // 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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18302.51127.patch
Type: text/x-patch
Size: 2305 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160320/42e6bea8/attachment.bin>
More information about the llvm-commits
mailing list