summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-07-10 17:11:42 (GMT)
committerBrad King <brad.king@kitware.com>2017-07-10 18:54:07 (GMT)
commit3250b9a122a19a840f63868a244832c24528d54a (patch)
tree32a6aba3fc8db3a05b6e9bf089cbf930bae1d903
parent372de3f8039f69b3a2edcf7120083ec4097f8bd3 (diff)
downloadCMake-3250b9a122a19a840f63868a244832c24528d54a.zip
CMake-3250b9a122a19a840f63868a244832c24528d54a.tar.gz
CMake-3250b9a122a19a840f63868a244832c24528d54a.tar.bz2
bindexplib: Revert support for constants symbols
Revert the main logic change of commit v3.9.0-rc1~192^2 (bindexplib: fix constants symbols export, 2017-04-26) and its test case. Unfortunately some constants may be provided by multiple object files with different `@...` suffixes, leading to ambiguous references. Revert support pending further investigation. Fixes: #17045
-rw-r--r--Source/bindexplib.cxx22
-rw-r--r--Tests/RunCMake/AutoExportDll/foo.c2
-rw-r--r--Tests/RunCMake/AutoExportDll/say.cxx10
3 files changed, 12 insertions, 22 deletions
diff --git a/Source/bindexplib.cxx b/Source/bindexplib.cxx
index cd1fb8a..e96226a 100644
--- a/Source/bindexplib.cxx
+++ b/Source/bindexplib.cxx
@@ -242,24 +242,26 @@ public:
// Check whether it is "Scalar deleting destructor" and "Vector
// deleting destructor"
- // if scalarPrefix and vectorPrefix are not found then print the
- // symbol
+ // if scalarPrefix and vectorPrefix are not found then print
+ // the symbol
const char* scalarPrefix = "??_G";
const char* vectorPrefix = "??_E";
+ // The original code had a check for
+ // symbol.find("real@") == std::string::npos)
+ // but this disallows member functions with the name "real".
if (symbol.compare(0, 4, scalarPrefix) &&
symbol.compare(0, 4, vectorPrefix)) {
SectChar = this->SectionHeaders[pSymbolTable->SectionNumber - 1]
.Characteristics;
-
// skip symbols containing a dot
if (symbol.find('.') == std::string::npos) {
- if (SectChar & IMAGE_SCN_MEM_EXECUTE) {
- this->Symbols.insert(symbol);
- } else if (SectChar & IMAGE_SCN_MEM_READ) {
- // skip __real@ and __xmm@
- if (symbol.find("_real") == std::string::npos &&
- symbol.find("_xmm") == std::string::npos) {
- this->DataSymbols.insert(symbol);
+ 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);
}
}
}
diff --git a/Tests/RunCMake/AutoExportDll/foo.c b/Tests/RunCMake/AutoExportDll/foo.c
index e70fbb5..4b1318b 100644
--- a/Tests/RunCMake/AutoExportDll/foo.c
+++ b/Tests/RunCMake/AutoExportDll/foo.c
@@ -13,5 +13,3 @@ int bar()
{
return 5;
}
-
-const char testconst[] = "testconst";
diff --git a/Tests/RunCMake/AutoExportDll/say.cxx b/Tests/RunCMake/AutoExportDll/say.cxx
index eb9c0ff..51060e8 100644
--- a/Tests/RunCMake/AutoExportDll/say.cxx
+++ b/Tests/RunCMake/AutoExportDll/say.cxx
@@ -13,14 +13,6 @@ int WINAPI foo();
int bar();
int objlib();
void justnop();
-
-// test const export
-#ifdef _WIN32
-// data symbols must be explicitly imported
-__declspec(dllimport) extern const char testconst[];
-#else
-extern const char testconst[];
-#endif
}
// test c++ functions
@@ -51,8 +43,6 @@ int main()
bar();
objlib();
printf("\n");
- printf("%s", testconst);
- printf("\n");
#ifdef HAS_JUSTNOP
justnop();
#endif