public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: Agner Fog <agner@agner.org>
Cc: cygwin@cygwin.com
Subject: Re: Clang is using the wrong memory model
Date: Sun, 18 Aug 2019 11:58:00 -0000	[thread overview]
Message-ID: <20190818115739.GD11632@calimero.vinschen.de> (raw)
In-Reply-To: <17081147-f46a-51bf-65e9-3df7748b1780@agner.org>

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

On Aug 18 08:04, Agner Fog wrote:
> Thanks a lot for your help in clarifying this.
> 
> 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.
> 
> All this confusion is due to a terrible lack of documentation of everything.
> 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 undocumented.
> 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:
> 
> * Cygwin is using its own loader which is different from the Windows loader.

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

-- 
Corinna Vinschen
Cygwin Maintainer

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

  reply	other threads:[~2019-08-18 11:57 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1436640898.268382790.1565602671940.JavaMail.root@zimbra54-e10.priv.proxad.net>
2019-08-12  9:45 ` Inefficient use of 64-bit addresses in Clang falk.tannhauser
2019-08-14  5:51   ` Agner Fog
2019-08-16  6:06     ` Clang is using the wrong memory model Agner Fog
2019-08-16  8:25       ` Mark Geisert
2019-08-16  8:26       ` Corinna Vinschen
2019-08-16  9:27         ` Agner Fog
2019-08-16  9:52           ` Agner Fog
2019-08-16 10:39           ` Corinna Vinschen
2019-08-16 10:50             ` Agner Fog
2019-08-16 11:25               ` Corinna Vinschen
2019-08-16 13:28                 ` Kai Tietz
2019-08-17  6:59                 ` Agner Fog
2019-08-17  9:48                   ` Corinna Vinschen
2019-08-18 11:37                     ` Agner Fog
2019-08-18 11:58                       ` Corinna Vinschen [this message]
2019-08-18 18:14                         ` Agner Fog
2019-08-19  8:58                           ` 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=20190818115739.GD11632@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=agner@agner.org \
    --cc=cygwin@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).