On Fri, Apr 23, 2010 at 5:35 AM, Janus Weil <ja...@gcc.gnu.org> wrote:
> I'm redirecting my question here, since it also applies to "gcc
> -static" on Cygwin.
>
> Cheers,
> Janus
>
>
>
> ---------- Forwarded message ----------
> From: Janus Weil <ja...@gcc.gnu.org>
> Date: 2010/4/23
> Subject: static linking on Cygwin
> To: gfortran <fort...@gcc.gnu.org>
>
>
> Hi all,
>
> I have just tried the gfortran 4.3.4 build on Cygwin/WinXP (I'm not a
> regular Windows/Cygwin user though).
>
> One thing I noticed is that compiling with -static fails:
>
> /usr/lib/gcc/i686-pc-cygwin/4.3.4/../../../../i686-pc-cygwin/bin/ld:
> cannot find -lgcc_
>
> It works, however, when adding -static-libgcc. On Linux compiling with
> -static works fine, also without -static-libgcc. Can someone explain
> this behaviour to me? Is this a feature or a bug?
>

I was thinking that the cygwin/mingw32/w64-mingw32 ports should follow
the same logic that linux does with respect to the shared gcc dll
(excepting for the --[no]as-needed linker flags, which isn't needed as
all DLLs are --no-as-needed - there's no propogation of depenedency
DLLs to the parent on Win32 targets).  In order for exception handling
to work across dll boundaries, the default should, IMO, imply libgcc_s
as it does on other targets, and -static should be explicitly required
to turn off the libgcc_s and use libgcc_eh on the Win32 targets.

For example, currently exception handling in objective c doesn't work
properly if using the runtime as a DLL, since the gcc driver is used
to build the objc runtime dll.  The g++ driver doesn't suffer this,
because using this driver implies -shared-libgcc

Reply via email to