[Cmake-commits] CMake branch, next, updated. v3.8.0-rc4-657-gf1b78a0
Kitware Robot
kwrobot at kitware.com
Mon Apr 3 10:55:03 EDT 2017
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via f1b78a0c9faf963a332ea505adfc0b747e4631f1 (commit)
via 74a94b30c0cef42b9dee71780e852a865f652f30 (commit)
via c2c22862287971035157fb732faf925df7832dbb (commit)
via 35690c8d82f81d0d94c759183f80a31527ac9de3 (commit)
via 97c605fd5bca193d0aeb90a4985fbccc884401ec (commit)
via 7a8860afbc614f2215e083adadb25963fe8f4dfe (commit)
from ee8630803972840bb67a94c975dab79c3f59c416 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f1b78a0c9faf963a332ea505adfc0b747e4631f1
commit f1b78a0c9faf963a332ea505adfc0b747e4631f1
Merge: 74a94b3 35690c8
Author: Brad King <brad.king at kitware.com>
AuthorDate: Mon Apr 3 14:52:56 2017 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
CommitDate: Mon Apr 3 10:53:00 2017 -0400
Stage topic 'bindexplib-arm'
Topic-id: 23166
Topic-url: https://gitlab.kitware.com/cmake/cmake/merge_requests/604
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=74a94b30c0cef42b9dee71780e852a865f652f30
commit 74a94b30c0cef42b9dee71780e852a865f652f30
Merge: ee86308 c2c2286
Author: Brad King <brad.king at kitware.com>
AuthorDate: Mon Apr 3 14:46:22 2017 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
CommitDate: Mon Apr 3 10:46:25 2017 -0400
Stage topic 'test-CMake.GetPrerequisites-config-message'
Topic-id: 23435
Topic-url: https://gitlab.kitware.com/cmake/cmake/merge_requests/654
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c2c22862287971035157fb732faf925df7832dbb
commit c2c22862287971035157fb732faf925df7832dbb
Author: Brad King <brad.king at kitware.com>
AuthorDate: Fri Mar 31 15:20:01 2017 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Mon Apr 3 10:45:03 2017 -0400
Tests: Fix CMake.GetPrerequisites test config message
Since commit v2.8.11~239^2~1 (ProcessorCount test: fix path to
cmsysTestsCxx executable, 2013-01-24) we accidentally printed a literal
`${CTEST_CONFIGURATION_TYPE}` instead of the actual build configuration.
Update the message to use a generator expression to get the real build
configuration used.
diff --git a/Tests/CMakeTests/CMakeLists.txt b/Tests/CMakeTests/CMakeLists.txt
index d5524c3..1cca35d 100644
--- a/Tests/CMakeTests/CMakeLists.txt
+++ b/Tests/CMakeTests/CMakeLists.txt
@@ -53,10 +53,7 @@ set(EndStuff_PreArgs
)
AddCMakeTest(EndStuff "${EndStuff_PreArgs}")
-set(GetPrerequisites_PreArgs
- "-DCTEST_CONFIGURATION_TYPE:STRING=\\\${CTEST_CONFIGURATION_TYPE}"
- )
-AddCMakeTest(GetPrerequisites "${GetPrerequisites_PreArgs}")
+AddCMakeTest(GetPrerequisites "-DConfiguration:STRING=$<CONFIGURATION>")
if(GIT_EXECUTABLE)
set(PolicyCheck_PreArgs
diff --git a/Tests/CMakeTests/GetPrerequisitesTest.cmake.in b/Tests/CMakeTests/GetPrerequisitesTest.cmake.in
index 89ca735..7325b87 100644
--- a/Tests/CMakeTests/GetPrerequisitesTest.cmake.in
+++ b/Tests/CMakeTests/GetPrerequisitesTest.cmake.in
@@ -2,18 +2,15 @@
#
include(GetPrerequisites)
-set(CMAKE_BUILD_TYPE "@CMAKE_BUILD_TYPE@")
-set(CMAKE_CONFIGURATION_TYPES "@CMAKE_CONFIGURATION_TYPES@")
set(CMAKE_EXECUTABLE_SUFFIX "@CMAKE_EXECUTABLE_SUFFIX@")
message(STATUS "=============================================================================")
message(STATUS "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)")
message(STATUS "")
-message(STATUS "CMAKE_BUILD_TYPE='${CMAKE_BUILD_TYPE}'")
-message(STATUS "CMAKE_CONFIGURATION_TYPES='${CMAKE_CONFIGURATION_TYPES}'")
+message(STATUS "Configuration '${Configuration}'")
+message(STATUS "CMAKE_COMMAND='${CMAKE_COMMAND}'")
message(STATUS "CMAKE_EXECUTABLE_SUFFIX='${CMAKE_EXECUTABLE_SUFFIX}'")
-message(STATUS "CTEST_CONFIGURATION_TYPE='${CTEST_CONFIGURATION_TYPE}'")
message(STATUS "")
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=35690c8d82f81d0d94c759183f80a31527ac9de3
commit 35690c8d82f81d0d94c759183f80a31527ac9de3
Author: Mikhail Paulyshka <me at mixaill.tk>
AuthorDate: Wed Mar 22 17:57:02 2017 +0300
Commit: Brad King <brad.king at kitware.com>
CommitDate: Wed Mar 22 16:20:36 2017 -0400
bindexplib: add ARM support
Fixes: #16728
diff --git a/Source/bindexplib.cxx b/Source/bindexplib.cxx
index 4839ec8..f3d0069 100644
--- a/Source/bindexplib.cxx
+++ b/Source/bindexplib.cxx
@@ -166,7 +166,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 +176,7 @@ public:
this->ObjectImageHeader->PointerToSymbolTable);
this->SectionHeaders = GetSectionHeaderOffset(this->ObjectImageHeader);
this->SymbolCount = this->ObjectImageHeader->NumberOfSymbols;
- this->Is64Bit = is64;
+ this->IsI386 = isI386;
}
/*
@@ -231,12 +231,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 +282,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 +322,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 +334,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 +342,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);
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=97c605fd5bca193d0aeb90a4985fbccc884401ec
commit 97c605fd5bca193d0aeb90a4985fbccc884401ec
Author: Mikhail Paulyshka <me at mixaill.tk>
AuthorDate: Wed Mar 22 17:27:13 2017 +0300
Commit: Brad King <brad.king at kitware.com>
CommitDate: Wed Mar 22 16:20:03 2017 -0400
bindexplib: remove unused code
Remove code not used since commit v3.7.0-rc1~395^2 (bindexplib: Export
symbols from objects even with explicit markup, 2016-06-30).
diff --git a/Source/bindexplib.cxx b/Source/bindexplib.cxx
index dc7f1a9..4839ec8 100644
--- a/Source/bindexplib.cxx
+++ b/Source/bindexplib.cxx
@@ -181,60 +181,6 @@ public:
/*
*----------------------------------------------------------------------
- * HaveExportedObjects --
- *
- * Returns true if export directives (declspec(dllexport)) exist.
- *
- *----------------------------------------------------------------------
- */
-
- bool HaveExportedObjects()
- {
- WORD i = 0;
- size_t size = 0;
- const char* rawdata = 0;
- PIMAGE_SECTION_HEADER pDirectivesSectionHeader = 0;
- PIMAGE_SECTION_HEADER pSectionHeaders = this->SectionHeaders;
- for (i = 0; (i < this->ObjectImageHeader->NumberOfSections &&
- !pDirectivesSectionHeader);
- i++)
- if (!strncmp((const char*)&pSectionHeaders[i].Name[0], ".drectve", 8))
- pDirectivesSectionHeader = &pSectionHeaders[i];
- if (!pDirectivesSectionHeader)
- return 0;
-
- rawdata = (const char*)this->ObjectImageHeader +
- pDirectivesSectionHeader->PointerToRawData;
- if (!pDirectivesSectionHeader->PointerToRawData || !rawdata)
- return 0;
-
- size = pDirectivesSectionHeader->SizeOfRawData;
- const char* posImportFlag = rawdata;
- while ((posImportFlag = StrNStr(posImportFlag, " /EXPORT:", size))) {
- const char* lookingForDict = posImportFlag + 9;
- if (!strncmp(lookingForDict, "_G__cpp_", 8) ||
- !strncmp(lookingForDict, "_G__set_cpp_", 12)) {
- posImportFlag = lookingForDict;
- continue;
- }
-
- const char* lookingForDATA = posImportFlag + 9;
- while (*(++lookingForDATA) && *lookingForDATA != ' ')
- ;
- lookingForDATA -= 5;
- // ignore DATA exports
- if (strncmp(lookingForDATA, ",DATA", 5))
- break;
- posImportFlag = lookingForDATA + 5;
- }
- if (posImportFlag) {
- return true;
- }
- return false;
- }
-
- /*
- *----------------------------------------------------------------------
* DumpObjFile --
*
* Dump an object file's exported symbols.
@@ -319,19 +265,6 @@ public:
}
}
}
- } else if (pSymbolTable->SectionNumber == IMAGE_SYM_UNDEFINED &&
- !pSymbolTable->Type && 0) {
- /*
- * The IMPORT global variable entry points
- */
- if (pSymbolTable->StorageClass == IMAGE_SYM_CLASS_EXTERNAL) {
- symbol = stringTable + pSymbolTable->N.Name.Long;
- while (isspace(symbol[0]))
- symbol.erase(0, 1);
- if (symbol[0] == '_')
- symbol.erase(0, 1);
- this->DataSymbols.insert(symbol);
- }
}
/*
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7a8860afbc614f2215e083adadb25963fe8f4dfe
commit 7a8860afbc614f2215e083adadb25963fe8f4dfe
Author: Mikhail Paulyshka <me at mixaill.tk>
AuthorDate: Wed Mar 22 16:58:32 2017 +0300
Commit: Mikhail Paulyshka <me at mixaill.tk>
CommitDate: Wed Mar 22 18:05:15 2017 +0300
bindexplib: clang-format
diff --git a/Source/.gitattributes b/Source/.gitattributes
index 1cec8a3..f69ad9d 100644
--- a/Source/.gitattributes
+++ b/Source/.gitattributes
@@ -17,5 +17,4 @@
/cmListFileLexer.c generated
# Do not format third-party sources.
-/bindexplib.* -format.clang-format
/kwsys/** -format.clang-format
diff --git a/Source/bindexplib.cxx b/Source/bindexplib.cxx
index 47c7565..dc7f1a9 100644
--- a/Source/bindexplib.cxx
+++ b/Source/bindexplib.cxx
@@ -68,81 +68,84 @@
#include <iostream>
#include <windows.h>
-typedef struct cmANON_OBJECT_HEADER_BIGOBJ {
- /* same as ANON_OBJECT_HEADER_V2 */
- WORD Sig1; // Must be IMAGE_FILE_MACHINE_UNKNOWN
- WORD Sig2; // Must be 0xffff
- WORD Version; // >= 2 (implies the Flags field is present)
- WORD Machine; // Actual machine - IMAGE_FILE_MACHINE_xxx
- DWORD TimeDateStamp;
- CLSID ClassID; // {D1BAA1C7-BAEE-4ba9-AF20-FAF66AA4DCB8}
- DWORD SizeOfData; // Size of data that follows the header
- DWORD Flags; // 0x1 -> contains metadata
- DWORD MetaDataSize; // Size of CLR metadata
- DWORD MetaDataOffset; // Offset of CLR metadata
-
- /* bigobj specifics */
- DWORD NumberOfSections; // extended from WORD
- DWORD PointerToSymbolTable;
- DWORD NumberOfSymbols;
+typedef struct cmANON_OBJECT_HEADER_BIGOBJ
+{
+ /* same as ANON_OBJECT_HEADER_V2 */
+ WORD Sig1; // Must be IMAGE_FILE_MACHINE_UNKNOWN
+ WORD Sig2; // Must be 0xffff
+ WORD Version; // >= 2 (implies the Flags field is present)
+ WORD Machine; // Actual machine - IMAGE_FILE_MACHINE_xxx
+ DWORD TimeDateStamp;
+ CLSID ClassID; // {D1BAA1C7-BAEE-4ba9-AF20-FAF66AA4DCB8}
+ DWORD SizeOfData; // Size of data that follows the header
+ DWORD Flags; // 0x1 -> contains metadata
+ DWORD MetaDataSize; // Size of CLR metadata
+ DWORD MetaDataOffset; // Offset of CLR metadata
+
+ /* bigobj specifics */
+ DWORD NumberOfSections; // extended from WORD
+ DWORD PointerToSymbolTable;
+ DWORD NumberOfSymbols;
} cmANON_OBJECT_HEADER_BIGOBJ;
-typedef struct _cmIMAGE_SYMBOL_EX {
- union {
- BYTE ShortName[8];
- struct {
- DWORD Short; // if 0, use LongName
- DWORD Long; // offset into string table
- } Name;
- DWORD LongName[2]; // PBYTE [2]
- } N;
- DWORD Value;
- LONG SectionNumber;
- WORD Type;
- BYTE StorageClass;
- BYTE NumberOfAuxSymbols;
+typedef struct _cmIMAGE_SYMBOL_EX
+{
+ union
+ {
+ BYTE ShortName[8];
+ struct
+ {
+ DWORD Short; // if 0, use LongName
+ DWORD Long; // offset into string table
+ } Name;
+ DWORD LongName[2]; // PBYTE [2]
+ } N;
+ DWORD Value;
+ LONG SectionNumber;
+ WORD Type;
+ BYTE StorageClass;
+ BYTE NumberOfAuxSymbols;
} cmIMAGE_SYMBOL_EX;
-typedef cmIMAGE_SYMBOL_EX UNALIGNED *cmPIMAGE_SYMBOL_EX;
+typedef cmIMAGE_SYMBOL_EX UNALIGNED* cmPIMAGE_SYMBOL_EX;
-PIMAGE_SECTION_HEADER GetSectionHeaderOffset(PIMAGE_FILE_HEADER
- pImageFileHeader)
+PIMAGE_SECTION_HEADER GetSectionHeaderOffset(
+ PIMAGE_FILE_HEADER pImageFileHeader)
{
- return (PIMAGE_SECTION_HEADER)
- ((DWORD_PTR)pImageFileHeader +
- IMAGE_SIZEOF_FILE_HEADER +
- pImageFileHeader->SizeOfOptionalHeader);
+ return (PIMAGE_SECTION_HEADER)((DWORD_PTR)pImageFileHeader +
+ IMAGE_SIZEOF_FILE_HEADER +
+ pImageFileHeader->SizeOfOptionalHeader);
}
-PIMAGE_SECTION_HEADER GetSectionHeaderOffset(cmANON_OBJECT_HEADER_BIGOBJ*
- pImageFileHeader)
+PIMAGE_SECTION_HEADER GetSectionHeaderOffset(
+ cmANON_OBJECT_HEADER_BIGOBJ* pImageFileHeader)
{
- return (PIMAGE_SECTION_HEADER)
- ((DWORD_PTR)pImageFileHeader +
- sizeof(cmANON_OBJECT_HEADER_BIGOBJ));
+ return (PIMAGE_SECTION_HEADER)((DWORD_PTR)pImageFileHeader +
+ sizeof(cmANON_OBJECT_HEADER_BIGOBJ));
}
/*
+ * Utility func, strstr with size
+ */
-const char* StrNStr(const char* start, const char* find, size_t &size) {
- size_t len;
- const char* hint;
+const char* StrNStr(const char* start, const char* find, size_t& size)
+{
+ size_t len;
+ const char* hint;
- if (!start || !find || !size) {
- size = 0;
- return 0;
- }
- len = strlen(find);
-
- while ((hint = (const char*) memchr(start, find[0], size-len+1))) {
- size -= (hint - start);
- if (!strncmp(hint, find, len))
- return hint;
- start = hint + 1;
- }
-
- size = 0;
- return 0;
+ if (!start || !find || !size) {
+ size = 0;
+ return 0;
+ }
+ len = strlen(find);
+
+ while ((hint = (const char*)memchr(start, find[0], size - len + 1))) {
+ size -= (hint - start);
+ if (!strncmp(hint, find, len))
+ return hint;
+ start = hint + 1;
+ }
+
+ size = 0;
+ return 0;
}
template <
@@ -162,21 +165,19 @@ public:
*----------------------------------------------------------------------
*/
- DumpSymbols(ObjectHeaderType* ih,
- std::set<std::string>& symbols,
- std::set<std::string>& dataSymbols,
- bool is64)
- :Symbols(symbols), DataSymbols(dataSymbols)
- {
- this->ObjectImageHeader = ih;
- this->SymbolTable = (SymbolTableType*)
- ((DWORD_PTR)this->ObjectImageHeader
- + this->ObjectImageHeader->PointerToSymbolTable);
- this->SectionHeaders =
- GetSectionHeaderOffset(this->ObjectImageHeader);
- this->SymbolCount = this->ObjectImageHeader->NumberOfSymbols;
- this->Is64Bit = is64;
- }
+ DumpSymbols(ObjectHeaderType* ih, std::set<std::string>& symbols,
+ std::set<std::string>& dataSymbols, bool is64)
+ : Symbols(symbols)
+ , DataSymbols(dataSymbols)
+ {
+ this->ObjectImageHeader = ih;
+ this->SymbolTable =
+ (SymbolTableType*)((DWORD_PTR) this->ObjectImageHeader +
+ this->ObjectImageHeader->PointerToSymbolTable);
+ this->SectionHeaders = GetSectionHeaderOffset(this->ObjectImageHeader);
+ this->SymbolCount = this->ObjectImageHeader->NumberOfSymbols;
+ this->Is64Bit = is64;
+ }
/*
*----------------------------------------------------------------------
@@ -187,43 +188,49 @@ public:
*----------------------------------------------------------------------
*/
- bool HaveExportedObjects() {
- WORD i = 0;
- size_t size = 0;
- const char * rawdata = 0;
- PIMAGE_SECTION_HEADER pDirectivesSectionHeader = 0;
- PIMAGE_SECTION_HEADER pSectionHeaders = this->SectionHeaders;
- for(i = 0; (i < this->ObjectImageHeader->NumberOfSections &&
- !pDirectivesSectionHeader); i++)
- if (!strncmp((const char*)&pSectionHeaders[i].Name[0], ".drectve",8))
- pDirectivesSectionHeader = &pSectionHeaders[i];
- if (!pDirectivesSectionHeader) return 0;
-
- rawdata=(const char*)
- this->ObjectImageHeader+pDirectivesSectionHeader->PointerToRawData;
- if (!pDirectivesSectionHeader->PointerToRawData || !rawdata) return 0;
-
- size = pDirectivesSectionHeader->SizeOfRawData;
- const char* posImportFlag = rawdata;
- while ((posImportFlag = StrNStr(posImportFlag, " /EXPORT:", size))) {
- const char* lookingForDict = posImportFlag + 9;
- if (!strncmp(lookingForDict, "_G__cpp_",8) ||
- !strncmp(lookingForDict, "_G__set_cpp_",12)) {
- posImportFlag = lookingForDict;
- continue;
- }
-
- const char* lookingForDATA = posImportFlag + 9;
- while (*(++lookingForDATA) && *lookingForDATA != ' ');
- lookingForDATA -= 5;
- // ignore DATA exports
- if (strncmp(lookingForDATA, ",DATA", 5)) break;
- posImportFlag = lookingForDATA + 5;
- }
- if(posImportFlag) {
- return true;
- }
- return false;
+ bool HaveExportedObjects()
+ {
+ WORD i = 0;
+ size_t size = 0;
+ const char* rawdata = 0;
+ PIMAGE_SECTION_HEADER pDirectivesSectionHeader = 0;
+ PIMAGE_SECTION_HEADER pSectionHeaders = this->SectionHeaders;
+ for (i = 0; (i < this->ObjectImageHeader->NumberOfSections &&
+ !pDirectivesSectionHeader);
+ i++)
+ if (!strncmp((const char*)&pSectionHeaders[i].Name[0], ".drectve", 8))
+ pDirectivesSectionHeader = &pSectionHeaders[i];
+ if (!pDirectivesSectionHeader)
+ return 0;
+
+ rawdata = (const char*)this->ObjectImageHeader +
+ pDirectivesSectionHeader->PointerToRawData;
+ if (!pDirectivesSectionHeader->PointerToRawData || !rawdata)
+ return 0;
+
+ size = pDirectivesSectionHeader->SizeOfRawData;
+ const char* posImportFlag = rawdata;
+ while ((posImportFlag = StrNStr(posImportFlag, " /EXPORT:", size))) {
+ const char* lookingForDict = posImportFlag + 9;
+ if (!strncmp(lookingForDict, "_G__cpp_", 8) ||
+ !strncmp(lookingForDict, "_G__set_cpp_", 12)) {
+ posImportFlag = lookingForDict;
+ continue;
+ }
+
+ const char* lookingForDATA = posImportFlag + 9;
+ while (*(++lookingForDATA) && *lookingForDATA != ' ')
+ ;
+ lookingForDATA -= 5;
+ // ignore DATA exports
+ if (strncmp(lookingForDATA, ",DATA", 5))
+ break;
+ posImportFlag = lookingForDATA + 5;
+ }
+ if (posImportFlag) {
+ return true;
+ }
+ return false;
}
/*
@@ -233,9 +240,7 @@ public:
* Dump an object file's exported symbols.
*----------------------------------------------------------------------
*/
- void DumpObjFile() {
- this->DumpExternalsObjects();
- }
+ void DumpObjFile() { this->DumpExternalsObjects(); }
/*
*----------------------------------------------------------------------
@@ -244,7 +249,8 @@ public:
* Dumps a COFF symbol table from an OBJ.
*----------------------------------------------------------------------
*/
- void DumpExternalsObjects() {
+ void DumpExternalsObjects()
+ {
unsigned i;
PSTR stringTable;
std::string symbol;
@@ -252,83 +258,80 @@ public:
/*
* The string table apparently starts right after the symbol table
*/
- stringTable = (PSTR)&this->SymbolTable[this->SymbolCount];
+ stringTable = (PSTR) & this->SymbolTable[this->SymbolCount];
SymbolTableType* pSymbolTable = this->SymbolTable;
- for ( i=0; i < this->SymbolCount; i++ ) {
+ for (i = 0; i < this->SymbolCount; i++) {
if (pSymbolTable->SectionNumber > 0 &&
- ( pSymbolTable->Type == 0x20 || pSymbolTable->Type == 0x0)) {
- if (pSymbolTable->StorageClass == IMAGE_SYM_CLASS_EXTERNAL) {
- /*
- * The name of the Function entry points
- */
- if (pSymbolTable->N.Name.Short != 0) {
- symbol = "";
- symbol.insert(0, (const char *)pSymbolTable->N.ShortName, 8);
- } else {
- symbol = stringTable + pSymbolTable->N.Name.Long;
- }
+ (pSymbolTable->Type == 0x20 || pSymbolTable->Type == 0x0)) {
+ if (pSymbolTable->StorageClass == IMAGE_SYM_CLASS_EXTERNAL) {
+ /*
+ * The name of the Function entry points
+ */
+ if (pSymbolTable->N.Name.Short != 0) {
+ symbol = "";
+ symbol.insert(0, (const char*)pSymbolTable->N.ShortName, 8);
+ } else {
+ symbol = stringTable + pSymbolTable->N.Name.Long;
+ }
- // clear out any leading spaces
- while (isspace(symbol[0])) symbol.erase(0,1);
- // if it starts with _ and has an @ then it is a __cdecl
- // so remove the @ stuff for the export
- if(symbol[0] == '_') {
- std::string::size_type posAt = symbol.find('@');
- if (posAt != std::string::npos) {
- symbol.erase(posAt);
- }
+ // clear out any leading spaces
+ while (isspace(symbol[0]))
+ symbol.erase(0, 1);
+ // if it starts with _ and has an @ then it is a __cdecl
+ // so remove the @ stuff for the export
+ if (symbol[0] == '_') {
+ std::string::size_type posAt = symbol.find('@');
+ if (posAt != std::string::npos) {
+ symbol.erase(posAt);
}
- // For 64 bit builds we don't need to remove _
- if(!this->Is64Bit)
- {
- 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);
+ }
+ }
+ /*
+ Check whether it is "Scalar deleting destructor" and
+ "Vector deleting destructor"
+ */
+ const char* scalarPrefix = "??_G";
+ const char* vectorPrefix = "??_E";
+ // original code had a check for
+ // symbol.find("real@") == std::string::npos)
+ // but if this disallows memmber functions with the name real
+ // if scalarPrefix and vectorPrefix are not found then print
+ // the symbol
+ if (symbol.compare(0, 4, scalarPrefix) &&
+ symbol.compare(0, 4, vectorPrefix)) {
+ SectChar = this->SectionHeaders[pSymbolTable->SectionNumber - 1]
+ .Characteristics;
+ if (!pSymbolTable->Type && (SectChar & IMAGE_SCN_MEM_WRITE)) {
+ // Read only (i.e. constants) must be excluded
+ this->DataSymbols.insert(symbol);
+ } else {
+ if (pSymbolTable->Type || !(SectChar & IMAGE_SCN_MEM_READ) ||
+ (SectChar & IMAGE_SCN_MEM_EXECUTE)) {
+ this->Symbols.insert(symbol);
+ } else {
+ // printf(" strange symbol: %s \n",symbol.c_str());
}
- /*
- Check whether it is "Scalar deleting destructor" and
- "Vector deleting destructor"
- */
- const char *scalarPrefix = "??_G";
- const char *vectorPrefix = "??_E";
- // original code had a check for
- // symbol.find("real@") == std::string::npos)
- // but if this disallows memmber functions with the name real
- // if scalarPrefix and vectorPrefix are not found then print
- // the symbol
- if (symbol.compare(0, 4, scalarPrefix) &&
- symbol.compare(0, 4, vectorPrefix) )
- {
- SectChar =
- this->
- SectionHeaders[pSymbolTable->SectionNumber-1].Characteristics;
- if (!pSymbolTable->Type && (SectChar & IMAGE_SCN_MEM_WRITE)) {
- // Read only (i.e. constants) must be excluded
- this->DataSymbols.insert(symbol);
- } else {
- if ( pSymbolTable->Type ||
- !(SectChar & IMAGE_SCN_MEM_READ) ||
- (SectChar & IMAGE_SCN_MEM_EXECUTE)) {
- this->Symbols.insert(symbol);
- } else {
- // printf(" strange symbol: %s \n",symbol.c_str());
- }
- }
}
- }
- }
- else if (pSymbolTable->SectionNumber == IMAGE_SYM_UNDEFINED &&
- !pSymbolTable->Type && 0) {
- /*
- * The IMPORT global variable entry points
- */
- if (pSymbolTable->StorageClass == IMAGE_SYM_CLASS_EXTERNAL) {
- symbol = stringTable + pSymbolTable->N.Name.Long;
- while (isspace(symbol[0])) symbol.erase(0,1);
- if (symbol[0] == '_') symbol.erase(0,1);
- this->DataSymbols.insert(symbol);
- }
+ }
+ }
+ } else if (pSymbolTable->SectionNumber == IMAGE_SYM_UNDEFINED &&
+ !pSymbolTable->Type && 0) {
+ /*
+ * The IMPORT global variable entry points
+ */
+ if (pSymbolTable->StorageClass == IMAGE_SYM_CLASS_EXTERNAL) {
+ symbol = stringTable + pSymbolTable->N.Name.Long;
+ while (isspace(symbol[0]))
+ symbol.erase(0, 1);
+ if (symbol[0] == '_')
+ symbol.erase(0, 1);
+ this->DataSymbols.insert(symbol);
+ }
}
/*
@@ -339,89 +342,84 @@ public:
pSymbolTable++;
}
}
+
private:
std::set<std::string>& Symbols;
std::set<std::string>& DataSymbols;
DWORD_PTR SymbolCount;
PIMAGE_SECTION_HEADER SectionHeaders;
ObjectHeaderType* ObjectImageHeader;
- SymbolTableType* SymbolTable;
+ SymbolTableType* SymbolTable;
bool Is64Bit;
};
-bool
-DumpFile(const char* filename,
- std::set<std::string>& symbols,
- std::set<std::string>& dataSymbols)
+bool DumpFile(const char* filename, std::set<std::string>& symbols,
+ std::set<std::string>& dataSymbols)
{
- HANDLE hFile;
- HANDLE hFileMapping;
- LPVOID lpFileBase;
- PIMAGE_DOS_HEADER dosHeader;
+ HANDLE hFile;
+ HANDLE hFileMapping;
+ LPVOID lpFileBase;
+ PIMAGE_DOS_HEADER dosHeader;
- hFile = CreateFileW(cmsys::Encoding::ToWide(filename).c_str(),
- GENERIC_READ, FILE_SHARE_READ, NULL,
- OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
+ hFile = CreateFileW(cmsys::Encoding::ToWide(filename).c_str(), GENERIC_READ,
+ FILE_SHARE_READ, NULL, OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL, 0);
- if (hFile == INVALID_HANDLE_VALUE) {
- fprintf(stderr, "Couldn't open file '%s' with CreateFile()\n", filename);
- return false;
- }
+ if (hFile == INVALID_HANDLE_VALUE) {
+ fprintf(stderr, "Couldn't open file '%s' with CreateFile()\n", filename);
+ return false;
+ }
- hFileMapping = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
- if (hFileMapping == 0) {
- CloseHandle(hFile);
- fprintf(stderr, "Couldn't open file mapping with CreateFileMapping()\n");
- return false;
- }
+ hFileMapping = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
+ if (hFileMapping == 0) {
+ CloseHandle(hFile);
+ fprintf(stderr, "Couldn't open file mapping with CreateFileMapping()\n");
+ return false;
+ }
- lpFileBase = MapViewOfFile(hFileMapping, FILE_MAP_READ, 0, 0, 0);
- if (lpFileBase == 0) {
- CloseHandle(hFileMapping);
- CloseHandle(hFile);
- fprintf(stderr, "Couldn't map view of file with MapViewOfFile()\n");
- return false;
- }
+ lpFileBase = MapViewOfFile(hFileMapping, FILE_MAP_READ, 0, 0, 0);
+ if (lpFileBase == 0) {
+ CloseHandle(hFileMapping);
+ CloseHandle(hFile);
+ fprintf(stderr, "Couldn't map view of file with MapViewOfFile()\n");
+ return false;
+ }
- dosHeader = (PIMAGE_DOS_HEADER)lpFileBase;
- if (dosHeader->e_magic == IMAGE_DOS_SIGNATURE) {
- fprintf(stderr, "File is an executable. I don't dump those.\n");
- return false;
- }
- /* Does it look like a i386 COFF OBJ file??? */
- else if (
- ((dosHeader->e_magic == IMAGE_FILE_MACHINE_I386) ||
- (dosHeader->e_magic == IMAGE_FILE_MACHINE_AMD64))
- && (dosHeader->e_sp == 0)
- ) {
- /*
- * The two tests above aren't what they look like. They're
- * really checking for IMAGE_FILE_HEADER.Machine == i386 (0x14C)
- * and IMAGE_FILE_HEADER.SizeOfOptionalHeader == 0;
- */
- DumpSymbols<IMAGE_FILE_HEADER, IMAGE_SYMBOL>
- symbolDumper((PIMAGE_FILE_HEADER) lpFileBase, symbols, dataSymbols,
- (dosHeader->e_magic == IMAGE_FILE_MACHINE_AMD64));
+ dosHeader = (PIMAGE_DOS_HEADER)lpFileBase;
+ if (dosHeader->e_magic == IMAGE_DOS_SIGNATURE) {
+ fprintf(stderr, "File is an executable. I don't dump those.\n");
+ return false;
+ }
+ /* Does it look like a i386 COFF OBJ file??? */
+ else if (((dosHeader->e_magic == IMAGE_FILE_MACHINE_I386) ||
+ (dosHeader->e_magic == IMAGE_FILE_MACHINE_AMD64)) &&
+ (dosHeader->e_sp == 0)) {
+ /*
+ * The two tests above aren't what they look like. They're
+ * really checking for IMAGE_FILE_HEADER.Machine == i386 (0x14C)
+ * and IMAGE_FILE_HEADER.SizeOfOptionalHeader == 0;
+ */
+ DumpSymbols<IMAGE_FILE_HEADER, IMAGE_SYMBOL> symbolDumper(
+ (PIMAGE_FILE_HEADER)lpFileBase, symbols, dataSymbols,
+ (dosHeader->e_magic == IMAGE_FILE_MACHINE_AMD64));
+ symbolDumper.DumpObjFile();
+ } else {
+ // check for /bigobj format
+ cmANON_OBJECT_HEADER_BIGOBJ* h = (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, symbols, dataSymbols,
+ (h->Machine == IMAGE_FILE_MACHINE_AMD64));
symbolDumper.DumpObjFile();
- } else {
- // check for /bigobj format
- cmANON_OBJECT_HEADER_BIGOBJ* h =
- (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, symbols,
- dataSymbols,
- (h->Machine == IMAGE_FILE_MACHINE_AMD64));
- symbolDumper.DumpObjFile();
- } else {
- printf("unrecognized file format in '%s'\n", filename);
- return false;
- }
- }
- UnmapViewOfFile(lpFileBase);
- CloseHandle(hFileMapping);
- CloseHandle(hFile);
- return true;
+ } else {
+ printf("unrecognized file format in '%s'\n", filename);
+ return false;
+ }
+ }
+ UnmapViewOfFile(lpFileBase);
+ CloseHandle(hFileMapping);
+ CloseHandle(hFile);
+ return true;
}
bool bindexplib::AddObjectFile(const char* filename)
@@ -431,35 +429,35 @@ bool bindexplib::AddObjectFile(const char* filename)
bool bindexplib::AddDefinitionFile(const char* filename)
{
- cmsys::ifstream infile(filename);
- if (!infile) {
- fprintf(stderr, "Couldn't open definition file '%s'\n", filename);
- return false;
- }
- std::string str;
- while (std::getline(infile, str)) {
- // skip the LIBRAY and EXPORTS lines (if any)
- if ((str.compare(0,7,"LIBRARY") == 0) ||
- (str.compare(0,7,"EXPORTS") == 0)) {
- continue;
- }
- // remove leading tabs & spaces
- str.erase(0, str.find_first_not_of(" \t"));
- std::size_t found = str.find(" \t DATA");
- if (found != std::string::npos) {
- str.erase (found, std::string::npos);
- this->DataSymbols.insert(str);
- } else {
- this->Symbols.insert(str);
- }
- }
- infile.close();
- return true;
+ cmsys::ifstream infile(filename);
+ if (!infile) {
+ fprintf(stderr, "Couldn't open definition file '%s'\n", filename);
+ return false;
+ }
+ std::string str;
+ while (std::getline(infile, str)) {
+ // skip the LIBRAY and EXPORTS lines (if any)
+ if ((str.compare(0, 7, "LIBRARY") == 0) ||
+ (str.compare(0, 7, "EXPORTS") == 0)) {
+ continue;
+ }
+ // remove leading tabs & spaces
+ str.erase(0, str.find_first_not_of(" \t"));
+ std::size_t found = str.find(" \t DATA");
+ if (found != std::string::npos) {
+ str.erase(found, std::string::npos);
+ this->DataSymbols.insert(str);
+ } else {
+ this->Symbols.insert(str);
+ }
+ }
+ infile.close();
+ return true;
}
void bindexplib::WriteFile(FILE* file)
{
- fprintf(file,"EXPORTS \n");
+ fprintf(file, "EXPORTS \n");
for (std::set<std::string>::const_iterator i = this->DataSymbols.begin();
i != this->DataSymbols.end(); ++i) {
fprintf(file, "\t%s \t DATA\n", i->c_str());
-----------------------------------------------------------------------
Summary of changes:
Source/.gitattributes | 1 -
Source/bindexplib.cxx | 507 ++++++++++--------------
Tests/CMakeTests/CMakeLists.txt | 5 +-
Tests/CMakeTests/GetPrerequisitesTest.cmake.in | 7 +-
4 files changed, 222 insertions(+), 298 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list