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

    <tr>
        <th>Summary</th>
        <td>
            lld behaves differently from ld.bfd when adding `.interp`
        </td>
    </tr>

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

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

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

<pre>
    `lld` adds the `.interp` section whenever `--dynamic-linker` is set. whereas `ld.bfd` won't add `.interp` unless the resulting binary has a `NEEDED` shared library.

in other words,

```console
ld a.o --dynamic-linker /asdf -o a
```

won't generate an `.interp` section, but

```console
ld a.o a.so --dynamic-linker /asdf -o a
```

will.

OTOH 

```console
ld.lld a.o --dynamic-linker /asdf -o a
```

adds an `.interp`, unlike `ld.bfd`.

This is related to nixos/nixpkgs#242244, which breaks clang+lld kernel build on nixos.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykU8tu2zAQ_BrqsrAgUy_noEMSx-ipueQHluJaZE2TBpeK478vKLdobPQQIIAgAuTs7OxgB5nt5IkG0T6JdlvgnEyIw4XNbAsV9GUQXeWcFl0FqDVDMgSiq0rrE8VTvmYakw0ezoY8vVPMz6uVvng82nHlrD9QzDjLwJTKjIuEnGFOl2q_cJ-DF7JPuccd_ewd8bVvJJ5dsn4CZT3GCxhkwIz_-fKyfdkuagxG0uCsihgvpai2onq8_q2HkAxFOIeoWcjnz4-iq67fGDwHR9dbpwHLAPfjgJA7ZL2HVQC8q_9M-neqiTxFTATo_2-ekM-g5vRlQVjyN1RZ526MeX17_QFf6V26bxqyrNC9CXn42Tt7oJuduJH4ZiznDYrkMJGGFMDbj8BC7rz9OB0mFrKWjZRNk-nOxo4GVCQ8MIwO_STkUxZ_oOjJgZqt0xD8laQs9FDrh_oBCxrWfdVuqo3sm8IMPUqFD03TVb1GXaPa9D2RXnfrsd2rDRZ2kJVsqrVcV3Xdt025V7Ueu7Ydu67u27YWTUVHtK507v1YhjgVlnmmod9s-rpwqMjxEj4pc8ykzCmMQ0av1DyxaCpnOfG_-mSToyEPo8jgOzFou99TJJ_cBfYxHOHq4ZLInKicmBvHizm6waR0YlE_CrkTcjfZZGZVjuEo5C73-nOsTjH8ojEJuVuEZ8cX7b8DAAD__51vRzg">