[Bug ada/80921] cross compiling fails to build Ada shared libraries

2017-06-02 Thread ebotcazou at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80921

--- Comment #16 from Eric Botcazou  ---
> BTW, although I am now able to build the DLLs, install-strip does not strip
> the installed copies; should it?

Probably, but in my experience stripping can have unexpected fallout.

[Bug ada/80921] cross compiling fails to build Ada shared libraries

2017-06-02 Thread keith.marshall at mailinator dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80921

--- Comment #15 from Keith Marshall  ---
Created attachment 41464
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41464=edit
Patch to create gnatlib import libraries for Win32

(In reply to Eric Botcazou from comment #14)
> In any case, the Windows GNAT folks are happy with the current situation.

Fair enough.  FWIW, I've applied the attached (trivial) patch, for my MinGW.org
build of GCC-6.3.0, so we do get the import libraries.  Feel free to adopt it,
or not, as you please.

BTW, although I am now able to build the DLLs, install-strip does not strip the
installed copies; should it?

[Bug ada/80921] cross compiling fails to build Ada shared libraries

2017-06-01 Thread ebotcazou at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80921

--- Comment #14 from Eric Botcazou  ---
> That's not strictly true; while they may not be essential, import libraries
> are, by no means, obsolete.  The search order, for the Windows linker[1], is:
> 
> libfoo.dll.a
> foo.dll.a
> libfoo.a
> foo.dll
> libfoo.dll
> 
> So, unless the foo.dll (or libfoo.dll) is in a different path from libfoo.a,
> and that path is searched earlier that the conventional lib path, then -lfoo
> will always cause static linking, if libfoo.dll.a is not provided.  Also,
> when the static library is libfoo.a, and the DLL is qualified by a version
> suffix, -lfoo will never find libfoo-N.dll; this entirely defeats the
> linker's -Bdynamic vs. -Bstatic selection for -lfoo.

I see, thanks for the detailed explanation.  There has been a long time since I
really toyed with Windows development and I thought that all this non-sense had
been eliminated, but apparently not...

In any case, the Windows GNAT folks are happy with the current situation.

[Bug ada/80921] cross compiling fails to build Ada shared libraries

2017-06-01 Thread keith.marshall at mailinator dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80921

--- Comment #13 from Keith Marshall  ---
(In reply to Eric Botcazou from comment #7)
> > With that in place, a clean configure and build does now produce:
> > 
> > gcc/ada/rts/libgnarl-6.dll
> > gcc/ada/rts/libgnat-6.dll
> > 
> > but there are no accompanying import libraries, (as there are for other
> > DLLs, produced for other languages in the GCC suite).  Definitely an
> > improvement, but perhaps not quite the entire solution.
> 
> Thanks for the feedback.  The Ada compiler doesn't use libtool to build its
> library so that's as expected (and import libraries are obsolete these days).

That's not strictly true; while they may not be essential, import libraries
are, by no means, obsolete.  The search order, for the Windows linker[1], is:

libfoo.dll.a
foo.dll.a
libfoo.a
foo.dll
libfoo.dll

So, unless the foo.dll (or libfoo.dll) is in a different path from libfoo.a,
and that path is searched earlier that the conventional lib path, then -lfoo
will always cause static linking, if libfoo.dll.a is not provided.  Also, when
the static library is libfoo.a, and the DLL is qualified by a version suffix,
-lfoo will never find libfoo-N.dll; this entirely defeats the linker's
-Bdynamic vs. -Bstatic selection for -lfoo.

A further problem with your DLL only convention is that the linker search path
(normally) isn't anywhere that a running application will expect to find its
shared objects, so we end up installing multiple copies of the DLL, spread
around the file system.

MinGW convention is to provide libfoo.dll.a and libfoo.a, in the linker search
path, with foo-N.dll (or libfoo-N.dll) in the runtime path.

[1]:
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/4/html/Using_ld_the_GNU_Linker/win32.html

[Bug ada/80921] cross compiling fails to build Ada shared libraries

2017-06-01 Thread ebotcazou at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80921

Eric Botcazou  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |6.4

--- Comment #12 from Eric Botcazou  ---
Fixed for 6.4 and later releases.

[Bug ada/80921] cross compiling fails to build Ada shared libraries

2017-06-01 Thread ebotcazou at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80921

--- Comment #11 from Eric Botcazou  ---
Author: ebotcazou
Date: Thu Jun  1 10:52:29 2017
New Revision: 248787

URL: https://gcc.gnu.org/viewcvs?rev=248787=gcc=rev
Log:
PR ada/80921
* configure.ac (default_gnatlib_target): Remove bogus condition.
(have_getipinfo): Tweak.
* configure: Regenerate.

Modified:
branches/gcc-6-branch/libada/ChangeLog
branches/gcc-6-branch/libada/configure
branches/gcc-6-branch/libada/configure.ac

[Bug ada/80921] cross compiling fails to build Ada shared libraries

2017-06-01 Thread ebotcazou at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80921

--- Comment #10 from Eric Botcazou  ---
Author: ebotcazou
Date: Thu Jun  1 10:51:50 2017
New Revision: 248786

URL: https://gcc.gnu.org/viewcvs?rev=248786=gcc=rev
Log:
PR ada/80921
* configure.ac (default_gnatlib_target): Remove bogus condition.
(have_getipinfo): Tweak.
* configure: Regenerate.

Modified:
branches/gcc-7-branch/libada/ChangeLog
branches/gcc-7-branch/libada/configure
branches/gcc-7-branch/libada/configure.ac

[Bug ada/80921] cross compiling fails to build Ada shared libraries

2017-06-01 Thread ebotcazou at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80921

--- Comment #9 from Eric Botcazou  ---
Author: ebotcazou
Date: Thu Jun  1 10:51:15 2017
New Revision: 248785

URL: https://gcc.gnu.org/viewcvs?rev=248785=gcc=rev
Log:
PR ada/80921
* configure.ac (default_gnatlib_target): Remove bogus condition.
(have_getipinfo): Tweak.
* configure: Regenerate.

Modified:
trunk/libada/ChangeLog
trunk/libada/configure
trunk/libada/configure.ac

[Bug ada/80921] cross compiling fails to build Ada shared libraries

2017-06-01 Thread ebotcazou at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80921

--- Comment #8 from Eric Botcazou  ---
> Looking in the build log, (i.e. output from 'make 2>&1 | tee build.log'), I
> now see the commands which create these DLLs; in both cases, they invoke:
> 
> mingw32-gcc -shared -shared-libgcc ...
> 
> which is correct, (although -static-libgcc may be safer);

No, -static-libgcc will break exception handling here.

[Bug ada/80921] cross compiling fails to build Ada shared libraries

2017-06-01 Thread ebotcazou at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80921

--- Comment #7 from Eric Botcazou  ---
> With that in place, a clean configure and build does now produce:
> 
> gcc/ada/rts/libgnarl-6.dll
> gcc/ada/rts/libgnat-6.dll
> 
> but there are no accompanying import libraries, (as there are for other
> DLLs, produced for other languages in the GCC suite).  Definitely an
> improvement, but perhaps not quite the entire solution.

Thanks for the feedback.  The Ada compiler doesn't use libtool to build its
library so that's as expected (and import libraries are obsolete these days).