<html>
    <head>
      <base href="https://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 --- - Exception handling doesn't work when linked using binutils gold 2.21.1"
   href="https://llvm.org/bugs/show_bug.cgi?id=26915">26915</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Exception handling doesn't work when linked using binutils gold 2.21.1
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </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>MC
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>sugak@fb.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>`try-catch` block in a code build with clang, and linked using gold (binutils
2.21.1), doesn't catches exceptions: 
Tested on 3.8 LLVM, and trunk:
LLVM git c1b22faefa9f470405e4d3bf3150eb694a0c439a
Clang git 612eea8a21b02346124f671b4fafd8bf064218ab

```
$ cat a.cpp
int main() {
  try {
    throw 42;
  } catch (...) {
  }
  return 0;
}

$ clang++ -B<path to binutils 2.21.1>/bin/gold -L<path to glibc 2.20>/lib a.cpp
$ ./a.out
terminate called after throwing an instance of 'int'
[Exit 134 (ABRT)]
```

Bisected to the following change in LLVM: git
20db4731726eded30dd7bcd6702a7e7498bf7b29 (corresponding Clang git
db7ff082d2dbfb035d6ef21a107727ae61bf1e46)

A quick search suggests that there was a bug in gold:
<a href="https://sourceware.org/ml/binutils/2011-06/msg00376.html">https://sourceware.org/ml/binutils/2011-06/msg00376.html</a>

Not sure if this should be fixed in LLVM, but worth mentioning somewhere in
documentation.</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>