<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:dimitry@andric.com" title="Dimitry Andric <dimitry@andric.com>"> <span class="fn">Dimitry Andric</span></a>
</span> changed
              <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - relocation truncated to fit: R_X86_64_PC32 against symbol `environ' defined in COMMON section in /usr/lib/crt1.o"
   href="http://llvm.org/bugs/show_bug.cgi?id=19764">bug 19764</a>
        <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>NEW
           </td>
           <td>RESOLVED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">CC</td>
           <td>
                
           </td>
           <td>dimitry@andric.com
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>---
           </td>
           <td>INVALID
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - relocation truncated to fit: R_X86_64_PC32 against symbol `environ' defined in COMMON section in /usr/lib/crt1.o"
   href="http://llvm.org/bugs/show_bug.cgi?id=19764#c1">Comment # 1</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - relocation truncated to fit: R_X86_64_PC32 against symbol `environ' defined in COMMON section in /usr/lib/crt1.o"
   href="http://llvm.org/bugs/show_bug.cgi?id=19764">bug 19764</a>
              from <span class="vcard"><a class="email" href="mailto:dimitry@andric.com" title="Dimitry Andric <dimitry@andric.com>"> <span class="fn">Dimitry Andric</span></a>
</span></b>
        <pre>I do not think this is a problem in clang: the error happens for me with gcc
4.2 (in the FreeBSD base system) and the gcc 4.7 and gcc 4.8 ports too.

The problem is that you are creating three arrays of 100 million doubles, which
together take up 2.4 billion bytes in the text segment.  This is too large for
the medium memory model, which only supports up to 2GiB in the text segment.

The reason the error disappears if you use -O1 or higher, is that clang
optimizes away two of the arrays.  At -O0, the assembly has:

        .type   a,@object               # @a
        .local  a
        .comm   a,800000000,16
        .type   b,@object               # @b
        .local  b
        .comm   b,800000000,16
        .type   c,@object               # @c
        .local  c
        .comm   c,800000000,16

At -O1, this becomes just:

        .type   a,@object               # @a
        .local  a
        .comm   a,800000000,16

and then the text segment does not become too big.  I tried gcc 4.2, 4.7 and
4.8 with -O1 through -O3, but no combination seems to be able to optimize away
the b and c arrays, and none of the resulting object files could be linked into
an executable.

If you cannot get the original program to link using -mcmodel=large, please
re-open this bug.  Otherwise, file a FreeBSD PR against the benchmarks/stream
port.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>