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

    <tr>
        <th>Summary</th>
        <td>
            [lld] LLVM successful link depends on static libraries order
        </td>
    </tr>

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

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

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

<pre>
    `CMake` 3.31.0 extend the deduplication of static libraries to new environments.

Unfortunately, the version `3.31.0` introduce an unwanted side-effect regarding `lld` usage which reveal a problem with `lld` in case of `ELF` binary format: if static libraries are deduplicated, the success or failure of the build of `LLVM` depends on the order of the static libraries. For other binary format (`COFF`, `Mach-O`) the link is successful regardless the order of static libraries.
Unfortunately, I was unable to reproduce this problem on a simple example.

The full history of this problem can be consulted on the [CMake-26447](https://gitlab.kitware.com/cmake/cmake/-/issues/26447) issue.

FYI, `CMake` version 3.31.1 will suppress this side effect, but users of `lld` will potentially be confronted to this bug if static libraries deduplication is active.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0VE2P4zYM_TXyhYhhy7GTHHyY3amBBWawPbQFeqQtOmZHkQx9JJt_X8jx7CSd7SVCZPI98vFR6D0fDVEr6i-ifs4whsm69hXdG_5uNWa9VddWNMXXV3wj0RRQ5VWZF0A_AhkFYSJQpOKsecDA1oAdwQcMPIDm3qFj8hAsGLoAmTM7a05kgs9F8SyKp9vvn2a0LkSDgfRVyK8L7JmcT4CiKW6ciZ1NcFbFgQANRHNBE0iBZ0UbGkcaAjg6olNsjilRa5WyoscjwWXiYQJHZ0INCLOzvaYTXDhMd7FsYEBPqQ_RFL-9dOmyZ4PuCqN1JwyiegL-RZfo7rUg9d6Ij8NA3oN1MCLr6Bbw9KWPrNXK9PLy12uiUjSTUR6sWUKsU-Te4_9LmUNnHdgwkXssEYTcp6F971L5qRDRFK84TJvvy__DAqfZvAH79wLHqFf1dCr3gf0T8_8M7htc0EM02GtKY3c0r_MKE_ufmlsDCJ5PsyagH5jOB0P8MRGMUWuY2AfrrjcB7gAGNNATDNb4qJMFVrlE_WVx6kY22-1O1M9C7qcQZi-qJyE7IbsjB419_sbhgo7ywZ6E7IZTcvfHuRGyY-8jeSG7G5Q8wHLzUGf397dV3J_78W7bxbMlXFhr8HGe3U3TJDcrgptbU3IfA0RPzq9GWH24JM42kAmMWl_XdkdnF8sHewPr4_GXZnxcSvaAQ-Az5ZlqK3WoDphRW-6q8lBXu0JmU9vs1Dg0QzXs97tdM45UbffjtqxLVY9VTTLjVhZyW5blvtyXdSHzWva0O9QVkSrKcd-LbUEnZJ1rfT7l1h2zRbC2LJumOWQae9J-eWikTE1KmV4c16bwTR-PXmwLzT74D4DAQS9vU4qvnyEtyb1dFwffbcwnGRYDZ9Hp9pMLptiv009067GZnf1nGczH_Nf6z638NwAA__9O6bgq">