So here is an example of what I'm talking about:
#include <windows.h>
void Test1() {
MessageBoxA(NULL, NULL, "Hello!", MB_OK);
}
extern "C" void Main() {
ExitProcess(0);
}
Here is how I build this code:
g++ -o test32.exe -m32 -O3 -Os -fno-exceptions -fno-rtti -fno-ident -flto
-nostdlib -s -e_Main test.cpp -lkernel32 -luser32
g++ -o test64.exe -m64 -O3 -Os -fno-exceptions -fno-rtti -fno-ident -flto
-nostdlib -s -eMain test.cpp -lkernel32 -luser32
(I've disabled the C and C++ runtime libraries to better demonstrate the problem
I'm talking about)
When I build the code for both x86 and x64 I get the executable with only one
function - Main, so the Test1 function was cut off by the LTO successfully. But
still both test32.exe and test64.exe have MessageBoxA function in the import
table. Is it a bug? What do you think? I didn't have this problem on Linux using
the GCC, so the problem seems to be MinGW specific. I'm using MinGW-builds
x86_64-posix-sjlj-rev0 5.2.0 if it matters.
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public