diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2021-07-12 19:38:43 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2021-07-12 20:11:38 (GMT) |
commit | b2c03347b07e24a5298361451277264fda8fdb4c (patch) | |
tree | a75226752cd15e5b81a079c3410ca54540de51a3 /Source/cmELF.cxx | |
parent | ac984cb5f75349fd5ed00cc52fbb5154b7bb1527 (diff) | |
download | CMake-b2c03347b07e24a5298361451277264fda8fdb4c.zip CMake-b2c03347b07e24a5298361451277264fda8fdb4c.tar.gz CMake-b2c03347b07e24a5298361451277264fda8fdb4c.tar.bz2 |
file(GET_RUNTIME_DEPENDENCIES): Check architecture of dependencies
Fixes: #22106
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()) { |