[lld] r238189 - [Mips] Use structures declared in the llvm/Object/ELFTypes.h
Simon Atanasyan
simon at atanasyan.com
Tue May 26 01:48:33 PDT 2015
Author: atanasyan
Date: Tue May 26 03:48:33 2015
New Revision: 238189
URL: http://llvm.org/viewvc/llvm-project?rev=238189&view=rev
Log:
[Mips] Use structures declared in the llvm/Object/ELFTypes.h
No functional changes.
Modified:
lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h
lld/trunk/lib/ReaderWriter/ELF/Mips/MipsReginfo.h
lld/trunk/lib/ReaderWriter/ELF/Mips/MipsSectionChunks.h
Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h?rev=238189&r1=238188&r2=238189&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsELFFile.h Tue May 26 03:48:33 2015
@@ -159,7 +159,7 @@ private:
_dtpOff = sec->sh_addr + DTP_OFFSET;
}
- typedef llvm::object::Elf_RegInfo<ELFT> Elf_RegInfo;
+ typedef llvm::object::Elf_Mips_RegInfo<ELFT> Elf_Mips_RegInfo;
typedef llvm::object::Elf_Mips_Options<ELFT> Elf_Mips_Options;
auto &ctx = static_cast<MipsLinkingContext &>(this->_ctx);
@@ -178,7 +178,7 @@ private:
const auto *opt =
reinterpret_cast<const Elf_Mips_Options *>(raw.data());
if (opt->kind == ODK_REGINFO) {
- const Elf_RegInfo ®Info = opt->getRegInfoDesc();
+ const Elf_Mips_RegInfo ®Info = opt->getRegInfo();
ctx.mergeReginfoMask(regInfo);
_gp0 = regInfo.ri_gp_value;
break;
@@ -191,11 +191,12 @@ private:
return ec;
ArrayRef<uint8_t> raw = contents.get();
- if (raw.size() != sizeof(Elf_RegInfo))
+ if (raw.size() != sizeof(Elf_Mips_RegInfo))
return make_dynamic_error_code(
StringRef("Invalid size of MIPS_REGINFO section"));
- const auto *regInfo = reinterpret_cast<const Elf_RegInfo *>(raw.data());
+ const auto *regInfo =
+ reinterpret_cast<const Elf_Mips_RegInfo *>(raw.data());
ctx.mergeReginfoMask(*regInfo);
_gp0 = regInfo->ri_gp_value;
}
Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsReginfo.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsReginfo.h?rev=238189&r1=238188&r2=238189&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsReginfo.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsReginfo.h Tue May 26 03:48:33 2015
@@ -11,47 +11,6 @@
#include "llvm/Object/ELFTypes.h"
-namespace llvm {
-namespace object {
-
-template <class ELFT>
-struct Elf_RegInfo;
-
-template <llvm::support::endianness TargetEndianness, std::size_t MaxAlign>
-struct Elf_RegInfo<ELFType<TargetEndianness, MaxAlign, false>> {
- LLVM_ELF_IMPORT_TYPES(TargetEndianness, MaxAlign, false)
- Elf_Word ri_gprmask; // bit-mask of used general registers
- Elf_Word ri_cprmask[4]; // bit-mask of used co-processor registers
- Elf_Addr ri_gp_value; // gp register value
-};
-
-template <llvm::support::endianness TargetEndianness, std::size_t MaxAlign>
-struct Elf_RegInfo<ELFType<TargetEndianness, MaxAlign, true>> {
- LLVM_ELF_IMPORT_TYPES(TargetEndianness, MaxAlign, true)
- Elf_Word ri_gprmask; // bit-mask of used general registers
- Elf_Word ri_pad; // unused padding field
- Elf_Word ri_cprmask[4]; // bit-mask of used co-processor registers
- Elf_Addr ri_gp_value; // gp register value
-};
-
-template <class ELFT> struct Elf_Mips_Options {
- LLVM_ELF_IMPORT_TYPES_ELFT(ELFT)
- uint8_t kind; // Determines interpretation of variable part of descriptor
- uint8_t size; // Byte size of descriptor, including this header
- Elf_Half section; // Section header index of section affected,
- // or 0 for global options
- Elf_Word info; // Kind-specific information
-
- const Elf_RegInfo<ELFT> &getRegInfoDesc() const {
- assert(kind == llvm::ELF::ODK_REGINFO);
- return *reinterpret_cast<const Elf_RegInfo<ELFT> *>(
- (const uint8_t *)this + sizeof(Elf_Mips_Options));
- }
-};
-
-} // end namespace object.
-} // end namespace llvm.
-
namespace lld {
namespace elf {
Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsSectionChunks.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsSectionChunks.h?rev=238189&r1=238188&r2=238189&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsSectionChunks.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsSectionChunks.h Tue May 26 03:48:33 2015
@@ -27,9 +27,9 @@ public:
: Section<ELFT>(ctx, ".reginfo", "MipsReginfo"),
_targetLayout(targetLayout) {
this->setOrder(MipsTargetLayout<ELFT>::ORDER_MIPS_REGINFO);
- this->_entSize = sizeof(Elf_RegInfo);
- this->_fsize = sizeof(Elf_RegInfo);
- this->_msize = sizeof(Elf_RegInfo);
+ this->_entSize = sizeof(Elf_Mips_RegInfo);
+ this->_fsize = sizeof(Elf_Mips_RegInfo);
+ this->_msize = sizeof(Elf_Mips_RegInfo);
this->_alignment = 4;
this->_type = SHT_MIPS_REGINFO;
this->_flags = SHF_ALLOC;
@@ -60,9 +60,9 @@ public:
}
private:
- typedef llvm::object::Elf_RegInfo<ELFT> Elf_RegInfo;
+ typedef llvm::object::Elf_Mips_RegInfo<ELFT> Elf_Mips_RegInfo;
- Elf_RegInfo _reginfo;
+ Elf_Mips_RegInfo _reginfo;
MipsTargetLayout<ELFT> &_targetLayout;
};
@@ -80,7 +80,7 @@ public:
this->_entSize = 1;
this->_alignment = 8;
this->_fsize = llvm::RoundUpToAlignment(
- sizeof(Elf_Mips_Options) + sizeof(Elf_RegInfo), this->_alignment);
+ sizeof(Elf_Mips_Options) + sizeof(Elf_Mips_RegInfo), this->_alignment);
this->_msize = this->_fsize;
this->_type = SHT_MIPS_OPTIONS;
this->_flags = SHF_ALLOC | SHF_MIPS_NOSTRIP;
@@ -117,10 +117,10 @@ public:
private:
typedef llvm::object::Elf_Mips_Options<ELFT> Elf_Mips_Options;
- typedef llvm::object::Elf_RegInfo<ELFT> Elf_RegInfo;
+ typedef llvm::object::Elf_Mips_RegInfo<ELFT> Elf_Mips_RegInfo;
Elf_Mips_Options _header;
- Elf_RegInfo _reginfo;
+ Elf_Mips_RegInfo _reginfo;
MipsTargetLayout<ELFT> &_targetLayout;
};
More information about the llvm-commits
mailing list