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

    <tr>
        <th>Summary</th>
        <td>
            [LLD] Undefined references with linking with `-lunwind-ptrace` and `-unwind-generic`
        </td>
    </tr>

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

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

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

<pre>
    `lld` reports undefined references, while `ld` is able to link this without issue:

main.c:
```c
int main() {}
```

`clang main.c -lunwind-ptrace -lunwind-generic` produces no error.

`clang main.c -lunwind-ptrace -lundwind-genric -fuse-ld=lld` produces:

```
ld.lld: error: /lib/x86_64-linux-gnu/libunwind-ptrace.so: undefined reference to lzma_stream_buffer_decode [--no-allow-shlib-undefined]
ld.lld: error: /lib/x86_64-linux-gnu/libunwind-ptrace.so: undefined reference to lzma_index_uncompressed_size [--no-allow-shlib-undefined]
ld.lld: error: /lib/x86_64-linux-gnu/libunwind-ptrace.so: undefined reference to lzma_index_end [--no-allow-shlib-undefined]
ld.lld: error: /lib/x86_64-linux-gnu/libunwind-ptrace.so: undefined reference to lzma_index_buffer_decode [--no-allow-shlib-undefined]
ld.lld: error: /lib/x86_64-linux-gnu/libunwind-ptrace.so: undefined reference to lzma_stream_footer_decode [--no-allow-shlib-undefined]
ld.lld: error: /lib/x86_64-linux-gnu/libunwind-ptrace.so: undefined reference to lzma_index_size [--no-allow-shlib-undefined]
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```

`clang --version`:
```                                                 
Ubuntu clang version 15.0.0-++20220321012320+9aa52ba574ad-1~exp1~20220321012418.363
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
```

`ld.lld --version`:
```
Ubuntu LLD 15.0.0 (compatible with GNU linkers)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzNVk2P2yAQ_TXOBWFhsBP74MNu062qrnrqniNsJgktgQjwJt1f38FOup9qu5cqEcKBGT8e8yYz6Zz62WZzZozCmXjYOx8DGayCtbagcGcNHmwPIeMfyGGrDZDkP7rrQGSHG9ERo-0PEre4c9Bx64aIxjBAJq4ytszYad5JbfP-cXPOptFPa20jSS4ZrzPekGxxnS2WL1yfwqU3jbQbMuESagZ70FbRffSyh8f1Bix43SfOe-_UgNch1hHw3vn8vYjqDImIhK6HABTDIZanGJ4PeHH1FxcwKk_-4moikb5k_MboDudjPV_NS4ohHY50Y4fJ8IxIHlx65Q2dRjEednIVoge5W3XDGi0rBb1TKF11Tal1VBrjDjRsEZf-Bsmq5f8ih85wXA22d7u9hxBArYJ-uDR-YNWFMbpMNU-ptnYuXh65KXDvyK6xADxjlIobeILJupOYEmuJVVCNhY7AUUcy3rdA4jUWA0Lv09kBgGh773oZtcOK1vxLHaP0HnxI_ujwqkqS936m9-8wZHEg0wknfFJUOcsZzfg1Ds44Z4IXrOCCM9xopKx4J6tFKRUtssVHOO7T44ljWdS5mIvpiG_SbyCmUJ002_dPZJtctpgjiuwwVCY57l3Qx8n02YaIkoBa6nMCDMHj3GEr-GPUpuz5S9ieReH2dnm6e5IrlR_UJ_WwUc1PX-9OYofXis1UK1QjGjmLOhpoMZsQDdOG3L3RLifABKYx7OMCMV70kyRqyqhkedWqZoM37TbG_dhK-A2ODcIMXY6002_B3J8fFJvOd-gjLse2i-xvqnLB2GzbioI1nNdVX0smihoWa7GAohCiKURfQTkzsgMT0nUyzi0cTp2bc7zaTLej5iUriorPRZ13QtXzqixZUzbQMZ6VDLBZmjzxyJ3fzHw7UuqGTUCj0SGGR6MMQW8sjNFL-HLAfwu-_bIDiYGajUe3I_VfDnuzCw">