public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin-apps@cygwin.com
Subject: Re: [ANNOUNCEMENT] TEST RELEASE: Cygwin 2.5.0-0.8
Date: Sun, 20 Mar 2016 20:53:00 -0000	[thread overview]
Message-ID: <20160320204544.GB3422@calimero.vinschen.de> (raw)
In-Reply-To: <871t75m2qb.fsf@Rainer.invalid>

[-- Attachment #1: Type: text/plain, Size: 3185 bytes --]

On Mar 20 19:19, Achim Gratz wrote:
> Corinna Vinschen writes:
> > These functions are defined on both platforms.  What's *not* defined on
> > 64 bit, but only on 32 bit, are the same functions preceeded with an
> > underscore, e.g. _copysign.
> >
> > Can you please check again?  There's something else going wrong here.
> 
> What's going wrong is that the symbols are also defined in libc.a on
> 32bit and only in libm.a on 64bit.  The configury for Cygwin removes
> both -lc and -lm from the list of libraries that should explicitly be
> linked with, a comment is present that both libc and libm symlink to
> libcygwin and are implied by gcc anyway.  However that doesn't seem to
> be the case anymore on both architectures (these files are not symlinked
> and not hardlinked either), but the symbol construction is just
> different enough for this not to work on 64bit it would seem.

No, that's not quite it.  The problem is that on 32 bit the
*underscored* functions are exported by libc.a.  This is an accident,
and probably one which is many years old.  Here's what's exported by
libm.a:

  nm libm.a | grep copysign
	   U __imp__copysign
  00000000 T _copysign
	   U __imp__copysignf
  00000000 T _copysignf

And here's what's exported on 32 bit by libc.a.  Note the extra leading
underscore:

  $ nm libc.a | grep copysign
  00000000 T __copysign
	   U __imp___copysign
  00000000 T __copysignf
	   U __imp___copysignf

These underscored versions were always exported additionally by the 32
bit version but they have never been exported on 64 bit since exporting
them was wrong from the start.

> It works correctly if I don't let the configury check the symbols via nm
> in the link libraries, but instead compile a small test program for each
> symbol.  That's probably the best solution, all things considered.  It
> does not even seem to be that much slower.

The nm expression apparently finds the underscored versions even though
it shouldn't.

> Last but not least the Win32 and Win32-API modules have trouble with
> including the right files to get at wcslen and wcscpy.  This is what
> these sources do to apparently get at those symbols:
> 
> --8<---------------cut here---------------start------------->8---
> #define WIN32_LEAN_AND_MEAN
> #include <wctype.h>
> #include <windows.h>
> #include <shlobj.h>
> --8<---------------cut here---------------end--------------->8---
> 
> --8<---------------cut here---------------start------------->8---
> #define  WIN32_LEAN_AND_MEAN	/* Tell windows.h to skip much */
> #include <windows.h>
> #include <winioctl.h>
> --8<---------------cut here---------------end--------------->8---
> 
> What needs to be defined and/or included to get these?  From the
> MSDN documentation one would think that either string.h or wchar.h
> should do it, but is one of those preferrable?

Per POSIX it's wchar.h.  If you compile these modules using Cygwin GCC,
it will find the cygwin headers, of course.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2016-03-20 20:45 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <announce.20160318203409.GA11113@calimero.vinschen.de>
     [not found] ` <56EC6BDA.7050505@cornell.edu>
2016-03-18 21:45   ` Corinna Vinschen
2016-03-18 22:25     ` Ken Brown
2016-03-18 22:40       ` Ken Brown
2016-03-18 23:05       ` Yaakov Selkowitz
2016-03-18 23:29         ` Yaakov Selkowitz
2016-03-19  2:24           ` Ken Brown
2016-03-19 10:32             ` Corinna Vinschen
2016-03-19 12:34               ` Ken Brown
2016-03-19 18:03                 ` Ken Brown
2016-03-20 15:26                   ` Corinna Vinschen
2016-03-20 19:27                     ` Ken Brown
2016-03-20 19:40                       ` Ken Brown
2016-03-20 20:18                       ` Ken Brown
2016-03-20 20:47                       ` Yaakov Selkowitz
2016-03-21 14:13                         ` Ken Brown
2016-03-21 16:30                           ` Corinna Vinschen
2016-03-21 17:59                             ` Ken Brown
2016-03-22 11:15                               ` Corinna Vinschen
2016-03-22 14:59                                 ` Ken Brown
2016-03-30 21:17                                   ` Corinna Vinschen
2016-03-31 11:55                                     ` Ken Brown
2016-03-20  4:50               ` Yaakov Selkowitz
2016-03-20 15:18                 ` Corinna Vinschen
2016-03-20 10:59     ` Achim Gratz
2016-03-20 11:14       ` Marco Atzeri
2016-03-20 15:25       ` Corinna Vinschen
2016-03-20 19:27         ` Achim Gratz
2016-03-20 20:53           ` Corinna Vinschen [this message]
2016-03-20 21:30             ` Corinna Vinschen
2016-03-20 20:24         ` Achim Gratz
2016-03-20 20:45           ` Yaakov Selkowitz
2016-03-22  9:31             ` Achim Gratz
2016-03-25  9:00             ` Dodgy functions (was: [ANNOUNCEMENT] TEST RELEASE: Cygwin 2.5.0-0.8) Achim Gratz
2016-03-26  0:16               ` Dodgy functions Achim Gratz
2016-03-26 19:41                 ` Dodgy functions (finitel, strold) Achim Gratz
2016-03-29 16:09                   ` Doug Henderson
2016-03-29 16:09                     ` Corinna Vinschen
2016-04-01 19:04                     ` Achim Gratz
2016-03-22 17:43     ` [ANNOUNCEMENT] TEST RELEASE: Cygwin 2.5.0-0.8 Chris Sutcliffe
2016-03-22 18:02       ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160320204544.GB3422@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin-apps@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).