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

    <tr>
        <th>Summary</th>
        <td>
            `LLVMgold.so`'s symbol `onLoad` erroneously contain version on Linux
        </td>
    </tr>

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

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

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

<pre>
    I found that `LLVMgold.so` has a version after its symbol `onload`:

```console
readelf -sW /usr/lib/llvm-18/lib/LLVMgold.so | grep onload
   198: 0000000000005ee0 9266 FUNC    GLOBAL DEFAULT   12 onload@@LLVM_18.1
```

The `LLVMgold.so` is a plugin for other linkers which `dlsym` the `onload` symbol. With version attached, other linker cannot load the plugin for LTO.

For example, if using mold:
https://github.com/rui314/mold/blob/bf05198d53818563079d634b8ca0f752fd7c52f5/elf/lto-unix.cc#L456

I found there's a export file when version script is used:
https://github.com/llvm/llvm-project/blob/b9ad0b6875950a0e161ad31447f796562f55a83a/llvm/tools/gold/gold.exports#L1
But looks like it is not used. Maybe it's some cmake issue?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVEuP5CYQ_jX0pTQWxgbbBx_mEUeRvNnLbPYYYVO22cHQAjwz_e8j3D3Tncch22ohgaivvkcZGYKeLWJL-APhTwe5xcX59rT90HZc0M60PgxOndrfYHKbVRAXGYEI2vd_fJmdUVlwRFBYZAAJr-iDdhbkFNGDjgHCaR2cSQXOGicVEZQU94Q-EfqxCnr-j84GZ_B86lEqNBPche9AWLcFT1hn9JBW87re5fXn_oYJkOoRZo9HuHTbsQAgb2pS3AO9-XFECg0TArpvvz8CAPzaf3247-Hpl-7-W_-cqtgHTklJuUv-M6-z_B_Eb9U8L_gf7uhkztFss7YwOQ8uLujBaPuCPsDbosclVSkTTmu6H88on5ZdbMzgu47L1eUY5bigIuzxb4gwSmtdhFS8Q9107p-_Zrd8O-cB3-V6NJhg9ARb0HaG1Rn1GdQS4zGkHesI62Ydl23IRrcS1vlNF3lJWLcXsG4wLmUyTJTnTa14Uec1FwWtGiWKcqhHSaeKs0lVI2cTJ6xDM6Uoo7vbrH7PxpGwoi-5uGV5HT70SFiV7MT3o_MRJm0Q3ha0n7aE0etjTJ5vAf-XiDRRH4N19O4HjvFGSiMVHURd8YZTSTEXuVRFXpbVVDWCCzZxLutCXnGicyakHmdL9jk4sw1J22V8HraUkHsJYPQLgt4Zp9gS6wy-yNOQTne1wa0I4yrTvRA2JEV3UG2hmqKRB2zzKq_rKhesOiwtSlGKospFw3g9DHxiPFd8YKKkqmJ5ddAto6ykglFaM8qqbKgLiRJRVnVTInJSUlylNlnSkzk_H_ambSPysj4YOaAJ-3vBmMW3CyPG0vPh293EYZsDKanRIYYrStTRYPuvr-Os8Oad6C9Dj947i24L5gSjs1Hqa8jOQq_t9n7YvGl_OtqdcoroLOm1ZX8FAAD__zTNjYs">