<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/72363>72363</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            【BOLT] exceptions catch lead to segv when binary compile with no-pie
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          zct
      </td>
    </tr>
</table>

<pre>
    clang++ version :16

bolt --version output:

>   LLVM version 16.0.0. DEBUG build with assertions. BOLT revision 08d094a0e457360ad8b94b017d2dc277e697ca76

 
reproduce demo

```
int Foo() { throw 42; }

int main() {
  try {
    return Foo();
  } catch (...) {
    return 0;
  }
}
```

when compile with -no-pie,after bolt optimization, it SIGSEGV when run the main.bolted. here is the build script:

>  clang++ main.cc -g -Wl,--emit-relocs -stdlib=libc++  -lc++abi -pthread -no-pie -o main
>  llvm-bolt  ./main -o main.bolted

Since programs compiled after llvm15 are compile with pie by default, here if I remove the no-pie option, the Bolt-optimized program will run without SEGV errors. 

I would like to know what caused the no-pie program SEGV. Thank you for your reply


</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxslN2OqzgMx58m3FigEL4vuBim7WikWe3FnD17HRK3ZCcQlIR2e55-xUen7epIFYHa_tv-2cCdU6cBsSZZQ7JdwCffGVv_Ej5ojbzWQvPhRFhDWANntE6ZAUjyEueE7gh9Wa-t0R7C8GY3kx8nT5KXRx-S7AHg4-PnH986cR7RiEaw2zd_vUE7KS3honwH3Dm0XpnBRdD8-fEDLJ7VEkJLSauUU0yzIskpl2VbpS2NC8mkYEWBeVUIXjxVB-thcbRGTgJBYm-eSsvp9lse1eDhYAxhJWEVkKIB31lzgZSRpAFS7B5jZ-eeq-HuvSUFb6-PjwAW_WSHuzRJvo2k2IHgXnRAWBlF0f-kvmPpc8xWyPfNcx_r9dLhAML0o9K40g0HE44Kyf5AmldSvvKjRwvLDM3oVa9-8Zk9Ya-gPHy-v33u337ComOnAXyHS8fRHIEygg4tgnKLYR2iE1aNv12Ax3VaRISA8ATh35qw1zDEXvnQojbCQei81KolyU6rVmwxEOrtlrcKwtF3Frm8tQShWYdxT6j1uQ-X3iAi7DBbb15bA481fqpBIIzWnCzv3Q2bhBXRrBVnwC0-A50zt1eQeOST9jO3FckR3sFib864sNlqnBmvdOc_G6N9uGFHeUsNF6X1QntOYCYPywzQWmNdBI8lv8PFTFqCVl8I3sDXYC5w6bgHwSeH8jH1TX0Wi-BHx4cvuJoJjsbOpwWLo74-qgeyTmSVVDzAOi4opUlV0izo6lxikWOGRYIxHnmcpAxpjlWBVRuXlAaqZpQlcRxntIrzlEXHMm2RZkfMS854KklKsedKRzPWyNhToJybsC5YkieB5i1qd_sq2Xqd43RyJKVaOe_uYV55jTXZJ6SkpKLzB4NkO8B_BS6o3fZq6XlTvAGHp_O6zq0auL0-D3NFFUxW1533o5u3mB0IO5yU76Y2EqYn7DAn345wtOYfFJ6ww9KAI-yw9PBfAAAA__8h0KGq">