[Bug target/40905] GCC creates invalid executable with auto-imported DLL and __attribute__((cold))

dannysmith at users dot sourceforge dot net gcc-bugzilla@gcc.gnu.org
Thu Jul 30 08:00:00 GMT 2009



------- Comment #4 from dannysmith at users dot sourceforge dot net  2009-07-30 08:00 -------
(In reply to comment #2)

> 
> Is it possible that it triggers the exception trying to write in text.unlikely
> which is READONLY?
> 

Exactly.  This is a linker, not a compiler issue.  If you are using a
relatively recent binutils and mingw run time, the addition of the switch
-Wl,--enable-runtime-pseudo-reloc-v2 should get around the READONLY problem.
Otherwise, you could always just add __declspec (dllimport) to
 extern int foo[2]; and so retain portability with the rest of the PE-COFF
world.

Danny


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40905



More information about the Gcc-bugs mailing list