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

    <tr>
        <th>Summary</th>
        <td>
            Several SPARC lld issues in compiler-rt tests
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            lld,
            lld:ELF
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
            MaskRay,
            vitalybuka
      </td>
    </tr>

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

<pre>
    When running an LLVM build on Debian/sparc64, several `compiler-rt` tests `FAIL` with linker errors.  Although the primary linker is `ld.bfd` 2.42.50.20240625, some tests are specificially run with `ld.lld`.  Admittedly this is currenty `lld` 16.0.6, AFAICS most if not all of the issues remain:
```
ld.lld: error: unknown emulation: elf32_sparc
```
```
ld.lld: error: /lib/sparc64-linux-gnu/Scrt1.o:(function _start: .text+0x1c): unknown relocation (82) against symbol main
ld.lld: error: /lib/sparc64-linux-gnu/Scrt1.o:(function _start: .text+0x20): unknown relocation (83) against symbol main
ld.lld: error: /lib/sparc64-linux-gnu/Scrt1.o:(function _start: .text+0x24): unknown relocation (84) against symbol main
```
which is
```
#define R_SPARC_GOTDATA_OP_HIX22        82
#define R_SPARC_GOTDATA_OP_LOX10        83
#define R_SPARC_GOTDATA_OP      84
```
```
ld.lld: error: /tmp/lit-tmp-gq6t5qs1/coverage-linkage-35e2a3.o:(__llvm_prf_data+0x10): unknown relocation (46) against symbol 
```
which is
```
#define R_SPARC_DISP64          46      /* PC relative 64 bit */
```
```
ld.lld: error: relocation R_SPARC_64 cannot be used against local symbol; recompile with -fPIC
```
I'm still looking how to properly disable use of `-fuse-lld` on this target; maybe it should be done in `compiler-rt` for now.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEVU1v4zYQ_TX0ZWCBomTFPuigOFVrIIsEyaLdm0FJI4k1RWrJkRP_-4Ky3Q2KIFssWixggDY1mvf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