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

    <tr>
        <th>Summary</th>
        <td>
            Prevent R_X86_64_REX_GOTPCRELX relocations for kernel modules referencing __stack_chk_guard
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    Building FreeBSD kernel modules with a standard LLVM 17.0.6 toolchain and `-fstack-protector` results in them containing R_X86_64_REX_GOTPCRELX relocations (for `__stack_chk_guard`). These are unloadable, because this relocation type isn't handled by the FreeBSD kernel loader.

This was addressed internally within FreeBSD already via https://github.com/freebsd/freebsd-src/commit/9a4d48a645a7a.

There has been discussion about upstreaming this into LLVM in [D113443](https://reviews.llvm.org/D113443). It appears there was a consensus to submit once a comment was added. I'm filing this issue so we can get that patch submitted in some appropriate form.

cc @DimitryAndric @adalava 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMk09v20YQxT_N8jKwQC4p_jnwYEdREcBFA9cofBOGuyNx4-WusDOUoG9fkE7ixgWKXkiCfx7f-808ZHanQNSr7YPa7jKcZYyp_zazuGDQ3rIh2lv_MDtvXTjBPhE9_LmDV0qBPEzRzp4Yrk5GQGDBYDFZeHz863comk2-qUFi9GZEFwCDBVXnd0cWNK935xSFjMSk6hwS8eyFwQWQkSYwMQi6sPzz6fDS1oe6Ojx9fjn89sfz109Pnx9fIJGPBsXFwKB0e4xpET8cVvGDGV8PpxmTVXWudLeB55GYABPBHHxEi4MnpT_BQAZnJpDR8T80QW5nAsdB6UZgxGA9WRhui7uPFBY5ShuV71R-_3Z8XtSuyIDWJmImCy4IpYDe31ZcLvyUQZ8I7Q0uDmEUObMq75XeK70_ORnnYWPipPT-mIgGtu9Xd5yM0nsTp8mJ0vsOK1u1WFdbbPCDHUoEIzIMRAGsYzMzLzFxiLPAfGZJhNOCewXhgsS3KboAavuwK4qyqkq13Snd_uox0cXRlTfeX6ZNTCel9z_eXrh_EcDzmTDxgi7RG5VlvkyBZwaJwPMwOYEYDK2PpomC_MBHdgNflG4mODr_bpB5JuAIVwKDAU4kICMKnFHM-F1RVuzAcaLFRIrn5FAIjjFNv_AxBlSV79zkJN3ug01uvYEWPV4QMtuXtis7zKgvmqLIt2XZttnYV21RNx02qI0tO3tsGltgR3Vnyq7Rhclcr3Nd5aUudF7WutlUxdA2W2OL1jSo26OqcprQ-Z_4sjVZ39ZFt808DuR5LafWga5vsZXWS1dTv3xzN8wnVlXuHcv7EDJx4qn_muiyoPwfFVr686HViY6UKJgF-r96lc3J9_-xrYuT76el6d_ILCu6-mel92u-vwMAAP__8yyARg">