Joined: 19 Jul 2004
Location: Portland Group
|Posted: Wed Jul 28, 2004 8:58 am Post subject: RE: -mcmodel=medium and -Mlarge_arrays
|The -mcmodem=medium and -Mlarge_arrays compiler and linker options are supported under 64-bit linux environments (they are not supported under 32-bit linux environments).
The -mcmodel=medium option must be used to compile/link a program whose data and .bss sections exceed 2GB. In order for the program to use these large data sections, additional addressing instructions that support 64-bit offsets need to be generated. The effect this option has on performance is a function of the amount of data-use in the application. Therefore, this option should be used only when the aggregate data size exceeds 2GB.
The -Mlarge_arrays option tells the compiler that you have at least one single static data section (array) larger than 2GB. In this case, array accesses require 64-bit index arithmetic. This option must be used in conjunction with -mcmodel=medium.
A tell tale sign that you might need -mcmodel=medium occurs when you get warnings from the linker that mention "relocation truncated to fit".
There are other limitations to -mcmodel=medium (w.r.t. -fpic or position-independent code, shared libraries, etc.). Refer to the release notes (page 13) for more information: