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

    <tr>
        <th>Summary</th>
        <td>
            clang uses incorrect library order
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            backend:Hexagon,
            clang:driver
      </td>
    </tr>

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

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

<pre>
    When linking programs with `eld`, we get a link error like below:

```
Error: /inst/clang+llvm-19.1.0-cross-hexagon-unknown-linux-musl/x86_64-linux-gnu/bin/../target/hexagon-unknown-linux-musl//usr/lib/libc.a(scalbn.lo)(.text.scalbn+0x3c): undefined reference to `__hexagon_muldf3'
```

libc has references to the clang_rt builtins library, so the order of the libraries should be reversed.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8ksuOozoQhp-m2FhBuEggLFik-xw0bzDLyJcCPDF2y5ck_fYjID0tzWKkEsh1Vf31iRjN5Ih6OL0BonA6-KXWAhDh9F8hcpp96P-4C-n1Z_9zJsescTfjJvYR_BTEEtnDpJlBU5HV0FSA7-xBbKLExJbLKAQfmDU3YpKsf0B9gWqzpnpZdfl_TYL6wgAH42ICHJQVbgJ8s_a-HHhX8rI6qOBjPMz0FJN3h-xuzj_cwRqXn4clRws4PM_NtTm-fJPLgIM0DnAoS8AhiTDR2v2fPQCHHAPgYI3cv6oUgOeohJWutB6wAzyXiZ6p3J2Ab9WzVmugvrDsNI3GkWaBRgrkFLHkV5Wu19fk65KtHmvA9i8poLqsA9ks4nd1XMvTTGxT5RoSk9nYZFxk1sggwucqfNxzfNAUmB-3xx42FFmcfbaaSWKB7hQi6bLQfa27uhMF9bytsW05b3kx91x16tTi2JzPpHVNhKdx7EhrJYQcpSxMjxUeOcdzdeJdzUs-NqI9a5KiE83x2MKxokUYW673K32YChNjpp7ztmvawgpJNr7wk0LdyGmoLz92cVYM8R0Qdwjqiw7mTuFFZ-g3JmSeIhwra2KK31OSSZb6rY7lSJEZp3wIpNKXUrs-RQ62n1P6iCuQ280nk-YsS-WX9ej2_vU7fAT_i9SKzbZDBBxea9x7_B0AAP__Qb8TAw">