lists.zerezo.com



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

***BOGO*** [Mingw-users] Bad DLL relocation - reproducible w/ test case



Hi,

I've finally tracked down a rare crash in a MingW-built DLL that was 
causing invalid memory accesses on DLL load.

The problem is that DLLs generated by MingW GCC (with -shared) are not 
correctly relocatable, even though they contain relocation information. 
LoadLibrary() returns ERROR_NOACCESS if it is forced to relocate the DLL 
and a backtrace shows a blind jump into bad memory from 
__gcc_register_frame.

Forcing relocation is easily reproducible by loading a second, 
differently named copy of the DLL. Source and simple Makefile here:
   http://www.jcornwall.me.uk/misc/reloc_testcase.zip

The backtrace I get isn't highly useful, but here it is:

Program received signal SIGSEGV, Segmentation fault.
0x9deb0000 in ?? ()
(gdb) bt
#0  0x9deb0000 in ?? ()
#1  0x003f11aa in __gcc_register_frame ()
    from library2.dll
#2  0x003f12c7 in __do_global_ctors ()
    from library2.dll
#3  0x003f10e1 in DllMainCRTStartup@12 ()
    from library2.dll
#4  0x7c81a352 in ntdll!LdrQueryProcessModuleInformation ()
    from /cygdrive/c/WINDOWS/system32/ntdll.dll
#5  0x003f0000 in ?? ()
#6  0x00000001 in ?? ()
#7  0x00000000 in ?? ()

I am using GCC 4.3.0 20080305 (alpha-testing) mingw-20080502 and LD 
2.17.50 20060824. Any ideas?

-- 
Jay L. T. Cornwall
http://www.jcornwall.me.uk/

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users