cygwin, libtool, dlpreopen, and .rdata

Ralf Habacker ralf.habacker@freenet.de
Sat Oct 23 18:01:00 GMT 2004


Hi Chuck, 

you wrote
>With newer gcc's (cygwin version numbers 3.3.3-3, 3.4.1-1, but not 3.3.1-3), 
>const variables are placed in an .rdata section. This causes problems when 
>those  variables contain references to OTHER vars that are imported from a 
dll -- because the runtime relocation machinery can't fixup the address, 
since the  variable holding the address is const -- and is in .rdata!
<snip>
>But it can't, because .rdata is non-writable. However, this is a *runtime* 
>error; the *link* succeeds. But when you run the app, you get a popup window 
>declaring:
>
>"The application failed to initialize properly (0xc0000005). Click on OK to 
>terminate the application."
>
>Note that (1) the "nothing" relocation works fine for "normal" links; 
hell.exe  works ok, and imports "nothing" correctly.
>
<snip>
>************************************* 
>I see two solutions: a short term libtool->focused workaround, 
>and a longer term general solution. 
>
stumpled the last time about this problem with qt/cygwin releases and found a 
generic workaround by using a specific linker script, which avoids rdata 
sections. (script is appended). 
Copy the linker script for example to /usr/lib/ldscripts and run the following 
line to link a dll. 

gcc -Wl,--script,/usr/lib/ldscripts/i386pe.x-no-rdata 


May be this help some people 

Regards 
Ralf 




-------------- next part --------------
A non-text attachment was scrubbed...
Name: i386pe.x-no-rdata
Type: text/x-csrc
Size: 5105 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20041023/bde2a3e2/attachment.bin>
-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list