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

    <tr>
        <th>Summary</th>
        <td>
            LSAN does not work together with --icf=safe on Ubuntu
        </td>
    </tr>

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

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

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

<pre>
    ```sh
LDFLAGS="-fsanitize=leak -fuse-ld=lld -Xlinker --icf=safe"
clang++ -o ...
ld.lld: warning: /usr/lib/llvm-18/lib/clang/18/lib/linux/libclang_rt.lsan-x86_64.a(interception_linux.cpp.o):
 --icf=safe conservatively ignores SHT_LLVM_ADDRSIG [index 10] with sh_link=0 (likely created using objcopy or ld -r)
```
It's not objcopy/ld -r, Ubuntu strips the library:
https://launchpadlibrarian.net/724504654/buildlog_ubuntu-noble-amd64.llvm-toolchain-18_1%3A18.1.3-1_BUILDING.txt.gz
```
strip --strip-debug --remove-section=.comment --remove-section=.note --enable-deterministic-archives -R .gnu.lto_\* -R .gnu.debuglto_\* -N __gnu_lto_slim -N __gnu_lto_v1 debian/libclang-rt-18-dev/usr/lib/llvm-18/lib/clang/18/lib/linux/libclang_rt.lsan-x86_64.a
```
That destroys the sh_link.
Question is if this is a bug. llvm-strip seems to do the same thing.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VN9vozgQ_mvMy8gWGAjkgYdkUXqVcpVu2z3dGzIwAW-MHdkmbfavPxmyvVbq60lRzIw9n7_58Vk4JweNWJF8T_I6ErMfja1erHAutVFr-ltFNvH6cyOJaxLvjvXhuHt4JmlNOKcnJ7T08heStFYozkBPs0Oq-mCrHug_SuozWqBUdieS1k6ckHC-YnVK6IHwPeF7oAYYY6tf9UwFiB28CqulHsIn4YfZWcIPSrbhX10nmpTv9h3r8MGlpJ7fVmvZbaxny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