diff options
author | Brad King <brad.king@kitware.com> | 2015-09-14 13:21:00 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-09-14 13:21:00 (GMT) |
commit | 6dad4c25b06ae232c766d76747b080373fb2499d (patch) | |
tree | 6573b8fc698dc01d0e68d93459ccb23958e2c8e1 | |
parent | f660a6890cdd8931d5f820f34d59ab9217a6d02b (diff) | |
parent | db7f069a4b33f3e8b45142b67289e51c142c90b4 (diff) | |
download | CMake-6dad4c25b06ae232c766d76747b080373fb2499d.zip CMake-6dad4c25b06ae232c766d76747b080373fb2499d.tar.gz CMake-6dad4c25b06ae232c766d76747b080373fb2499d.tar.bz2 |
Merge topic 'fix_64bit_autodef'
db7f069a Windows: Fix 64-bit DLL module definition file generation on VS 2015
-rw-r--r-- | Source/bindexplib.cxx | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/Source/bindexplib.cxx b/Source/bindexplib.cxx index 11e3f34..dc4db63 100644 --- a/Source/bindexplib.cxx +++ b/Source/bindexplib.cxx @@ -173,7 +173,7 @@ public: */ DumpSymbols(ObjectHeaderType* ih, - FILE* fout) { + FILE* fout, bool is64) { this->ObjectImageHeader = ih; this->SymbolTable = (SymbolTableType*) ((DWORD_PTR)this->ObjectImageHeader @@ -183,6 +183,7 @@ public: GetSectionHeaderOffset(this->ObjectImageHeader); this->ImportFlag = true; this->SymbolCount = this->ObjectImageHeader->NumberOfSymbols; + this->Is64Bit = is64; } /* @@ -287,7 +288,14 @@ public: symbol.erase(posAt); } } - if (symbol[0] == '_') symbol.erase(0,1); + // For 64 bit builds we don't need to remove _ + if(!this->Is64Bit) + { + if (symbol[0] == '_') + { + symbol.erase(0,1); + } + } if (this->ImportFlag) { this->ImportFlag = false; fprintf(this->FileOut,"EXPORTS \n"); @@ -355,6 +363,7 @@ private: PIMAGE_SECTION_HEADER SectionHeaders; ObjectHeaderType* ObjectImageHeader; SymbolTableType* SymbolTable; + bool Is64Bit; }; bool @@ -406,7 +415,8 @@ DumpFile(const char* filename, FILE *fout) * and IMAGE_FILE_HEADER.SizeOfOptionalHeader == 0; */ DumpSymbols<IMAGE_FILE_HEADER, IMAGE_SYMBOL> - symbolDumper((PIMAGE_FILE_HEADER) lpFileBase, fout); + symbolDumper((PIMAGE_FILE_HEADER) lpFileBase, fout, + (dosHeader->e_magic == IMAGE_FILE_MACHINE_AMD64)); symbolDumper.DumpObjFile(); } else { // check for /bigobj format @@ -414,7 +424,8 @@ DumpFile(const char* filename, FILE *fout) (cmANON_OBJECT_HEADER_BIGOBJ*) lpFileBase; if(h->Sig1 == 0x0 && h->Sig2 == 0xffff) { DumpSymbols<cmANON_OBJECT_HEADER_BIGOBJ, cmIMAGE_SYMBOL_EX> - symbolDumper((cmANON_OBJECT_HEADER_BIGOBJ*) lpFileBase, fout); + symbolDumper((cmANON_OBJECT_HEADER_BIGOBJ*) lpFileBase, fout, + (dosHeader->e_magic == IMAGE_FILE_MACHINE_AMD64)); symbolDumper.DumpObjFile(); } else { printf("unrecognized file format in '%s'\n", filename); |