<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 --- - llvm-ld produces .bc file that does not terminate on execution"
   href="http://llvm.org/bugs/show_bug.cgi?id=17112">17112</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>llvm-ld produces .bc file that does not terminate on execution
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>tools
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.1
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </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-ld
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>manishps824@gmail.com
          </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=11148" name="attach_11148" title="Folder contaning all files.">attachment 11148</a> <a href="attachment.cgi?id=11148&action=edit" title="Folder contaning all files.">[details]</a></span>
Folder contaning all files.

I have 3 files say file 1,2,3. File 1 is main test file. File 2, file 3 contain
some definitions of helper functions. File 1 is instrumented with calls to the
helper functions in other two files using a pass i have written. I use two
procedures to execute the code.

1)Instrument the file 1 to get a .bc file. Use clang to get .bc files of file 2
and file 3. Use llc to get the corresponding .s files. Finally link them using
gcc to get executable. This executable that i get performs as expected.

2)Instrument the file 1 to get a .bc file. Use clang to get .bc files of file 2
and file 3. Use llvm-ld to link these .bc files to get final .bc file. But when
i use lli to execute this bytecode the program gets stuck in some infinite
loop.

Strange part is addition of few print statements file 3 and reapplication of
process 2 , produces a fully working bytecode.

I provide the all .bc and .s files . The code involves spawning a new thread.

Use following command to recreate.

1)
llvm-ld lib.bc tryAndcrashNoSwitchReplicated.bc handleFunctionPointers.bc -o
final

./final

2)
gcc lib.s handleFunctionPointers.s tryAndcrashNoSwitchReplicated.s -lpthread

./a.out</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>