Clang is using the wrong memory model

Corinna Vinschen corinna-cygwin@cygwin.com
Mon Aug 19 08:58:00 GMT 2019


On Aug 18 18:24, Agner Fog wrote:
> On 18/08/2019 13.57, Corinna Vinschen wrote:
> > Nope, Cygwin uses the Windows loader.
> 
> Then, how do you do the extra linking? What is producing the "Cygwin runtime
> failure" message when loading/linking a DLL fails?
> 
> >   If the medium model is wasteful in clang, that's a clang
> > optimization problem, not a Cygwin problem.
> 
> The medium model in Clang is not wasteful.

Your words:

* The memory models work differently in gcc an Clang. Gcc with a medium or
large memory model is using 64-bit address tables to access a variable in a
different C/CPP file. Clang with a medium or large memory model is using
64-bit addresses not only for external variables, but also for local static
data. This includes floating point constants, string constants, array
initializers, jump tables, global variables, and more.

> designed to do. It was never designed with Cygwin in mind.

That's not Cygwin's fault, is it?  You're asking to change the system to
pamper the compiler, rather than asking the compiler to work better for
a given system.  That's not how this usually works.  

Make sure that clang uses the medium memory model by default.  If clang
is doing this inefficiently, clang needs fixing.


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20190819/86716c00/attachment.sig>


More information about the Cygwin mailing list