This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Clang is using the wrong memory model

On Aug 16 12:38, Agner Fog wrote:
> On 16/08/2019 11.52, Corinna Vinschen wrote:
> > 2 GB. Think errno accessed from another DLL. Your application works only
> > by chance.
> Good example.
> errno appears to be a global variable for historical reasons, but errno is
> implemented as a macro that translates to a call to the imported function
> __errno.
> This function call goes through a 64-bit import table from cygwin1.dll
> Works fine with -mcmodel=small
> Static sharing of a global variable between exe and dll, or between
> different dll's is not possible.

So errno was a bad example but you can try accessing e.g. __ctype_ptr__,
__progname, optarg, h_errno, or use FE_DFL_ENV from another DLL, just
for kicks.

Just because lots of stuff works with the small mode doesn't mean it's
the right thing to do.  Mcmodels medium and large have been introduced
into GCC during the Cygwin 64 bit port for a reason.


Corinna Vinschen
Cygwin Maintainer

Attachment: signature.asc
Description: PGP signature

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]