title: From which version of gcc does -mcmodel=large work?
body: <p>I have code which produces executables larger than 2GB (it's generated code).</p>
  
  <p>On x64 with gcc 4.3.2 I get errors like:</p>
  
  <pre><code>crtstuff.c:(.text+0x20): relocation truncated to fit: 
    R_X86_64_32S against `.dtors'
  </code></pre>
  
  <p>So I understand i need the <code>-mcmodel=large</code> option. However that doesn't do anything or solve the problem on my system.</p>
  
  <p>I am <em>sure</em> I read somewhere, that it was only supported from a particular version of gcc, and the option was <strong>ignored on versions before that</strong>. I would tell my operations team to install that version of gcc if only I knew what it was. But I just can't find any evidence right now to tell me if that hypothesis is true, and if so in which version the feature was introduced.</p>
  
  <p>For example</p>
  
  <p>(1) <a href="http://books.google.at/books?id=wQ6r3UTivJgC&amp;pg=PA409&amp;lpg=PA409&amp;dq=mcmodel%20large%20gcc%20introduced%20in%20version&amp;source=bl&amp;ots=EKWjOlcAKx&amp;sig=qc7-omZoAv9_sJAndoypJyU_P5I&amp;hl=de&amp;sa=X&amp;ei=ahziT9HvOdHmtQaRkKlw&amp;ved=0CGgQ6AEwBQ#v=onepage&amp;q=mcmodel%20large%20gcc%20introduced%20in%20version&amp;f=false" rel="nofollow">Here</a> it is stated that the option doesn't do anything. The book in question claims to cover "GCC 4.x". The book came out 2006.</p>
  
  <p>(2) <a href="http://www.mentby.com/Group/gcc-help/mcmodellarge-problem.html" rel="nofollow">Here</a> a compiler bug is being reported against the option, therefore I conclude in that version it must do at least something. That seems to be gcc 4.6.1.</p>
  
  <p>So although I can no longer find evidence of exactly in which version the feature was implemented, at least there is evidence that this has changed over time.</p>
  
  <p>I have tried looking through the changelogs for all the various GCC 4.x versions to no avail (and normally they are pretty good so the lack of information there almost implies that I am wrong and nothing has changed between versions.)</p>
  
  <p><strong>Edit:</strong> <a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46125#c1" rel="nofollow">This</a> seems to imply that perhaps it did work, but I need to "recompile crtstuff.c", but I don't really know where I find that file or how I do that.</p>