MantisBT - CMake
View Issue Details
0015849CMakeCMakepublic2015-11-17 16:082016-05-02 08:30
Chris M 
Bill Hoffman 
normalminoralways
closedfixed 
Visual Studio 14 Win64Windows10
CMake 3.4 
CMake 3.4.1CMake 3.4.1 
0015849: Linker failure when WINDOWS_EXPORT_ALL_SYMBOLS and /bigobj are used together in a Win64 build.
Shared library fails to link when attempting to use CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS when compiled with /bigobj.

Only tested using Visual Studio 14 2015 Win64.

Test project attached.

It appears that printf-family function symbol names are being modified (leading '_' removed) when cmake is processing *.obj into exportall.def.
Extract attached zip.

> mkdir build
> cd build
> cmake ../ -G "Visual Studio 14 2015 Win64" -DBUILD_BIGOBJ=ON
> cmake --build . --release Debug
No tags attached.
zip windows-symbols-export-all-bigobj.zip (893) 2015-11-17 16:08
https://public.kitware.com/Bug/file/5579/windows-symbols-export-all-bigobj.zip
Issue History
2015-11-17 16:08Chris MNew Issue
2015-11-17 16:08Chris MFile Added: windows-symbols-export-all-bigobj.zip
2015-11-17 16:15Brad KingAssigned To => Bill Hoffman
2015-11-17 16:15Brad KingStatusnew => assigned
2015-11-19 17:28Bill HoffmanNote Added: 0039895
2015-11-20 08:55Brad KingNote Added: 0039897
2015-11-20 08:55Brad KingStatusassigned => resolved
2015-11-20 08:55Brad KingResolutionopen => fixed
2015-11-20 08:55Brad KingFixed in Version => CMake 3.4.1
2015-11-20 08:55Brad KingTarget Version => CMake 3.4.1
2015-11-20 08:55Brad KingDescription Updatedbug_revision_view_page.php?rev_id=1961#r1961
2016-05-02 08:30Robert MaynardNote Added: 0040965
2016-05-02 08:30Robert MaynardStatusresolved => closed

Notes
(0039895)
Bill Hoffman   
2015-11-19 17:28   
Thanks for the report. I found the issue. Here is a patch for the fix:

diff --git a/Source/bindexplib.cxx b/Source/bindexplib.cxx
index 64621e0..e7263ae 100644
--- a/Source/bindexplib.cxx
+++ b/Source/bindexplib.cxx
@@ -422,7 +422,7 @@ DumpFile(const char* filename,
          DumpSymbols<cmANON_OBJECT_HEADER_BIGOBJ, cmIMAGE_SYMBOL_EX>
            symbolDumper((cmANON_OBJECT_HEADER_BIGOBJ*) lpFileBase, symbols,
                         dataSymbols,
- (dosHeader->e_magic == IMAGE_FILE_MACHINE_AMD64));
+ (h->Machine == IMAGE_FILE_MACHINE_AMD64));
          symbolDumper.DumpObjFile();
       } else {
          printf("unrecognized file format in '%s'\n", filename);


Should be in 3.4.1 coming out soon. The problem was /bigobj with 64bit. The code was not determining that it was 64 bit for bigobj and then did not handle leading _ correctly.
(0039897)
Brad King   
2015-11-20 08:55   
Fixed in 'master' here:

 Fix auto export symbols for Dlls containing /bigobj for 64bit builds.
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=75004280 [^]

It had to be backported to 'release' separately due to a conflict:

 Fix auto export symbols for Dlls containing /bigobj for 64bit builds.
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c7ddc5f4 [^]

The latter has been queued for merge to 'release' for inclusion in 3.4.1.
(0040965)
Robert Maynard   
2016-05-02 08:30   
Closing resolved issues that have not been updated in more than 4 months.