From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31058 invoked by alias); 18 Aug 2019 11:57:57 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 31039 invoked by uid 89); 18 Aug 2019 11:57:56 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-101.9 required=5.0 tests=BAYES_00,GOOD_FROM_CORINNA_CYGWIN,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=nope, ack, H*F:D*cygwin.com X-HELO: mout.kundenserver.de Received: from mout.kundenserver.de (HELO mout.kundenserver.de) (217.72.192.75) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 18 Aug 2019 11:57:55 +0000 Received: from calimero.vinschen.de ([24.134.7.25]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1Mgf4k-1iT7mq2R5A-00h3Zp; Sun, 18 Aug 2019 13:57:40 +0200 Received: by calimero.vinschen.de (Postfix, from userid 500) id 983E7A80773; Sun, 18 Aug 2019 13:57:39 +0200 (CEST) Date: Sun, 18 Aug 2019 11:58:00 -0000 From: Corinna Vinschen To: Agner Fog Cc: cygwin@cygwin.com Subject: Re: Clang is using the wrong memory model Message-ID: <20190818115739.GD11632@calimero.vinschen.de> Reply-To: cygwin@cygwin.com Mail-Followup-To: Agner Fog , cygwin@cygwin.com References: <024ce5b5-6024-b371-e382-5eef5d1d4a90@agner.org> <075477ca-e031-39ea-3dfe-bc8bc2fc8fa6@agner.org> <20190816082603.GR11632@calimero.vinschen.de> <8d594f4d-17e0-447a-8b18-1ed620815e0f@agner.org> <20190816095200.GU11632@calimero.vinschen.de> <2024f551-66e6-47c5-a0b6-2dfa735a690d@agner.org> <20190816111133.GV11632@calimero.vinschen.de> <6008d30a-cd6c-5449-2933-a041e804856c@agner.org> <20190817081605.GX11632@calimero.vinschen.de> <17081147-f46a-51bf-65e9-3df7748b1780@agner.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="8rwPx/46nQniO+If" Content-Disposition: inline In-Reply-To: <17081147-f46a-51bf-65e9-3df7748b1780@agner.org> User-Agent: Mutt/1.11.3 (2019-02-01) X-SW-Source: 2019-08/txt/msg00258.txt.bz2 --8rwPx/46nQniO+If Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 1908 On Aug 18 08:04, Agner Fog wrote: > Thanks a lot for your help in clarifying this. >=20 > When I complained here about the wasteful 64-bit addresses you said that = it > was an LLVM issue. I never said anything like that. The issue is that your clang linux->cygwin cross compiler uses the wrong model, that's all. That's a bug in clang or whatever it's using under the hood. Clang should follow what GCC does for years, using the medium model on Cygwin. > When I complained to LLVM they said it was a Cygwin > issue, and that you were using the wrong memory model. >=20 > All this confusion is due to a terrible lack of documentation of everythi= ng. > I had to do a lot of reverse engineering to figure out what is happening. > What I have found out so far is listed below. Much of this is undocumente= d. > Obviously, I would like to know if any or this is wrong or if specific > documentation is available other than the SysV ABI and Windows ABI: >=20 > * Cygwin is using its own loader which is different from the Windows load= er. Nope, Cygwin uses the Windows loader. > * The Cygwin loader emulates the behavior of Linux shared objects. This > includes the ability to directly access a variable inside a DLL See above. > * Access to a variable in a different DLL requires a 64-bit address. This= is > obtained by using the medium memory model with a gcc or Clang compiler. ACK [...] To me, the only interesting thing is that clang continues to use the medium memory model *by default*. It doesn't make sense if package maintainers and devs building something on Cygwin have to care for memory models all of a sudden. The default should just work. If you want to use the small model in your own projects, great, if it works for you. If the medium model is wasteful in clang, that's a clang optimization problem, not a Cygwin problem. Corinna --=20 Corinna Vinschen Cygwin Maintainer --8rwPx/46nQniO+If Content-Type: application/pgp-signature; name="signature.asc" Content-length: 833 -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAl1ZPTMACgkQ9TYGna5E T6D08BAAi4Ku6fh5JO71bC0SPInBqOzlfStLX0pj1mMcAYwm+z/DDOBYp8J0nCRB umM7wFhYGc2qKZAMvCvB8b3u2pbxQqlZg2Wxd/rvJlDTuhnVWglrU4Rb4+8aN25M z+W7M928x0vjDJpyeSOUr7A1KLyzMKvHQ1keJ4jts+LETOWPAI/gJK0mGsezWtGz 8NZgrR5U3siJ0C02QF69pMeGwn53n7bMHcjtTzKJ2vVvNroe2qcB1T1RxL8R9GBE 5/HcwqQ31ZpcJwhbLPbKj7yjOE62FwTlv+CsidnlvD4Ej8Tj192sPYxEWKNfaKt8 yIT31Ubc6hJCA5BLAgDMi+ep3b2L3wjmouiSRt83RObY8sJMGupVL6UFN6u6uJV0 22gpUJdDyVb6OvtnSkeUgzyg7M9Cq+HDKORHIVy1hhiD0DRyqgA3zKam2b2K2e/+ U8mSb8l9VO6oxfHpRACe3Qyw9369OiUO2d5GKDUCZc+FuLeQC6ygBcw3No7Xyw1E WvlsJzK5hv4GszyBtrXWtj6rzwte+pZMoCRN+GDQzCm+ZaWXrivE534Hdbm+1dBt YbYWpI5+bKYmWqomvD+j/F3WeMecpABXGoLwD3LIoQm8ezFyJ6qrVi98MDFmEl4S VLX9LkB3TN6KntiIuKYz/LglfQeOzLoXss6rS9jswN0zljylCns= =B9Ns -----END PGP SIGNATURE----- --8rwPx/46nQniO+If--