#1642 DLL generated with -pg option in 4.7 is buggy

OTHER
open
Bug
none
Unknown
False
2014-08-26
2012-06-13
No

> gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/i686-w64-mingw32/4.7.0/lto-wrapp
er.exe
Target: i686-w64-mingw32
Configured with: ../..//mingw-src/gcc-4.7.0/configure --host=i686-w64-mingw32 --
build=i686-w64-mingw32 --target=i686-w64-mingw32 --enable-targets=all --enable-m
ultilib --prefix=/mingw-gcc-4.7.0-x32 --with-sysroot=/mingw-gcc-4.7.0-x32 --with
-tune=generic --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes -
-with-host-libstdcxx='-static -lstdc++' --enable-shared --enable-static --enable
-threads=posix --enable-libgomp --enable-lto --enable-graphite --enable-cloog-ba
ckend=isl --enable-checking=release --enable-fully-dynamic-string --enable-versi
on-specific-runtime-libs --enable-sjlj-exceptions --disable-ppl-version-check --
disable-cloog-version-check --disable-libstdcxx-pch --disable-libstdcxx-debug --
disable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disab
le-werror --disable-symvers --with-gmp=/mingw-gcc-4.7.0-libs-x32 --with-mpfr=/mi
ngw-gcc-4.7.0-libs-x32 --with-mpc=/mingw-gcc-4.7.0-libs-x32 --with-ppl=/mingw-gc
c-4.7.0-libs-x32 --with-cloog=/mingw-gcc-4.7.0-libs-x32 --with-libiconv --with-p
kgversion='MinGW-builds: https://sourceforge.net/projects/mingwbuilds/' --with-b
ugurl=https://sourceforge.net/projects/mingwbuilds/ CFLAGS='-O2 -pipe -fomit-fra
me-pointer -momit-leaf-frame-pointer -I/mingw-gcc-4.7.0-libs-x32/include' CXXFLA
GS='-O2 -pipe -fomit-frame-pointer -momit-leaf-frame-pointer' CPPFLAGS= LDFLAGS=
'-pipe -s -L/mingw-gcc-4.7.0-libs-x32/lib'
Thread model: posix
gcc version 4.7.0 (MinGW-builds: https://sourceforge.net/projects/mingwbuilds/\)

libsimple.c 's contents:

__declspec(dllexport) int add2Ints(int a, int b)
{
return a + b;
}
_________

> gcc -c libsimple.c
> gcc -pg -mdll -o libsimple.dll libsimple.o

gave me a DLL. Test program testlib.c

#include <windows.h>
int main()
{
int ret = -1;
HINSTANCE hInst = LoadLibrary(L"libsimple.dll");
if (hInst)
{
ret = FreeLibrary(hInst);
}
return ret;
}
_________
compiles fine with gcc -g -o testlib.exe -DUNICODE testlib.c

When testlib.exe is run, the FreeLibrary call hangs. I confirmed this in gdb.

The same DLL when linked without the -pg option works fine.
Linking the DLL with just -g or just -p works fine too.

Now on MinGW 4.6.1 I've tried the same exercise and there -pg, -p or -g all the three works fine.

Discussion

  • Sundaram Ramaswamy

    > ld -v
    GNU ld (GNU Binutils) 2.22.52.20120417

     
  • Sundaram Ramaswamy

    Simple self contained test pack

     
  • Sundaram Ramaswamy

    To reproduce the issue, extract the attached Test.7z and run test.bat with MinGW 4.7's bin in %PATH%. See the issue, now try the same with MinGW 4.6.1 and see that the issue isn't there.

     
  • Earnie Boyd

    Earnie Boyd - 2012-06-13
    • assigned_to: nobody --> cstrauss
     
  • Earnie Boyd

    Earnie Boyd - 2012-06-13

    Could this be an issue with runtime library compatibility with differing versions of GCC? The 4.7 release requires that all libraries be the same version.

     
  • Earnie Boyd

    Earnie Boyd - 2012-06-14
    • labels: 456608 --> gcc-4.7.0
     
  • Earnie Boyd

    Earnie Boyd - 2013-02-11
    • labels: gcc-4.7.0 --> gcc-4.7.0, gcc
    • milestone: --> OTHER
    • type: --> Bug
    • resolution: --> none
    • category: --> Unknown
    • patch_attached: --> False
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks