Re: Clang is using the wrong memory model

2019-08-19 Thread Corinna Vinschen
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

Re: Clang is using the wrong memory model

2019-08-18 Thread Agner Fog
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,

Re: Clang is using the wrong memory model

2019-08-18 Thread Corinna Vinschen
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,

Re: Clang is using the wrong memory model

2019-08-17 Thread Agner Fog
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. 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

Re: Clang is using the wrong memory model

2019-08-17 Thread Corinna Vinschen
Oe Aug 17 07:31, Agner Fog wrote: > > 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. > __ctype_ptr__ is a function > > h_errno works like errno with an imported function > > FE_DFL_E

Re: Clang is using the wrong memory model

2019-08-16 Thread Agner Fog
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. __ctype_ptr__ is a function h_errno works like errno with an imported function FE_DFL_ENV is a macro __progname and optarg are local variabl

Re: Clang is using the wrong memory model

2019-08-16 Thread Kai Tietz
Hey, Just my 5 cents to this. As Corinna pointed out, is the case, that a "small" memory model application works for you, no valid prove that all application will work on such a model. Another thing, which cygwin depends heavily on is the pseudo-relocation stuff. It is not guaranteed that code

Re: Clang is using the wrong memory model

2019-08-16 Thread Corinna Vinschen
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

Re: Clang is using the wrong memory model

2019-08-16 Thread Agner Fog
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 functio

Re: Clang is using the wrong memory model

2019-08-16 Thread Corinna Vinschen
On Aug 16 11:27, Agner Fog wrote: > Thanks for your replies. > > A Cygwin application with -mcmodel=small appears to work fine. > > As I explained, -mcmodel=small does something else when the target is > Windows. It does not require addresses to be below 2GB, it only requires the > distance betwe

Re: Clang is using the wrong memory model

2019-08-16 Thread Agner Fog
Thanks for your replies. A Cygwin application with -mcmodel=small appears to work fine. As I explained, -mcmodel=small does something else when the target is Windows. It does not require addresses to be below 2GB, it only requires the distance between a code section and it's data section to be

Re: Clang is using the wrong memory model

2019-08-16 Thread Corinna Vinschen
On Aug 16 08:06, Agner Fog wrote: > Cygwin Clang is using -mcmodel=medium as default for Win64, according to my > tests, while the right model is -mcmodel=small -mcmodel=small is *only* the right model if the target is native Windows. If the target is a Cygwin application it *must* at least be co

Re: Clang is using the wrong memory model

2019-08-16 Thread Mark Geisert
Hi, please don't start a new Subject: by replying on another thread. It fouls up mail threading for folks trying to follow multiple threads. Just start a new thread with your new Subject:. Thanks. Agner Fog wrote: Cygwin Clang is using -mcmodel=medium as default for Win64, according to my t

Clang is using the wrong memory model

2019-08-15 Thread Agner Fog
Cygwin Clang is using -mcmodel=medium as default for Win64, according to my tests, while the right model is -mcmodel=small Linux Clang with --target=x86_64-pc-cygwin gives the small memory model. I took this to the LLVM Bugzilla as you asked me to: https://bugs.llvm.org/show_bug.cgi?id=42983