summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorMikhail Paulyshka <me@mixaill.tk>2017-03-22 14:57:02 (GMT)
committerBrad King <brad.king@kitware.com>2017-04-04 12:52:46 (GMT)
commit48fa291469e5e8b3ae88fb846750df72468eb58a (patch)
tree57d41d9c7a5ad938829d5ff4e3885d3f150e07d4 /Source
parent97c605fd5bca193d0aeb90a4985fbccc884401ec (diff)
downloadCMake-48fa291469e5e8b3ae88fb846750df72468eb58a.zip
CMake-48fa291469e5e8b3ae88fb846750df72468eb58a.tar.gz
CMake-48fa291469e5e8b3ae88fb846750df72468eb58a.tar.bz2
bindexplib: add ARM support
Fixes: #16728
Diffstat (limited to 'Source')
-rw-r--r--Source/bindexplib.cxx28
1 files changed, 16 insertions, 12 deletions
diff --git a/Source/bindexplib.cxx b/Source/bindexplib.cxx
index 4839ec8..75a2177 100644
--- a/Source/bindexplib.cxx
+++ b/Source/bindexplib.cxx
@@ -68,6 +68,10 @@
#include <iostream>
#include <windows.h>
+#ifndef IMAGE_FILE_MACHINE_ARMNT
+#define IMAGE_FILE_MACHINE_ARMNT 0x01c4
+#endif
+
typedef struct cmANON_OBJECT_HEADER_BIGOBJ
{
/* same as ANON_OBJECT_HEADER_V2 */
@@ -166,7 +170,7 @@ public:
*/
DumpSymbols(ObjectHeaderType* ih, std::set<std::string>& symbols,
- std::set<std::string>& dataSymbols, bool is64)
+ std::set<std::string>& dataSymbols, bool isI386)
: Symbols(symbols)
, DataSymbols(dataSymbols)
{
@@ -176,7 +180,7 @@ public:
this->ObjectImageHeader->PointerToSymbolTable);
this->SectionHeaders = GetSectionHeaderOffset(this->ObjectImageHeader);
this->SymbolCount = this->ObjectImageHeader->NumberOfSymbols;
- this->Is64Bit = is64;
+ this->IsI386 = isI386;
}
/*
@@ -231,12 +235,11 @@ public:
symbol.erase(posAt);
}
}
- // For 64 bit builds we don't need to remove _
- if (!this->Is64Bit) {
- if (symbol[0] == '_') {
- symbol.erase(0, 1);
- }
+ // For i386 builds we don't need to remove _
+ if (this->IsI386 && symbol[0] == '_') {
+ symbol.erase(0, 1);
}
+
/*
Check whether it is "Scalar deleting destructor" and
"Vector deleting destructor"
@@ -283,7 +286,7 @@ private:
PIMAGE_SECTION_HEADER SectionHeaders;
ObjectHeaderType* ObjectImageHeader;
SymbolTableType* SymbolTable;
- bool Is64Bit;
+ bool IsI386;
};
bool DumpFile(const char* filename, std::set<std::string>& symbols,
@@ -323,9 +326,10 @@ bool DumpFile(const char* filename, std::set<std::string>& symbols,
fprintf(stderr, "File is an executable. I don't dump those.\n");
return false;
}
- /* Does it look like a i386 COFF OBJ file??? */
+ /* Does it look like a COFF OBJ file??? */
else if (((dosHeader->e_magic == IMAGE_FILE_MACHINE_I386) ||
- (dosHeader->e_magic == IMAGE_FILE_MACHINE_AMD64)) &&
+ (dosHeader->e_magic == IMAGE_FILE_MACHINE_AMD64) ||
+ (dosHeader->e_magic == IMAGE_FILE_MACHINE_ARMNT)) &&
(dosHeader->e_sp == 0)) {
/*
* The two tests above aren't what they look like. They're
@@ -334,7 +338,7 @@ bool DumpFile(const char* filename, std::set<std::string>& symbols,
*/
DumpSymbols<IMAGE_FILE_HEADER, IMAGE_SYMBOL> symbolDumper(
(PIMAGE_FILE_HEADER)lpFileBase, symbols, dataSymbols,
- (dosHeader->e_magic == IMAGE_FILE_MACHINE_AMD64));
+ (dosHeader->e_magic == IMAGE_FILE_MACHINE_I386));
symbolDumper.DumpObjFile();
} else {
// check for /bigobj format
@@ -342,7 +346,7 @@ bool DumpFile(const char* filename, std::set<std::string>& symbols,
if (h->Sig1 == 0x0 && h->Sig2 == 0xffff) {
DumpSymbols<cmANON_OBJECT_HEADER_BIGOBJ, cmIMAGE_SYMBOL_EX> symbolDumper(
(cmANON_OBJECT_HEADER_BIGOBJ*)lpFileBase, symbols, dataSymbols,
- (h->Machine == IMAGE_FILE_MACHINE_AMD64));
+ (h->Machine == IMAGE_FILE_MACHINE_I386));
symbolDumper.DumpObjFile();
} else {
printf("unrecognized file format in '%s'\n", filename);