<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - [MIPS] A call PIC function problem in shared link without '-fPIC'"
   href="http://llvm.org/bugs/show_bug.cgi?id=18620">18620</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[MIPS] A call PIC function problem in shared link without '-fPIC'
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.4
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>SGI
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>LLVM Codegen
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>r@hev.cc
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=11941" name="attach_11941" title="Assembly source codes without -fPIC">attachment 11941</a> <a href="attachment.cgi?id=11941&action=edit" title="Assembly source codes without -fPIC">[details]</a></span>
Assembly source codes without -fPIC

Simple test case:
#include <stdio.h>

int
main (int argc, char *argv[])
{
        printf ("Hello\n");
        return 0;
}

Compiled without -fPIC:
[heiher@archlinux work]$ clang -march=mips64r2 -mabi=n32 -o test test.c
/tmp/test-c0d709.s: Assembler messages:
/tmp/test-c0d709.s:30: Warning: macro instruction expanded into multiple
instructions
[heiher@archlinux work]$ ./test 
Segmentation fault (core dumped)

Compiled with -fPIC:
[heiher@archlinux work]$ clang -march=mips64r2 -mabi=n32 -fPIC -o test test.c
[heiher@archlinux work]$ ./test 
Hello

clang version:
clang version 3.4 (tags/RELEASE_34/final)
Target: mips64el-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation:
/usr/bin/../lib/gcc/mips64el-unknown-linux-gnu/4.8.2
Found candidate GCC installation: /usr/lib/gcc/mips64el-unknown-linux-gnu/4.8.2
Selected GCC installation: /usr/bin/../lib/gcc/mips64el-unknown-linux-gnu/4.8.2</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>