Skip Menu |

This queue is for tickets about the Perl-Dist-Strawberry CPAN distribution.

Report information
The Basics
Id: 75683
Status: resolved
Priority: 0/
Queue: Perl-Dist-Strawberry

People
Owner: Nobody in particular
Requestors: bulk88 [...] hotmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: gcc in perl is broken compared to mingw.org gcc
The GCC 4.4.3 in Strawberry Perl 5.12.3 32 bit and the GCC 4.4.7 in Strawberry Perl 5.14.2 are broken. The latest Mingw.org release which has GCC 4.6.2 isn't broken. The strawberry perl GCCs are incapable of using GCC builtins under -O0 optimization level preventing the creation of any PEs which do not link to the CRT. GCC builtins are functionally identical to #pragma intrinsic on MSVC. A sample program is included. It is called memcpy.c. It was compiled with "gcc memcpy.c -nostdlib -lkernel32 -o memcpy.exe -v -Wall -O0" using the 2 different Strawberry Perl GCCs mentioned above. Each time the S. Perl GCCs converted the __builtin_memcpy function to memcpy, which is a CRT function, then fail when they can't link to the CRT. Mingw.org GCC does NOT exhibit this. I brought the problem up on the mingw mailing list here previous http://sourceforge.net/mailarchive/message.php?msg_id=28930444 They determined it was a problem with Strawberry Perl GCC, not Mingw.org GCC. Reading through the Changelogs from 4.4 to 4.6 of GCC here http://gcc.gnu.org/gcc-4.4/changes.html does not reveal anything about this problem. Show quoted text
_________________________________________________________________ C:\>gcc -v Using built-in specs. Target: i686-w64-mingw32 Configured with: ../gcc44-svn/configure --target=i686-w64-mingw32 --host=i686-w6 4-mingw32 --disable-multilib --disable-nls --disable-win32-registry --prefix=/mi ngw32 --with-gmp=/mingw32 --with-mpfr=/mingw32 --enable-languages=c,c++ Thread model: win32 gcc version 4.4.3 (GCC) C:\>perl -V Summary of my perl5 (revision 5 version 12 subversion 3) configuration: Platform: osname=MSWin32, osvers=5.1, archname=MSWin32-x86-multi-thread uname='Win32 strawberryperl 5.12.3.0 #1 Sun May 15 09:44:53 2011 i386' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=undef, use64bitall=undef, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags =' -s -O2 -DWIN32 -DHAVE_DES_FCRYPT -DUSE_SITECUSTOMIZE - DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fno-strict-aliasing -mms-bitfields - DPERL_MSVCRT_READFIX', optimize='-s -O2', cppflags='-DWIN32' ccversion='', gccversion='4.4.3', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='long long', lseek size=8 alignbytes=8, prototype=define Linker and Libraries: ld='g++', ldflags ='-s -L"C:\sperl\perl\lib\CORE" -L"C:\sperl\c\lib"' libpth=C:\sperl\c\lib C:\sperl\c\i686-w64-mingw32\lib libs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32 perllibs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladva pi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lver sion -lodbc32 -lodbccp32 -lcomctl32 libc=, so=dll, useshrplib=true, libperl=libperl512.a gnulibc_version='' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-mdll -s -L"C:\sperl\perl\lib\CORE" -L"C:\sperl\c \lib"' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS PERL_MALLOC_WRAP PL_OP_SLAB_ALLOC USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_PERL_ATOF USE_SITECUSTOMIZE Built under MSWin32 Compiled at May 15 2011 17:02:01 %ENV: PERL_JSON_BACKEND="JSON::XS" PERL_YAML_BACKEND="YAML" @INC: C:/sperl/perl/site/lib C:/sperl/perl/vendor/lib C:/sperl/perl/lib . C:\> and C:\>gcc -v Using built-in specs. Target: x86_64-w64-mingw32 Configured with: ../gcc44-svn/configure --host=x86_64-w64-mingw32 --target=x86_6 4-w64-mingw32 --disable-multilib --enable-checking=release --prefix=/opt/mingw64 --enable-languages=c,c++,fortran --enable-libgomp --with-gmp=/opt/mingw64 --wit h-mpfr=/opt/mingw64 --disable-nls --disable-win32-registry Thread model: win32 gcc version 4.4.7 20111023 (prerelease) [svn/rev.180339 - mingw-w64/oz] (GCC) C:\>perl -V Summary of my perl5 (revision 5 version 14 subversion 2) configuration: Platform: osname=MSWin32, osvers=4.0, archname=MSWin32-x64-multi-thread uname='Win32 strawberryperl 5.14.2.1 #1 Tue Nov 22 22:40:59 2011 x64' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=define, use64bitall=undef, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags =' -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -DPERL_TEXTMODE_ SCRIPTS -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fno-str ict-aliasing -mms-bitfields', optimize='-s -O2', cppflags='-DWIN32' ccversion='', gccversion='4.4.7', gccosandvers='' intsize=4, longsize=4, ptrsize=8, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='long long', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='g++', ldflags ='-s -L"C:\sperl\perl\lib\CORE" -L"C:\sperl\c\lib"' libpth=C:\sperl\c\lib C:\sperl\c\x86_64-w64-mingw32\lib libs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32 perllibs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladva pi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lver sion -lodbc32 -lodbccp32 -lcomctl32 libc=, so=dll, useshrplib=true, libperl=libperl514.a gnulibc_version='' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-mdll -s -L"C:\sperl\perl\lib\CORE" -L"C:\sperl\c \lib"' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS PERL_MALLOC_WRAP PERL_PRESERVE_IVUV PL_OP_SLAB_ALLOC USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_PERL_ATOF USE_SITECUSTOMIZE Built under MSWin32 Compiled at Nov 22 2011 22:53:05 %ENV: PERL_JSON_BACKEND="JSON::XS" PERL_YAML_BACKEND="YAML" @INC: C:/sperl/perl/site/lib C:/sperl/perl/vendor/lib C:/sperl/perl/lib . C:\>
_________________________________________________________________ mingw GCC $ gcc -v Using built-in specs. COLLECT_GCC=C:\sources\MinGW\bin\gcc.exe COLLECT_LTO_WRAPPER=c:/sources/mingw/bin/../libexec/gcc/mingw32/4.6.2/lto-wrappe r.exe Target: mingw32 Configured with: ../gcc-4.6.2/configure --enable-languages=c,c++,ada,fortran,obj c,obj-c++ --disable-sjlj-exceptions --with-dwarf2 --enable-shared --enable-libgo mp --disable-win32-registry --enable-libstdcxx-debug --enable-version-specific-r untime-libs --build=mingw32 --prefix=/mingw Thread model: win32 gcc version 4.6.2 (GCC) $
Subject: memcpy.c
#include <windows.h> int CALLBACK WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) { char * str2 = "Hello World from memcpy Line 2"; int sizestr2 = sizeof("Hello World from memcpy Line 2"); char * str = HeapAlloc(GetProcessHeap(), 0, 1000); char * str3 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 1000); __builtin_memcpy(str, str3, 1000); __builtin_memcpy(str, str2, sizestr2); WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), "Hello World from memcpy\n", sizeof("Hello World from memcpy\n"), NULL, NULL); WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), str, sizestr2, NULL, NULL); return 1; }
Subject: Re: [rt.cpan.org #75683] gcc in perl is broken compared to mingw.org gcc
Date: Sun, 11 Mar 2012 20:59:25 +0100
To: bug-Perl-Dist-Strawberry [...] rt.cpan.org
From: kmx <kmx [...] volny.cz>
Thanks for your report. The upcoming strawberry perl 5.16.0 will be probably bundled with gcc-4.6.3 I'll check whether the new compiler still suffers from this issue. However keep in mind that we are not using gcc+c-runtime from http://mingw.org project but from http://mingw-w64.sf.net project (it is mostly due to the much better 64bit support). So for us it would be better if you can bring this issue to mingw-w64-public@lists.sourceforge.net mailing list (see https://lists.sourceforge.net/lists/listinfo/mingw-w64-public) -- kmx
From: bulk88 [...] hotmail.com
On Sun Mar 11 15:59:41 2012, kmx@volny.cz wrote: Show quoted text
> Thanks for your report. > > The upcoming strawberry perl 5.16.0 will be probably bundled with > gcc-4.6.3 I'll check whether the new compiler still suffers from this
issue. Show quoted text
> > However keep in mind that we are not using gcc+c-runtime from > http://mingw.org project but from http://mingw-w64.sf.net project (it is > mostly due to the much better 64bit support). > > So for us it would be better if you can bring this issue to > mingw-w64-public@lists.sourceforge.net mailing list (see > https://lists.sourceforge.net/lists/listinfo/mingw-w64-public) > > -- > kmx
I downloaded mingw64, mingw-w32-bin_i686-mingw_20111219.zip to be specific. The no builtins under -O0 bug is in mingw-w32-bin_i686-mingw_20111219.zip . _________________________________________________- C:\>i686-w64-mingw32-gcc.exe -v Using built-in specs. COLLECT_GCC=i686-w64-mingw32-gcc.exe COLLECT_LTO_WRAPPER=c:/sources/mingw64/bin/../libexec/gcc/i686-w64-mingw32/4.7.0 /lto-wrapper.exe Target: i686-w64-mingw32 Configured with: ../../../build/gcc/src/configure --target=i686-w64-mingw32 --pr efix=/c/bb/vista64-mingw32/mingw-x86-x86/build/build/root --with-sysroot=/c/bb/v ista64-mingw32/mingw-x86-x86/build/build/root --enable-languages=all,obj-c++ --e nable-fully-dynamic-string --disable-multilib Thread model: win32 gcc version 4.7.0 20111219 (experimental) (GCC) C:\> Show quoted text
________________________________________________________ C:\>i686-w64-mingw32-gcc.exe memcpy.c -nostdlib -lkernel32 -o memcpy.exe -v -Wall -O0 Using built-in specs. COLLECT_GCC=i686-w64-mingw32-gcc.exe COLLECT_LTO_WRAPPER=c:/sources/mingw64/bin/../libexec/gcc/i686-w64-mingw32/4.7.0 /lto-wrapper.exe Target: i686-w64-mingw32 Configured with: ../../../build/gcc/src/configure --target=i686-w64-mingw32 --pr efix=/c/bb/vista64-mingw32/mingw-x86-x86/build/build/root --with-sysroot=/c/bb/v ista64-mingw32/mingw-x86-x86/build/build/root --enable-languages=all,obj-c++ --e nable-fully-dynamic-string --disable-multilib Thread model: win32 gcc version 4.7.0 20111219 (experimental) (GCC) COLLECT_GCC_OPTIONS='-nostdlib' '-o' 'memcpy.exe' '-v' '-Wall' '-O0' '-mtune=gen eric' '-march=pentiumpro' c:/sources/mingw64/bin/../libexec/gcc/i686-w64-mingw32/4.7.0/cc1.exe -quiet -v -iprefix c:\sources\mingw64\bin\../lib/gcc/i686-w64-mingw32/4.7.0/ -U_REENTRANT memcpy.c -quiet -dumpbase memcpy.c -mtune=generic -march=pentiumpro -auxbase mem cpy -O0 -Wall -version -o C:\WINDOWS\TEMP\cck8k7EP.s GNU C (GCC) version 4.7.0 20111219 (experimental) (i686-w64-mingw32) compiled by GNU C version 4.5.2, GMP version 5.0.1, MPFR version 2.4.2, MPC version 0.8.2 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 ignoring duplicate directory "c:/sources/mingw64/lib/gcc/../../lib/gcc/i686-w64- mingw32/4.7.0/include" ignoring nonexistent directory "c:/bb/vista64-mingw32/mingw-x86-x86/build/build/ rootc:/bb/vista64-mingw32/mingw-x86-x86/build/build/root/lib/gcc/i686-w64-mingw3 2/4.7.0/../../../../include" ignoring duplicate directory "c:/sources/mingw64/lib/gcc/../../lib/gcc/i686-w64- mingw32/4.7.0/include-fixed" ignoring duplicate directory "c:/sources/mingw64/lib/gcc/../../lib/gcc/i686-w64- mingw32/4.7.0/../../../../i686-w64-mingw32/include" ignoring nonexistent directory "c:/bb/vista64-mingw32/mingw-x86-x86/build/build/ rootc:/mingw/include" #include "..." search starts here: #include <...> search starts here: c:\sources\mingw64\bin\../lib/gcc/i686-w64-mingw32/4.7.0/include c:\sources\mingw64\bin\../lib/gcc/i686-w64-mingw32/4.7.0/include-fixed c:\sources\mingw64\bin\../lib/gcc/i686-w64-mingw32/4.7.0/../../../../i686-w64-m ingw32/include End of search list. GNU C (GCC) version 4.7.0 20111219 (experimental) (i686-w64-mingw32) compiled by GNU C version 4.5.2, GMP version 5.0.1, MPFR version 2.4.2, MPC version 0.8.2 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 Compiler executable checksum: 8c5ba8a77bffe2fbf96ff9655da73258 COLLECT_GCC_OPTIONS='-nostdlib' '-o' 'memcpy.exe' '-v' '-Wall' '-O0' '-mtune=gen eric' '-march=pentiumpro' c:/sources/mingw64/bin/../lib/gcc/i686-w64-mingw32/4.7.0/../../../../i686-w64-m ingw32/bin/as.exe -o C:\WINDOWS\TEMP\ccn4o83d.o C:\WINDOWS\TEMP\cck8k7EP.s COMPILER_PATH=c:/sources/mingw64/bin/../libexec/gcc/i686-w64-mingw32/4.7.0/;c:/s ources/mingw64/bin/../libexec/gcc/;c:/sources/mingw64/bin/../lib/gcc/i686-w64-mi ngw32/4.7.0/../../../../i686-w64-mingw32/bin/ LIBRARY_PATH=c:/sources/mingw64/bin/../lib/gcc/i686-w64-mingw32/4.7.0/;c:/source s/mingw64/bin/../lib/gcc/;c:/sources/mingw64/bin/../lib/gcc/i686-w64-mingw32/4.7 .0/../../../../i686-w64-mingw32/lib/../lib/;c:/sources/mingw64/bin/../lib/gcc/i6 86-w64-mingw32/4.7.0/../../../../i686-w64-mingw32/lib/ COLLECT_GCC_OPTIONS='-nostdlib' '-o' 'memcpy.exe' '-v' '-Wall' '-O0' '-mtune=gen eric' '-march=pentiumpro' c:/sources/mingw64/bin/../libexec/gcc/i686-w64-mingw32/4.7.0/collect2.exe --sys root=c:/bb/vista64-mingw32/mingw-x86-x86/build/build/root -m i386pe -Bdynamic -o memcpy.exe -Lc:/sources/mingw64/bin/../lib/gcc/i686-w64-mingw32/4.7.0 -Lc:/sour ces/mingw64/bin/../lib/gcc -Lc:/sources/mingw64/bin/../lib/gcc/i686-w64-mingw32/ 4.7.0/../../../../i686-w64-mingw32/lib/../lib -Lc:/sources/mingw64/bin/../lib/gc c/i686-w64-mingw32/4.7.0/../../../../i686-w64-mingw32/lib C:\WINDOWS\TEMP\ccn4o8 3d.o -lkernel32 C:\WINDOWS\TEMP\ccn4o83d.o:memcpy.c:(.text+0xea): undefined reference to `_memcp y' collect2.exe: error: ld returned 1 exit status C:\>i686-w64-mingw32-gcc.exe memcpy.c -nostdlib -lkernel32 -o memcpy.exe -v -Wall -O1 Using built-in specs. COLLECT_GCC=i686-w64-mingw32-gcc.exe COLLECT_LTO_WRAPPER=c:/sources/mingw64/bin/../libexec/gcc/i686-w64-mingw32/4.7.0 /lto-wrapper.exe Target: i686-w64-mingw32 Configured with: ../../../build/gcc/src/configure --target=i686-w64-mingw32 --pr efix=/c/bb/vista64-mingw32/mingw-x86-x86/build/build/root --with-sysroot=/c/bb/v ista64-mingw32/mingw-x86-x86/build/build/root --enable-languages=all,obj-c++ --e nable-fully-dynamic-string --disable-multilib Thread model: win32 gcc version 4.7.0 20111219 (experimental) (GCC) COLLECT_GCC_OPTIONS='-nostdlib' '-o' 'memcpy.exe' '-v' '-Wall' '-O1' '-mtune=gen eric' '-march=pentiumpro' c:/sources/mingw64/bin/../libexec/gcc/i686-w64-mingw32/4.7.0/cc1.exe -quiet -v -iprefix c:\sources\mingw64\bin\../lib/gcc/i686-w64-mingw32/4.7.0/ -U_REENTRANT memcpy.c -quiet -dumpbase memcpy.c -mtune=generic -march=pentiumpro -auxbase mem cpy -O1 -Wall -version -o C:\WINDOWS\TEMP\ccwlIPkV.s GNU C (GCC) version 4.7.0 20111219 (experimental) (i686-w64-mingw32) compiled by GNU C version 4.5.2, GMP version 5.0.1, MPFR version 2.4.2, MPC version 0.8.2 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 ignoring duplicate directory "c:/sources/mingw64/lib/gcc/../../lib/gcc/i686-w64- mingw32/4.7.0/include" ignoring nonexistent directory "c:/bb/vista64-mingw32/mingw-x86-x86/build/build/ rootc:/bb/vista64-mingw32/mingw-x86-x86/build/build/root/lib/gcc/i686-w64-mingw3 2/4.7.0/../../../../include" ignoring duplicate directory "c:/sources/mingw64/lib/gcc/../../lib/gcc/i686-w64- mingw32/4.7.0/include-fixed" ignoring duplicate directory "c:/sources/mingw64/lib/gcc/../../lib/gcc/i686-w64- mingw32/4.7.0/../../../../i686-w64-mingw32/include" ignoring nonexistent directory "c:/bb/vista64-mingw32/mingw-x86-x86/build/build/ rootc:/mingw/include" #include "..." search starts here: #include <...> search starts here: c:\sources\mingw64\bin\../lib/gcc/i686-w64-mingw32/4.7.0/include c:\sources\mingw64\bin\../lib/gcc/i686-w64-mingw32/4.7.0/include-fixed c:\sources\mingw64\bin\../lib/gcc/i686-w64-mingw32/4.7.0/../../../../i686-w64-m ingw32/include End of search list. GNU C (GCC) version 4.7.0 20111219 (experimental) (i686-w64-mingw32) compiled by GNU C version 4.5.2, GMP version 5.0.1, MPFR version 2.4.2, MPC version 0.8.2 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 Compiler executable checksum: 8c5ba8a77bffe2fbf96ff9655da73258 COLLECT_GCC_OPTIONS='-nostdlib' '-o' 'memcpy.exe' '-v' '-Wall' '-O1' '-mtune=gen eric' '-march=pentiumpro' c:/sources/mingw64/bin/../lib/gcc/i686-w64-mingw32/4.7.0/../../../../i686-w64-m ingw32/bin/as.exe -o C:\WINDOWS\TEMP\cc9gUDWs.o C:\WINDOWS\TEMP\ccwlIPkV.s COMPILER_PATH=c:/sources/mingw64/bin/../libexec/gcc/i686-w64-mingw32/4.7.0/;c:/s ources/mingw64/bin/../libexec/gcc/;c:/sources/mingw64/bin/../lib/gcc/i686-w64-mi ngw32/4.7.0/../../../../i686-w64-mingw32/bin/ LIBRARY_PATH=c:/sources/mingw64/bin/../lib/gcc/i686-w64-mingw32/4.7.0/;c:/source s/mingw64/bin/../lib/gcc/;c:/sources/mingw64/bin/../lib/gcc/i686-w64-mingw32/4.7 .0/../../../../i686-w64-mingw32/lib/../lib/;c:/sources/mingw64/bin/../lib/gcc/i6 86-w64-mingw32/4.7.0/../../../../i686-w64-mingw32/lib/ COLLECT_GCC_OPTIONS='-nostdlib' '-o' 'memcpy.exe' '-v' '-Wall' '-O1' '-mtune=gen eric' '-march=pentiumpro' c:/sources/mingw64/bin/../libexec/gcc/i686-w64-mingw32/4.7.0/collect2.exe --sys root=c:/bb/vista64-mingw32/mingw-x86-x86/build/build/root -m i386pe -Bdynamic -o memcpy.exe -Lc:/sources/mingw64/bin/../lib/gcc/i686-w64-mingw32/4.7.0 -Lc:/sour ces/mingw64/bin/../lib/gcc -Lc:/sources/mingw64/bin/../lib/gcc/i686-w64-mingw32/ 4.7.0/../../../../i686-w64-mingw32/lib/../lib -Lc:/sources/mingw64/bin/../lib/gc c/i686-w64-mingw32/4.7.0/../../../../i686-w64-mingw32/lib C:\WINDOWS\TEMP\cc9gUD Ws.o -lkernel32 C:\>
Subject: Re: [rt.cpan.org #75683] gcc in perl is broken compared to mingw.org gcc
Date: Mon, 12 Mar 2012 09:45:21 +0100
To: bug-Perl-Dist-Strawberry [...] rt.cpan.org
From: kmx <kmx [...] volny.cz>
unfortunately gcc-4.6.3+mingw-w64 runtime (which is a candidate to be bundled with upcoming strawberry perl) seems to throw an error: c:\test> gcc memcpy.c -nostdlib -lkernel32 -o memcpy.exe -v -Wall -O0 ... memcpy.c:(.text+0xea): undefined reference to `memcpy' Which is - if I understand correctly - the buggy behaviour, right? I will try to investigate what I can do about that (to be honest I do not want to jump directly to gcc-4.7.0) -- kmx
From: bulk88 [...] hotmail.com
On Mon Mar 12 04:45:32 2012, kmx@volny.cz wrote: Show quoted text
> unfortunately gcc-4.6.3+mingw-w64 runtime (which is a candidate to be > bundled with upcoming strawberry perl) seems to throw an error: > > c:\test> gcc memcpy.c -nostdlib -lkernel32 -o memcpy.exe -v -Wall -O0 > ... > memcpy.c:(.text+0xea): undefined reference to `memcpy' > > Which is - if I understand correctly - the buggy behaviour, right? > > I will try to investigate what I can do about that (to be honest I do > not want to jump directly to gcc-4.7.0) > > -- > kmx
Correct. Mingw64 refused to fix it claiming its a problem with GCC. Then why does it compile fine with Mingw.org GCC? https://sourceforge.net/tracker/?func=detail&atid=983354&aid=3502290&group_id=202880 I included the 2 build logs from mingw.org gcc and mingw64 gcc as attachments.
Subject: mingw64.txt
C:\Documents and Settings\Owner\Desktop\memcpy>i686-w64-mingw32-gcc.exe memcpy.c -nostdlib -lkernel32 -o memcpy.exe -v -Wall -O0 Using built-in specs. COLLECT_GCC=i686-w64-mingw32-gcc.exe COLLECT_LTO_WRAPPER=c:/sources/mingw64/bin/../libexec/gcc/i686-w64-mingw32/4.7.0 /lto-wrapper.exe Target: i686-w64-mingw32 Configured with: ../../../build/gcc/src/configure --target=i686-w64-mingw32 --pr efix=/c/bb/vista64-mingw32/mingw-x86-x86/build/build/root --with-sysroot=/c/bb/v ista64-mingw32/mingw-x86-x86/build/build/root --enable-languages=all,obj-c++ --e nable-fully-dynamic-string --disable-multilib Thread model: win32 gcc version 4.7.0 20111219 (experimental) (GCC) COLLECT_GCC_OPTIONS='-nostdlib' '-o' 'memcpy.exe' '-v' '-Wall' '-O0' '-mtune=gen eric' '-march=pentiumpro' c:/sources/mingw64/bin/../libexec/gcc/i686-w64-mingw32/4.7.0/cc1.exe -quiet -v -iprefix c:\sources\mingw64\bin\../lib/gcc/i686-w64-mingw32/4.7.0/ -U_REENTRANT memcpy.c -quiet -dumpbase memcpy.c -mtune=generic -march=pentiumpro -auxbase mem cpy -O0 -Wall -version -o C:\WINDOWS\TEMP\ccTOOrc5.s GNU C (GCC) version 4.7.0 20111219 (experimental) (i686-w64-mingw32) compiled by GNU C version 4.5.2, GMP version 5.0.1, MPFR version 2.4.2, MPC version 0.8.2 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 ignoring duplicate directory "c:/sources/mingw64/lib/gcc/../../lib/gcc/i686-w64- mingw32/4.7.0/include" ignoring nonexistent directory "c:/bb/vista64-mingw32/mingw-x86-x86/build/build/ rootc:/bb/vista64-mingw32/mingw-x86-x86/build/build/root/lib/gcc/i686-w64-mingw3 2/4.7.0/../../../../include" ignoring duplicate directory "c:/sources/mingw64/lib/gcc/../../lib/gcc/i686-w64- mingw32/4.7.0/include-fixed" ignoring duplicate directory "c:/sources/mingw64/lib/gcc/../../lib/gcc/i686-w64- mingw32/4.7.0/../../../../i686-w64-mingw32/include" ignoring nonexistent directory "c:/bb/vista64-mingw32/mingw-x86-x86/build/build/ rootc:/mingw/include" #include "..." search starts here: #include <...> search starts here: c:\sources\mingw64\bin\../lib/gcc/i686-w64-mingw32/4.7.0/include c:\sources\mingw64\bin\../lib/gcc/i686-w64-mingw32/4.7.0/include-fixed c:\sources\mingw64\bin\../lib/gcc/i686-w64-mingw32/4.7.0/../../../../i686-w64-m ingw32/include End of search list. GNU C (GCC) version 4.7.0 20111219 (experimental) (i686-w64-mingw32) compiled by GNU C version 4.5.2, GMP version 5.0.1, MPFR version 2.4.2, MPC version 0.8.2 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 Compiler executable checksum: 8c5ba8a77bffe2fbf96ff9655da73258 COLLECT_GCC_OPTIONS='-nostdlib' '-o' 'memcpy.exe' '-v' '-Wall' '-O0' '-mtune=gen eric' '-march=pentiumpro' c:/sources/mingw64/bin/../lib/gcc/i686-w64-mingw32/4.7.0/../../../../i686-w64-m ingw32/bin/as.exe -o C:\WINDOWS\TEMP\ccXTDQrL.o C:\WINDOWS\TEMP\ccTOOrc5.s COMPILER_PATH=c:/sources/mingw64/bin/../libexec/gcc/i686-w64-mingw32/4.7.0/;c:/s ources/mingw64/bin/../libexec/gcc/;c:/sources/mingw64/bin/../lib/gcc/i686-w64-mi ngw32/4.7.0/../../../../i686-w64-mingw32/bin/ LIBRARY_PATH=c:/sources/mingw64/bin/../lib/gcc/i686-w64-mingw32/4.7.0/;c:/source s/mingw64/bin/../lib/gcc/;c:/sources/mingw64/bin/../lib/gcc/i686-w64-mingw32/4.7 .0/../../../../i686-w64-mingw32/lib/../lib/;c:/sources/mingw64/bin/../lib/gcc/i6 86-w64-mingw32/4.7.0/../../../../i686-w64-mingw32/lib/ COLLECT_GCC_OPTIONS='-nostdlib' '-o' 'memcpy.exe' '-v' '-Wall' '-O0' '-mtune=gen eric' '-march=pentiumpro' c:/sources/mingw64/bin/../libexec/gcc/i686-w64-mingw32/4.7.0/collect2.exe --sys root=c:/bb/vista64-mingw32/mingw-x86-x86/build/build/root -m i386pe -Bdynamic -o memcpy.exe -Lc:/sources/mingw64/bin/../lib/gcc/i686-w64-mingw32/4.7.0 -Lc:/sour ces/mingw64/bin/../lib/gcc -Lc:/sources/mingw64/bin/../lib/gcc/i686-w64-mingw32/ 4.7.0/../../../../i686-w64-mingw32/lib/../lib -Lc:/sources/mingw64/bin/../lib/gc c/i686-w64-mingw32/4.7.0/../../../../i686-w64-mingw32/lib C:\WINDOWS\TEMP\ccXTDQ rL.o -lkernel32 C:\WINDOWS\TEMP\ccXTDQrL.o:memcpy.c:(.text+0xea): undefined reference to `_memcp y' collect2.exe: error: ld returned 1 exit status C:\Documents and Settings\Owner\Desktop\memcpy>
Subject: mingworg.txt
C:\Documents and Settings\Owner\Desktop\memcpy>gcc memcpy.c -nostdlib -lkernel32 -o memcpy.exe -v -Wall -O0 Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=c:/sources/mingw/bin/../libexec/gcc/mingw32/4.6.2/lto-wrappe r.exe Target: mingw32 Configured with: ../gcc-4.6.2/configure --enable-languages=c,c++,ada,fortran,obj c,obj-c++ --disable-sjlj-exceptions --with-dwarf2 --enable-shared --enable-libgo mp --disable-win32-registry --enable-libstdcxx-debug --enable-version-specific-r untime-libs --build=mingw32 --prefix=/mingw Thread model: win32 gcc version 4.6.2 (GCC) COLLECT_GCC_OPTIONS='-nostdlib' '-o' 'memcpy.exe' '-v' '-Wall' '-O0' '-mtune=i38 6' '-march=i386' c:/sources/mingw/bin/../libexec/gcc/mingw32/4.6.2/cc1.exe -quiet -v -iprefix c: \sources\mingw\bin\../lib/gcc/mingw32/4.6.2/ memcpy.c -quiet -dumpbase memcpy.c -mtune=i386 -march=i386 -auxbase memcpy -O0 -Wall -version -o C:\WINDOWS\TEMP\cc gVjZfc.s GNU C (GCC) version 4.6.2 (mingw32) compiled by GNU C version 4.6.2, GMP version 5.0.1, MPFR version 2.4.1, MPC version 0.8.1 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 ignoring nonexistent directory "c:\sources\mingw\bin\../lib/gcc/mingw32/4.6.2/.. /../../../mingw32/include" ignoring duplicate directory "c:/sources/mingw/lib/gcc/../../lib/gcc/mingw32/4.6 .2/include" ignoring nonexistent directory "/mingw/include" ignoring duplicate directory "c:/sources/mingw/lib/gcc/../../include" ignoring duplicate directory "c:/sources/mingw/lib/gcc/../../lib/gcc/mingw32/4.6 .2/include-fixed" ignoring nonexistent directory "c:/sources/mingw/lib/gcc/../../lib/gcc/mingw32/4 .6.2/../../../../mingw32/include" ignoring nonexistent directory "/mingw/include" #include "..." search starts here: #include <...> search starts here: c:\sources\mingw\bin\../lib/gcc/mingw32/4.6.2/include c:\sources\mingw\bin\../lib/gcc/mingw32/4.6.2/../../../../include c:\sources\mingw\bin\../lib/gcc/mingw32/4.6.2/include-fixed End of search list. GNU C (GCC) version 4.6.2 (mingw32) compiled by GNU C version 4.6.2, GMP version 5.0.1, MPFR version 2.4.1, MPC version 0.8.1 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: c20aed7c018482d7b62efcd5dcab2a9d COLLECT_GCC_OPTIONS='-nostdlib' '-o' 'memcpy.exe' '-v' '-Wall' '-O0' '-mtune=i38 6' '-march=i386' c:/sources/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/as.exe -o C:\WINDOWS\TEMP\cccGyX7k.o C:\WINDOWS\TEMP\ccgVjZfc.s COMPILER_PATH=c:/sources/mingw/bin/../libexec/gcc/mingw32/4.6.2/;c:/sources/ming w/bin/../libexec/gcc/;c:/sources/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../ mingw32/bin/ LIBRARY_PATH=c:/sources/mingw/bin/../lib/gcc/mingw32/4.6.2/;c:/sources/mingw/bin /../lib/gcc/;c:/sources/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/l ib/;c:/sources/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../ COLLECT_GCC_OPTIONS='-nostdlib' '-o' 'memcpy.exe' '-v' '-Wall' '-O0' '-mtune=i38 6' '-march=i386' c:/sources/mingw/bin/../libexec/gcc/mingw32/4.6.2/collect2.exe -Bdynamic -o mem cpy.exe -Lc:/sources/mingw/bin/../lib/gcc/mingw32/4.6.2 -Lc:/sources/mingw/bin/. ./lib/gcc -Lc:/sources/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/li b -Lc:/sources/mingw/bin/../lib/gcc/mingw32/4.6.2/../../.. C:\WINDOWS\TEMP\cccGy X7k.o -lkernel32 C:\Documents and Settings\Owner\Desktop\memcpy>
Subject: Re: [rt.cpan.org #75683] gcc in perl is broken compared to mingw.org gcc
Date: Mon, 12 Mar 2012 20:12:41 +0100
To: bug-Perl-Dist-Strawberry [...] rt.cpan.org
From: kmx <kmx [...] volny.cz>
Hi, a hint from Mark Dootson (his gcc-4.6.3 binaries are about to be used in strawberry perl 5.16.0) - try the following workaround with mingw-w64: c:\test> i686-w64-mingw32-gcc.exe memcpy.c -nostdlib -lkernel32 -o memcpy.exe -v -Wall -O0 -mtune=pentiumpro It really seems to be a gcc issue in in the target specific specification files which are different for mingw.org and mingw-w64.sf.net -- kmx
From: bulk88 [...] hotmail.com
Show quoted text
> c:\test> i686-w64-mingw32-gcc.exe memcpy.c -nostdlib -lkernel32 -o > memcpy.exe -v -Wall -O0 -mtune=pentiumpro > > It really seems to be a gcc issue in in the target specific > specification files which are different for mingw.org and mingw-w64.sf.net > > -- > kmx >
On S Perl 5.14 x64, mtune=native failed, tried to link to CRT On S Perl 5.12 x86, mtune=pentiumpro failed, tried to link to CRT On Mingw64 latest x86 (mingw-w32-bin_i686-mingw_20111219.zip), mtune=pentiumpro success but it tried to link to crt if mtune is removed Basically, -O0 is useful for step through debugging. MS Intrinsics always work. Mingw.org builtins always work. Mingw64 builtins never under -O0. I'll guess the mtune in newer Mingw64s somehow becomes a -O under the hood, but is there a magic -fturn-me-on option for mingw64 that fixes everything? Whats a "target specific specification files"? Do mingw.org and mingw64 "patch" or "change" the compile time settings or the C code of their GCCs? I compared the -dumpspecs of latest .org and latest w64, I see nothing relevant to builtins. But im not a gcc person. Thanks for the work around, but it doesn't work on existing Strawberry Perls, only yet to be born ones.
Subject: w64latest_vs_orglatest.diff
--- C:\Documents and Settings\Owner\Desktop\memcpy\specsw64 latest.txt +++ C:\Documents and Settings\Owner\Desktop\memcpy\specs.org. latest.txt @@ -1,5 +1,5 @@ *asm: -%{m32:--32} %{m64:--64} + *asm_debug: %{!g0:%{gstabs*:--gstabs}%{!gstabs*:%{g*:--gdwarf2}}} %{fdebug-prefix-map=*:--debug-prefix-map %*} @@ -15,7 +15,7 @@ as %(asm_options) %m.s %A } } *cpp: -%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT} %{municode:-DUNICODE} %{pthread:-D_REENTRANT} %{!no-pthread:-U_REENTRANT} +%{posix:-D_POSIX_SOURCE} %{mthreads:-D_MT} *cpp_options: %(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w} %{f*} %{g*:%{!g0:%{g*} %{!fno-working-directory:-fworking-directory}}} %{O*} %{undef} %{save-temps*:-fpch-preprocess} @@ -48,13 +48,13 @@ %{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} crtend.o%s *link: -%{m64:-m i386pep} %{!m64:-m i386pe} %{mwindows:--subsystem windows} %{mconsole:--subsystem console} %{shared: %{mdll: %eshared and mdll are not compatible}} %{shared: --shared} %{mdll:--dll} %{static:-Bstatic} %{!static:-Bdynamic} %{shared|mdll: %{m64:-e DllMainCRTStartup} %{!m64:-e _DllMainCRTStartup@12} --enable-auto-image-base} %(shared_libgcc_undefs) +%{mwindows:--subsystem windows} %{mconsole:--subsystem console} %{shared: %{mdll: %eshared and mdll are not compatible}} %{shared: --shared} %{mdll:--dll} %{static:-Bstatic} %{!static:-Bdynamic} %{shared|mdll: -e _DllMainCRTStartup@12 --enable-auto-image-base} %(shared_libgcc_undefs) *lib: -%{pg:-lgmon} %{pthread:-lpthread} %{!no-pthread: } %{mwindows:-lgdi32 -lcomdlg32} -ladvapi32 -lshell32 -luser32 -lkernel32 +%{pg:-lgmon} %{mwindows:-lgdi32 -lcomdlg32} -ladvapi32 -lshell32 -luser32 -lkernel32 *mfwrap: - %{static: %{fmudflap|fmudflapth: --wrap=malloc --wrap=free --wrap=calloc --wrap=realloc --wrap=mmap --wrap=mmap64 --wrap=munmap --wrap=alloca} %{fmudflapth: --wrap=pthread_create}} %{fmudflap|fmudflapth: --wrap=main} + %{static: %{fmudflap|fmudflapth: --wrap=malloc --wrap=free --wrap=calloc --wrap=realloc --wrap=mmap --wrap=munmap --wrap=alloca} %{fmudflapth: --wrap=pthread_create}} %{fmudflap|fmudflapth: --wrap=main} *mflib: %{fmudflap|fmudflapth: -export-dynamic} @@ -66,31 +66,31 @@ %{mthreads:-lmingwthrd} -lmingw32 %{shared-libgcc:-lgcc_s} %{!shared-libgcc:-lgcc_eh} -lgcc -lmoldname -lmingwex -lmsvcrt *startfile: -%{shared|mdll:dllcrt2%O%s} %{!shared:%{!mdll:%{!municode:crt2%O%s}}} %{!shared:%{!mdll:%{municode:crt2u%O%s}}} %{pg:gcrt2%O%s} crtbegin.o%s +%{shared|mdll:dllcrt2%O%s} %{!shared:%{!mdll:crt2%O%s}} %{pg:gcrt2%O%s} crtbegin.o%s *cross_compile: -1 +0 *version: -4.7.0 +4.6.2 *multilib: -. !m64 !m32;.:../lib64 m64 !m32;.:../lib !m64 m32; +. ; *multilib_defaults: -m32 + *multilib_extra: *multilib_matches: -m64 m64;m32 m32; + *multilib_exclusions: *multilib_options: -m64/m32 + *linker: collect2 @@ -128,15 +128,12 @@ *sysroot_hdrs_suffix_spec: -*self_spec: - - *cc1_cpu: %{march=native:%>march=native %:local_cpu_detect(arch) %{!mtune=*:%>mtune=native %:local_cpu_detect(tune)}} %{mtune=native:%>mtune=native %:local_cpu_detect(tune)} *shared_libgcc_undefs: - +%{shared-libgcc: -u ___register_frame_info -u ___deregister_frame_info} *link_command: -%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S: %(linker) %{!fno-use-linker-plugin:%{flto|flto=*|fuse-linker-plugin: -plugin %(linker_plugin_file) -plugin-opt=%(lto_wrapper) -plugin-opt=-fresolution=%u.res %{!nostdlib:%{!nodefaultlibs:%:pass-through-libs(%(link_gcc_c_sequence))}} }}%{flto|flto=*:%<fcompare-debug*} %{flto} %{flto=*} %l %{pie:-pie} %X %{o*} %{e*} %{N} %{n} %{r} %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}} %{static:} %{L*} %(mfwrap) %(link_libgcc) %o %{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)} %(mflib) %{fsplit-stack: --wrap=pthread_create} %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}} %{!nostdlib:%{!nostartfiles:%E}} %{T*} }}}}}} +%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S: %(linker) %{!fno-use-linker-plugin:%{flto|flto=*|fuse-linker-plugin: -plugin %(linker_plugin_file) -plugin-opt=%(lto_wrapper) -plugin-opt=-fresolution=%u.res %{!nostdlib:%{!nodefaultlibs:%:pass-through-libs(%(link_gcc_c_sequence))}} }} %{flto|flto=*:%<fcompare-debug*} %{flto} %{flto=*} %l %{pie:-pie} %X %{o*} %{e*} %{N} %{n} %{r} %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}} %{static:} %{L*} %(mfwrap) %(link_libgcc) %o %{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)} %(mflib) %{fsplit-stack: --wrap=pthread_create} %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}} %{!nostdlib:%{!nostartfiles:%E}} %{T*} }}}}}}
Subject: sperl512x86mtune.txt
C:\Documents and Settings\Owner\Desktop\memcpy>gcc memcpy.c -nostdlib -lkernel32 -o memcpy.exe -v -Wall -O0 -mtune=pentiumpro Using built-in specs. Target: i686-w64-mingw32 Configured with: ../gcc44-svn/configure --target=i686-w64-mingw32 --host=i686-w6 4-mingw32 --disable-multilib --disable-nls --disable-win32-registry --prefix=/mi ngw32 --with-gmp=/mingw32 --with-mpfr=/mingw32 --enable-languages=c,c++ Thread model: win32 gcc version 4.4.3 (GCC) COLLECT_GCC_OPTIONS='-nostdlib' '-o' 'memcpy.exe' '-v' '-Wall' '-O0' '-mtune=pen tiumpro' c:/sperl/c/bin/../libexec/gcc/i686-w64-mingw32/4.4.3/cc1.exe -quiet -v -iprefix c:\sperl\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/ memcpy.c -quiet -dumpbase mem cpy.c -mtune=pentiumpro -auxbase memcpy -O0 -Wall -version -o C:\WINDOWS\TEMP\cc grbbre.s ignoring nonexistent directory "/mingw32/include" ignoring duplicate directory "c:/sperl/c/lib/gcc/../../include" ignoring duplicate directory "c:/sperl/c/lib/gcc/../../lib/gcc/i686-w64-mingw32/ 4.4.3/include" ignoring duplicate directory "c:/sperl/c/lib/gcc/../../lib/gcc/i686-w64-mingw32/ 4.4.3/include-fixed" ignoring duplicate directory "c:/sperl/c/lib/gcc/../../lib/gcc/i686-w64-mingw32/ 4.4.3/../../../../i686-w64-mingw32/include" ignoring nonexistent directory "/mingw/include" #include "..." search starts here: #include <...> search starts here: c:\sperl\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../include c:\sperl\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/include c:\sperl\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/include-fixed c:\sperl\c\bin\../lib/gcc/i686-w64-mingw32/4.4.3/../../../../i686-w64-mingw32/i nclude End of search list. GNU C (GCC) version 4.4.3 (i686-w64-mingw32) compiled by GNU C version 4.4.3, GMP version 4.3.2, MPFR version 2.4.2-p 3. GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 4728d1fc720cf46696475c98813fbdef COLLECT_GCC_OPTIONS='-nostdlib' '-o' 'memcpy.exe' '-v' '-Wall' '-O0' '-mtune=pen tiumpro' c:/sperl/c/bin/../lib/gcc/i686-w64-mingw32/4.4.3/../../../../i686-w64-mingw32/b in/as.exe -v -o C:\WINDOWS\TEMP\ccJvUqJG.o C:\WINDOWS\TEMP\ccgrbbre.s GNU assembler version 2.20.51 (i686-w64-mingw32) using BFD version (GNU Binutils ) 2.20.51.20100123 COMPILER_PATH=c:/sperl/c/bin/../libexec/gcc/i686-w64-mingw32/4.4.3/;c:/sperl/c/b in/../libexec/gcc/;c:/sperl/c/bin/../lib/gcc/i686-w64-mingw32/4.4.3/../../../../ i686-w64-mingw32/bin/ LIBRARY_PATH=c:/sperl/c/bin/../lib/gcc/i686-w64-mingw32/4.4.3/;c:/sperl/c/bin/.. /lib/gcc/;c:/sperl/c/bin/../lib/gcc/i686-w64-mingw32/4.4.3/../../../../lib32/;c: /sperl/c/bin/../lib/gcc/i686-w64-mingw32/4.4.3/../../../../i686-w64-mingw32/lib/ ;c:/sperl/c/bin/../lib/gcc/i686-w64-mingw32/4.4.3/../../../ COLLECT_GCC_OPTIONS='-nostdlib' '-o' 'memcpy.exe' '-v' '-Wall' '-O0' '-mtune=pen tiumpro' c:/sperl/c/bin/../libexec/gcc/i686-w64-mingw32/4.4.3/collect2.exe -m i386pe -Bd ynamic -o memcpy.exe -Lc:/sperl/c/bin/../lib/gcc/i686-w64-mingw32/4.4.3 -Lc:/spe rl/c/bin/../lib/gcc -Lc:/sperl/c/bin/../lib/gcc/i686-w64-mingw32/4.4.3/../../../ ../lib32 -Lc:/sperl/c/bin/../lib/gcc/i686-w64-mingw32/4.4.3/../../../../i686-w64 -mingw32/lib -Lc:/sperl/c/bin/../lib/gcc/i686-w64-mingw32/4.4.3/../../.. C:\WIND OWS\TEMP\ccJvUqJG.o -lkernel32 C:\WINDOWS\TEMP\ccJvUqJG.o:memcpy.c:(.text+0x79): undefined reference to `memcpy ' C:\WINDOWS\TEMP\ccJvUqJG.o:memcpy.c:(.text+0x92): undefined reference to `memcpy ' collect2: ld returned 1 exit status C:\Documents and Settings\Owner\Desktop\memcpy>perl -V Summary of my perl5 (revision 5 version 12 subversion 3) configuration: Platform: osname=MSWin32, osvers=5.1, archname=MSWin32-x86-multi-thread uname='Win32 strawberryperl 5.12.3.0 #1 Sun May 15 09:44:53 2011 i386' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=undef, use64bitall=undef, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags =' -s -O2 -DWIN32 -DHAVE_DES_FCRYPT -DUSE_SITECUSTOMIZE - DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fno-strict-aliasing -mms-bitfields - DPERL_MSVCRT_READFIX', optimize='-s -O2', cppflags='-DWIN32' ccversion='', gccversion='4.4.3', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='long long', lseek size=8 alignbytes=8, prototype=define Linker and Libraries: ld='g++', ldflags ='-s -L"C:\sperl\perl\lib\CORE" -L"C:\sperl\c\lib"' libpth=C:\sperl\c\lib C:\sperl\c\i686-w64-mingw32\lib libs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32 perllibs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladva pi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lver sion -lodbc32 -lodbccp32 -lcomctl32 libc=, so=dll, useshrplib=true, libperl=libperl512.a gnulibc_version='' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-mdll -s -L"C:\sperl\perl\lib\CORE" -L"C:\sperl\c \lib"' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS PERL_MALLOC_WRAP PL_OP_SLAB_ALLOC USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_PERL_ATOF USE_SITECUSTOMIZE Built under MSWin32 Compiled at May 15 2011 17:02:01 %ENV: PERL_JSON_BACKEND="JSON::XS" PERL_YAML_BACKEND="YAML" @INC: C:/sperl/perl/site/lib C:/sperl/perl/vendor/lib C:/sperl/perl/lib . C:\Documents and Settings\Owner\Desktop\memcpy>
Subject: mingw64 latest-mtune.txt
C:\Documents and Settings\Owner\Desktop\memcpy>i686-w64-mingw32-gcc.exe memcpy.c -nostdlib -lkernel32 -o memcpy.exe -v -Wall -mtune=pentiumpro Using built-in specs. COLLECT_GCC=i686-w64-mingw32-gcc.exe COLLECT_LTO_WRAPPER=c:/sources/mingw64/bin/../libexec/gcc/i686-w64-mingw32/4.7.0 /lto-wrapper.exe Target: i686-w64-mingw32 Configured with: ../../../build/gcc/src/configure --target=i686-w64-mingw32 --pr efix=/c/bb/vista64-mingw32/mingw-x86-x86/build/build/root --with-sysroot=/c/bb/v ista64-mingw32/mingw-x86-x86/build/build/root --enable-languages=all,obj-c++ --e nable-fully-dynamic-string --disable-multilib Thread model: win32 gcc version 4.7.0 20111219 (experimental) (GCC) COLLECT_GCC_OPTIONS='-nostdlib' '-o' 'memcpy.exe' '-v' '-Wall' '-mtune=pentiumpr o' '-march=pentiumpro' c:/sources/mingw64/bin/../libexec/gcc/i686-w64-mingw32/4.7.0/cc1.exe -quiet -v -iprefix c:\sources\mingw64\bin\../lib/gcc/i686-w64-mingw32/4.7.0/ -U_REENTRANT memcpy.c -quiet -dumpbase memcpy.c -mtune=pentiumpro -march=pentiumpro -auxbase memcpy -Wall -version -o C:\WINDOWS\TEMP\ccYCATxZ.s GNU C (GCC) version 4.7.0 20111219 (experimental) (i686-w64-mingw32) compiled by GNU C version 4.5.2, GMP version 5.0.1, MPFR version 2.4.2, MPC version 0.8.2 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 ignoring duplicate directory "c:/sources/mingw64/lib/gcc/../../lib/gcc/i686-w64- mingw32/4.7.0/include" ignoring nonexistent directory "c:/bb/vista64-mingw32/mingw-x86-x86/build/build/ rootc:/bb/vista64-mingw32/mingw-x86-x86/build/build/root/lib/gcc/i686-w64-mingw3 2/4.7.0/../../../../include" ignoring duplicate directory "c:/sources/mingw64/lib/gcc/../../lib/gcc/i686-w64- mingw32/4.7.0/include-fixed" ignoring duplicate directory "c:/sources/mingw64/lib/gcc/../../lib/gcc/i686-w64- mingw32/4.7.0/../../../../i686-w64-mingw32/include" ignoring nonexistent directory "c:/bb/vista64-mingw32/mingw-x86-x86/build/build/ rootc:/mingw/include" #include "..." search starts here: #include <...> search starts here: c:\sources\mingw64\bin\../lib/gcc/i686-w64-mingw32/4.7.0/include c:\sources\mingw64\bin\../lib/gcc/i686-w64-mingw32/4.7.0/include-fixed c:\sources\mingw64\bin\../lib/gcc/i686-w64-mingw32/4.7.0/../../../../i686-w64-m ingw32/include End of search list. GNU C (GCC) version 4.7.0 20111219 (experimental) (i686-w64-mingw32) compiled by GNU C version 4.5.2, GMP version 5.0.1, MPFR version 2.4.2, MPC version 0.8.2 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 Compiler executable checksum: 8c5ba8a77bffe2fbf96ff9655da73258 COLLECT_GCC_OPTIONS='-nostdlib' '-o' 'memcpy.exe' '-v' '-Wall' '-mtune=pentiumpr o' '-march=pentiumpro' c:/sources/mingw64/bin/../lib/gcc/i686-w64-mingw32/4.7.0/../../../../i686-w64-m ingw32/bin/as.exe -o C:\WINDOWS\TEMP\cco1nERa.o C:\WINDOWS\TEMP\ccYCATxZ.s COMPILER_PATH=c:/sources/mingw64/bin/../libexec/gcc/i686-w64-mingw32/4.7.0/;c:/s ources/mingw64/bin/../libexec/gcc/;c:/sources/mingw64/bin/../lib/gcc/i686-w64-mi ngw32/4.7.0/../../../../i686-w64-mingw32/bin/ LIBRARY_PATH=c:/sources/mingw64/bin/../lib/gcc/i686-w64-mingw32/4.7.0/;c:/source s/mingw64/bin/../lib/gcc/;c:/sources/mingw64/bin/../lib/gcc/i686-w64-mingw32/4.7 .0/../../../../i686-w64-mingw32/lib/../lib/;c:/sources/mingw64/bin/../lib/gcc/i6 86-w64-mingw32/4.7.0/../../../../i686-w64-mingw32/lib/ COLLECT_GCC_OPTIONS='-nostdlib' '-o' 'memcpy.exe' '-v' '-Wall' '-mtune=pentiumpr o' '-march=pentiumpro' c:/sources/mingw64/bin/../libexec/gcc/i686-w64-mingw32/4.7.0/collect2.exe --sys root=c:/bb/vista64-mingw32/mingw-x86-x86/build/build/root -m i386pe -Bdynamic -o memcpy.exe -Lc:/sources/mingw64/bin/../lib/gcc/i686-w64-mingw32/4.7.0 -Lc:/sour ces/mingw64/bin/../lib/gcc -Lc:/sources/mingw64/bin/../lib/gcc/i686-w64-mingw32/ 4.7.0/../../../../i686-w64-mingw32/lib/../lib -Lc:/sources/mingw64/bin/../lib/gc c/i686-w64-mingw32/4.7.0/../../../../i686-w64-mingw32/lib C:\WINDOWS\TEMP\cco1nE Ra.o -lkernel32 C:\Documents and Settings\Owner\Desktop\memcpy>
Subject: sperl514x64mtune.txt
C:\Documents and Settings\Administrator\Desktop\memcpy>gcc.exe memcpy.c -nostdli b -lkernel32 -o memcpy.exe -v -Wall -O0 -mtune=native Using built-in specs. Target: x86_64-w64-mingw32 Configured with: ../gcc44-svn/configure --host=x86_64-w64-mingw32 --target=x86_6 4-w64-mingw32 --disable-multilib --enable-checking=release --prefix=/opt/mingw64 --enable-languages=c,c++,fortran --enable-libgomp --with-gmp=/opt/mingw64 --wit h-mpfr=/opt/mingw64 --disable-nls --disable-win32-registry Thread model: win32 gcc version 4.4.7 20111023 (prerelease) [svn/rev.180339 - mingw-w64/oz] (GCC) COLLECT_GCC_OPTIONS='-nostdlib' '-o' 'memcpy.exe' '-v' '-Wall' '-O0' c:/sperl/c/bin/../libexec/gcc/x86_64-w64-mingw32/4.4.7/cc1.exe -quiet -v -ipref ix c:\sperl\c\bin\../lib/gcc/x86_64-w64-mingw32/4.4.7/ memcpy.c --param l1-cache -size=64 --param l1-cache-line-size=64 --param l2-cache-size=1024 -mtune=k8 -qui et -dumpbase memcpy.c -auxbase memcpy -O0 -Wall -version -o C:\DOCUME~1\ADMINI~1 \LOCALS~1\Temp\ccecwpRy.s ignoring nonexistent directory "/opt/mingw64/include" ignoring duplicate directory "c:/sperl/c/lib/gcc/../../include" ignoring duplicate directory "c:/sperl/c/lib/gcc/../../lib/gcc/x86_64-w64-mingw3 2/4.4.7/include" ignoring duplicate directory "c:/sperl/c/lib/gcc/../../lib/gcc/x86_64-w64-mingw3 2/4.4.7/include-fixed" ignoring duplicate directory "c:/sperl/c/lib/gcc/../../lib/gcc/x86_64-w64-mingw3 2/4.4.7/../../../../x86_64-w64-mingw32/include" ignoring nonexistent directory "/mingw/include" #include "..." search starts here: #include <...> search starts here: c:\sperl\c\bin\../lib/gcc/x86_64-w64-mingw32/4.4.7/../../../../include c:\sperl\c\bin\../lib/gcc/x86_64-w64-mingw32/4.4.7/include c:\sperl\c\bin\../lib/gcc/x86_64-w64-mingw32/4.4.7/include-fixed c:\sperl\c\bin\../lib/gcc/x86_64-w64-mingw32/4.4.7/../../../../x86_64-w64-mingw 32/include End of search list. GNU C (GCC) version 4.4.7 20111023 (prerelease) [svn/rev.180339 - mingw-w64/oz] (x86_64-w64-mingw32) compiled by GNU C version 4.4.7 20111023 (prerelease) [svn/rev.180339 - mingw-w64/oz], GMP version 4.3.2, MPFR version 2.4.2-p3. GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 7f003b2e17f55850125668526349529b COLLECT_GCC_OPTIONS='-nostdlib' '-o' 'memcpy.exe' '-v' '-Wall' '-O0' c:/sperl/c/bin/../lib/gcc/x86_64-w64-mingw32/4.4.7/../../../../x86_64-w64-mingw 32/bin/as.exe -v -o C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\cc5szT7z.o C:\DOCUME~1\AD MINI~1\LOCALS~1\Temp\ccecwpRy.s GNU assembler version 2.21.90 (x86_64-w64-mingw32) using BFD version (GNU Binuti ls) 2.21.90.20111031 COMPILER_PATH=c:/sperl/c/bin/../libexec/gcc/x86_64-w64-mingw32/4.4.7/;c:/sperl/c /bin/../libexec/gcc/;c:/sperl/c/bin/../lib/gcc/x86_64-w64-mingw32/4.4.7/../../.. /../x86_64-w64-mingw32/bin/ LIBRARY_PATH=c:/sperl/c/bin/../lib/gcc/x86_64-w64-mingw32/4.4.7/;c:/sperl/c/bin/ ../lib/gcc/;c:/sperl/c/bin/../lib/gcc/x86_64-w64-mingw32/4.4.7/../../../../lib64 /;c:/sperl/c/bin/../lib/gcc/x86_64-w64-mingw32/4.4.7/../../../../x86_64-w64-ming w32/lib/;c:/sperl/c/bin/../lib/gcc/x86_64-w64-mingw32/4.4.7/../../../ COLLECT_GCC_OPTIONS='-nostdlib' '-o' 'memcpy.exe' '-v' '-Wall' '-O0' c:/sperl/c/bin/../libexec/gcc/x86_64-w64-mingw32/4.4.7/collect2.exe -m i386pep -Bdynamic -o memcpy.exe -Lc:/sperl/c/bin/../lib/gcc/x86_64-w64-mingw32/4.4.7 -Lc :/sperl/c/bin/../lib/gcc -Lc:/sperl/c/bin/../lib/gcc/x86_64-w64-mingw32/4.4.7/.. /../../../lib64 -Lc:/sperl/c/bin/../lib/gcc/x86_64-w64-mingw32/4.4.7/../../../.. /x86_64-w64-mingw32/lib -Lc:/sperl/c/bin/../lib/gcc/x86_64-w64-mingw32/4.4.7/../ ../.. C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\cc5szT7z.o -lkernel32 C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\cc5szT7z.o:memcpy.c:(.text+0x85): undefined r eference to `memcpy' C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\cc5szT7z.o:memcpy.c:(.text+0x9e): undefined r eference to `memcpy' collect2: ld returned 1 exit status C:\Documents and Settings\Administrator\Desktop\memcpy>perl -V Summary of my perl5 (revision 5 version 14 subversion 2) configuration: Platform: osname=MSWin32, osvers=4.0, archname=MSWin32-x64-multi-thread uname='Win32 strawberryperl 5.14.2.1 #1 Tue Nov 22 22:40:59 2011 x64' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=define, use64bitall=undef, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags =' -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -DPERL_TEXTMODE_ SCRIPTS -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fno-str ict-aliasing -mms-bitfields', optimize='-s -O2', cppflags='-DWIN32' ccversion='', gccversion='4.4.7', gccosandvers='' intsize=4, longsize=4, ptrsize=8, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='long long', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='g++', ldflags ='-s -L"C:\sperl\perl\lib\CORE" -L"C:\sperl\c\lib"' libpth=C:\sperl\c\lib C:\sperl\c\x86_64-w64-mingw32\lib libs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32 perllibs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladva pi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lver sion -lodbc32 -lodbccp32 -lcomctl32 libc=, so=dll, useshrplib=true, libperl=libperl514.a gnulibc_version='' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-mdll -s -L"C:\sperl\perl\lib\CORE" -L"C:\sperl\c \lib"' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS PERL_MALLOC_WRAP PERL_PRESERVE_IVUV PL_OP_SLAB_ALLOC USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_PERL_ATOF USE_SITECUSTOMIZE Built under MSWin32 Compiled at Nov 22 2011 22:53:05 %ENV: PERL_JSON_BACKEND="JSON::XS" PERL_YAML_BACKEND="YAML" @INC: C:/sperl/perl/site/lib C:/sperl/perl/vendor/lib C:/sperl/perl/lib . C:\Documents and Settings\Administrator\Desktop\memcpy>
Hi, This is a gcc feature / issue. mingw.org always passes -mtune=i386 as a default. So, with 4.6.3 compiler from perlmingw.sf.net if you also pass - mtune=i386 then that 'works' fine too. Likewise, if you pass -mtune=pentium4 to mingw.org ( so overriding the default ) then that will fail. (as will -mtune=generic and a number of other processor options) mingw.org passing '-i386' is the odd behaviour. According to gcc docs, the default behaviour should be -mtune=generic Anyhow, it is a gcc issue and you may not get any joy getting this fixed as it may be a feature rather than a 'bug'. Using builtins is regarded as an optimization so by default is switched off by gcc if you pass -O0. gcc should allow you to override the behaviour by calling __builtin_memcpy - but this bit of gcc seems to fail. But it is a gcc issue, not a mingw issue. Mingw code doesn't mess miss the __builtins_ prefix. I suspect that in the gcc code, specifying certain -mtune params counts as an optimization - hence the unintentional side effect of passing - mtune=i386 meaning gcc compiles builtins for you. There is no workaround for 64 bit mingw. I realise this isn't helpful but is is the answer. On a wider note, why would you want to avoid linking to msvcrt in a debugging app? regards Mark
From: bulk88 [...] hotmail.com
Show quoted text
> I realise this isn't helpful but is is the answer. > > On a wider note, why would you want to avoid linking to msvcrt in a > debugging app? > > regards > > Mark
The Windows API is so feature loaded, its quite easy to write windows perl XS mods, or optimize perl XS mods, to NOT use the CRT. Not using the CRT saves 1KB in the PE image because of the various static linked configuration code and data of the CRT (signals/callbacks, C level TLS, C++ object support, C++ exception/SEH marriage). Kernel32 has some string processing functions. User32 has a sprintf and charupper. Shlwapi has more string processing, but pre 5.12 perls dont link to it and it has no byte processing. But unless you will runtime link with ntdll, there is no non-CRT memcpy anywhere in the windows api AFAIK. CopyMemory is a macro for memcpy, not a Kernel32 func. MoveMemory is only available on Win NT. MSVC intrinsics fit the job perfectly. GCC builtins would too, except for everything above :-( I think you explain correctly why .org and w64 are different, .org selects a "i386" processor target optimization level. I guess there is no way around finding a CRT or pseudo CRT (ntdll) at runtime to avoid the overload of using the CRT directly on GCC, unless you test compile something using builtins with the current $Config{ccflags} and $Config{optimize} key and/or the user's makefile.pl overrides in the WriteMakefile hash.
Well, it is still a bug in GCC I think. In the GCC source in gcc/builtins.c is the following code /* When not optimizing, generate calls to library functions for a certain set of builtins. */ if (!optimize && !called_as_built_in (fndecl) && DECL_ASSEMBLER_NAME_SET_P (fndecl) && fcode != BUILT_IN_ALLOCA && fcode != BUILT_IN_FREE) return expand_call (exp, target, ignore); The 'called_as_built_in()' function should return true if you called the function as __builtin_memcpy, but I think it probably does not work on Windows at all. You should note that __builtin_memcpy is ALWAYS translated to 'memcpy' - it just depends on whether gcc includes the implementation for linking or not. For any -O level other than -O0, 'optimize' is true. I think some settings for mtune must set one of the other options to return true (or maybe change 'optimize', but I didn't have the time to track gcc option setting through the source. As I understand your reply, the benefit you seek is a 1k saving in PE image size? If I were you I'd live with it and add -O0 -lmsvcrt to your flags. Alternatively take up the potential bug above with the gcc folks. Regards Mark
From: bulk88 [...] hotmail.com
Show quoted text
> As I understand your reply, the benefit you seek is a 1k saving in PE > image size? If I were you I'd live with it and add -O0 -lmsvcrt to your > flags. Alternatively take up the potential bug above with the gcc folks. > > Regards > > Mark >
The builtins are so buggy and unpredictable (pentium4 vs generic vs i386 vs x64 mtune flags) I declare they are unusable in a XS library. The only safe way I see to do this is to parse the makemaker makefile macros then do test compiles with those flags on that particular gcc build to see if the builtins work without a C Lib at a particular combination of flags, which seems too complicated and too easy to break. Instead I made a solution of finding an existing C loaded in the process and then runtime linking to it. Much less than 1 KB in the PE file. You can close this bug now.