[lld] r297825 - [ELF] - Detemplate MipsRldMapSection. NFC.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 15 05:02:32 PDT 2017
Author: grimar
Date: Wed Mar 15 07:02:31 2017
New Revision: 297825
URL: http://llvm.org/viewvc/llvm-project?rev=297825&view=rev
Log:
[ELF] - Detemplate MipsRldMapSection. NFC.
After introducing Config->is64Bit() and
recent changes in LinkerScriptBase, some
sections can be detemplated trivially. This
is one of such cases.
Modified:
lld/trunk/ELF/SyntheticSections.cpp
lld/trunk/ELF/SyntheticSections.h
lld/trunk/ELF/Writer.cpp
Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=297825&r1=297824&r2=297825&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Wed Mar 15 07:02:31 2017
@@ -2204,14 +2204,13 @@ size_t MergeSyntheticSection::getSize()
return Builder.getSize();
}
-template <class ELFT>
-MipsRldMapSection<ELFT>::MipsRldMapSection()
+MipsRldMapSection::MipsRldMapSection()
: SyntheticSection(SHF_ALLOC | SHF_WRITE, SHT_PROGBITS,
- sizeof(typename ELFT::uint), ".rld_map") {}
+ Config->is64Bit() ? 8 : 4, ".rld_map") {}
-template <class ELFT> void MipsRldMapSection<ELFT>::writeTo(uint8_t *Buf) {
+void MipsRldMapSection::writeTo(uint8_t *Buf) {
// Apply filler from linker script.
- uint64_t Filler = Script<ELFT>::X->getFiller(this->Name);
+ uint64_t Filler = ScriptBase->getFiller(this->Name);
Filler = (Filler << 32) | Filler;
memcpy(Buf, &Filler, getSize());
}
@@ -2372,11 +2371,6 @@ template class elf::VersionDefinitionSec
template class elf::VersionDefinitionSection<ELF64LE>;
template class elf::VersionDefinitionSection<ELF64BE>;
-template class elf::MipsRldMapSection<ELF32LE>;
-template class elf::MipsRldMapSection<ELF32BE>;
-template class elf::MipsRldMapSection<ELF64LE>;
-template class elf::MipsRldMapSection<ELF64BE>;
-
template class elf::ARMExidxSentinelSection<ELF32LE>;
template class elf::ARMExidxSentinelSection<ELF32BE>;
template class elf::ARMExidxSentinelSection<ELF64LE>;
Modified: lld/trunk/ELF/SyntheticSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.h?rev=297825&r1=297824&r2=297825&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.h (original)
+++ lld/trunk/ELF/SyntheticSections.h Wed Mar 15 07:02:31 2017
@@ -715,10 +715,10 @@ private:
// of executable file which is pointed to by the DT_MIPS_RLD_MAP entry.
// See "Dynamic section" in Chapter 5 in the following document:
// ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf
-template <class ELFT> class MipsRldMapSection : public SyntheticSection {
+class MipsRldMapSection : public SyntheticSection {
public:
MipsRldMapSection();
- size_t getSize() const override { return sizeof(typename ELFT::uint); }
+ size_t getSize() const override { return Config->is64Bit() ? 8 : 4; }
void writeTo(uint8_t *Buf) override;
};
@@ -777,7 +777,7 @@ template <class ELFT> struct In {
static IgotPltSection *IgotPlt;
static HashTableSection<ELFT> *HashTab;
static InputSection *Interp;
- static MipsRldMapSection<ELFT> *MipsRldMap;
+ static MipsRldMapSection *MipsRldMap;
static PltSection<ELFT> *Plt;
static PltSection<ELFT> *Iplt;
static RelocationSection<ELFT> *RelaDyn;
@@ -809,7 +809,7 @@ template <class ELFT> GotPltSection *In<
template <class ELFT> IgotPltSection *In<ELFT>::IgotPlt;
template <class ELFT> HashTableSection<ELFT> *In<ELFT>::HashTab;
template <class ELFT> InputSection *In<ELFT>::Interp;
-template <class ELFT> MipsRldMapSection<ELFT> *In<ELFT>::MipsRldMap;
+template <class ELFT> MipsRldMapSection *In<ELFT>::MipsRldMap;
template <class ELFT> PltSection<ELFT> *In<ELFT>::Plt;
template <class ELFT> PltSection<ELFT> *In<ELFT>::Iplt;
template <class ELFT> RelocationSection<ELFT> *In<ELFT>::RelaDyn;
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=297825&r1=297824&r2=297825&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Wed Mar 15 07:02:31 2017
@@ -378,7 +378,7 @@ template <class ELFT> void Writer<ELFT>:
Config->ExportDynamic;
if (Config->EMachine == EM_MIPS) {
if (!Config->Shared && HasDynSymTab) {
- In<ELFT>::MipsRldMap = make<MipsRldMapSection<ELFT>>();
+ In<ELFT>::MipsRldMap = make<MipsRldMapSection>();
Add(In<ELFT>::MipsRldMap);
}
if (auto *Sec = MipsAbiFlagsSection<ELFT>::create())
More information about the llvm-commits
mailing list