diff options
Diffstat (limited to 'Source/cmELF.cxx')
-rw-r--r-- | Source/cmELF.cxx | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx index deffdb6..9a474e3 100644 --- a/Source/cmELF.cxx +++ b/Source/cmELF.cxx @@ -168,6 +168,9 @@ public: // Return the recorded ELF type. cmELF::FileType GetFileType() const { return this->ELFType; } + // Return the recorded machine. + std::uint16_t GetMachine() const { return this->Machine; } + protected: // Data common to all ELF class implementations. @@ -183,6 +186,9 @@ protected: // The ELF file type. cmELF::FileType ELFType; + // The ELF architecture. + std::uint16_t Machine; + // Whether we need to byte-swap structures read from the stream. bool NeedSwap; @@ -478,6 +484,8 @@ cmELFInternalImpl<Types>::cmELFInternalImpl(cmELF* external, } } + this->Machine = this->ELFHeader.e_machine; + // Load the section headers. this->SectionHeaders.resize(this->ELFHeader.e_shnum); for (ELF_Half i = 0; i < this->ELFHeader.e_shnum; ++i) { @@ -757,6 +765,14 @@ cmELF::FileType cmELF::GetFileType() const return FileTypeInvalid; } +std::uint16_t cmELF::GetMachine() const +{ + if (this->Valid()) { + return this->Internal->GetMachine(); + } + return 0; +} + unsigned int cmELF::GetNumberOfSections() const { if (this->Valid()) { |