PATCH: Updated version of x86_64-pc-mingw32 support of gcc.

Michael Matz
Mon Mar 19 16:57:00 GMT 2007


On Mon, 19 Mar 2007, Kai Tietz wrote:

> > explicitely restricted to a maximum of 2 GB.  So, the small code model 
> > is completely enough.
> That is true just for executables. But shared objects (DLL's) can be 
> placed far behind this boundary.

Like on Linux.

> Reasoned by the RVA relocation, which is 64-bit, it is necessary for 
> sure. As rev. see the msvcrt.dll, where it's base loading address is 
> placed.

Hmm, I've forgotten most about PE, so you might be right.  But as you have 
PC relative addressing the difference between %rip and any data from the 
same module is never larger than 2GB --> small model is enough.  If you 
can encode addresses of module X directly in .text of module Y, only then 
you need the large model.  You generally really really want to avoid using 
it, e.g. by indirecting over a pointer holding that 64bit address, but 
placed in .data (or GOT in ELF), and loading from it, instead of encoding 
that 64bit address directly into .text.


More information about the Gcc-patches mailing list