<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - [X32] Wrong exception table generation"
   href="https://bugs.llvm.org/show_bug.cgi?id=50148">50148</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[X32] Wrong exception table generation
          </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>Backend: X86
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>harald@gigawatt.nl
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>harald@gigawatt.nl
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>craig.topper@gmail.com, llvm-bugs@lists.llvm.org, llvm-dev@redking.me.uk, pengfei.wang@intel.com, spatel+llvm@rotateright.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>$ clang++ --version
clang version 11.1.0
Target: x86_64-unknown-linux-gnux32
Thread model: posix
InstalledDir: /usr/bin

$ cat test.ii
class E {};
void f();
void g() throw(E) { f(); }

$ clang++ -mx32 -c -O2 test.ii

$ objdump -rj .gcc_except_table test.o

test.o:     file format elf32-x86-64

RELOCATION RECORDS FOR [.gcc_except_table]:
OFFSET   TYPE              VALUE 
00000010 R_X86_64_32       _ZTI1E



$ clang++ -mx32 -c -O2 -fPIC test.ii

$ objdump -rj .gcc_except_table test.o

test.o:     file format elf32-x86-64

RELOCATION RECORDS FOR [.gcc_except_table]:
OFFSET   TYPE              VALUE 
00000010 R_X86_64_PC64     .data


With -fPIC we suddenly have a 64-bit relocation. That's wrong and causes a
linker error later on.

The above is tested with LLVM 11 with various cherry-picked patches from LLVM
12, but this is still an issue on LLVM 12 and trunk as well. Reporting to make
sure I don't forget about it, assigning to myself.</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>