diff options
author | Simon Atanasyan <simon@atanasyan.com> | 2015-05-26 06:05:07 +0000 |
---|---|---|
committer | Simon Atanasyan <simon@atanasyan.com> | 2015-05-26 06:05:07 +0000 |
commit | e62aa7457f60bfb19c598e59e703eb8e1d090194 (patch) | |
tree | 7a0b34046cda463e5bbf4ce3fc2eb8a06e52a242 | |
parent | e09faec16e9ec931ed61821e80906dc6bd6af809 (diff) | |
download | bcm5719-llvm-e62aa7457f60bfb19c598e59e703eb8e1d090194.tar.gz bcm5719-llvm-e62aa7457f60bfb19c598e59e703eb8e1d090194.zip |
[Mips] Add Elf_Mips_Options::getRegInfoDesc() function to retrieve an ODK_REGINFO descriptor
No functional changes.
llvm-svn: 238176
-rw-r--r-- | lld/lib/ReaderWriter/ELF/Mips/MipsELFFile.h | 6 | ||||
-rw-r--r-- | lld/lib/ReaderWriter/ELF/Mips/MipsReginfo.h | 6 |
2 files changed, 9 insertions, 3 deletions
diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsELFFile.h b/lld/lib/ReaderWriter/ELF/Mips/MipsELFFile.h index 0780b65e8c4..46850c4da16 100644 --- a/lld/lib/ReaderWriter/ELF/Mips/MipsELFFile.h +++ b/lld/lib/ReaderWriter/ELF/Mips/MipsELFFile.h @@ -178,9 +178,9 @@ private: const auto *opt = reinterpret_cast<const Elf_Mips_Options *>(raw.data()); if (opt->kind == ODK_REGINFO) { - const auto *regInfo = reinterpret_cast<const Elf_RegInfo *>(opt + 1); - ctx.mergeReginfoMask(*regInfo); - _gp0 = regInfo->ri_gp_value; + const Elf_RegInfo ®Info = opt->getRegInfoDesc(); + ctx.mergeReginfoMask(regInfo); + _gp0 = regInfo.ri_gp_value; break; } raw = raw.slice(opt->size); diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsReginfo.h b/lld/lib/ReaderWriter/ELF/Mips/MipsReginfo.h index bd64c95abfe..dd0cf3c0ebd 100644 --- a/lld/lib/ReaderWriter/ELF/Mips/MipsReginfo.h +++ b/lld/lib/ReaderWriter/ELF/Mips/MipsReginfo.h @@ -41,6 +41,12 @@ template <class ELFT> struct Elf_Mips_Options { 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. |