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

    <tr>
        <th>Summary</th>
        <td>
            lld/ELF: Report errors for certain unknown section types
        </td>
    </tr>

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

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

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

<pre>
    From https://maskray.me/blog/2024-03-09-a-compact-relocation-format-for-elf#linker-notes

GNU ld allows certain unknown section types:

* `[SHT_LOUSER,SHT_HIUSER]` and non-`SHF_ALLOC`
* `[SHT_LOOS,SHT_HIOS]` and non-`SHF_OS_NONCONFORMING`

but reports errors and stops linking for others (unless `--no-warn-mismatch` is specified).
When linking a relocatable file using `SHT_RELLEB`, you might encounter errors like the following:

```
% clang -mrelleb -fuse-ld=bfd a.c b.c
/usr/bin/ld.bfd: unknown architecture of input file `/tmp/a-1e0778.o' is incompatible with i386:x86-64 output
/usr/bin/ld.bfd: unknown architecture of input file `/tmp/b-9963f0.o' is incompatible with i386:x86-64 output
/usr/bin/ld.bfd: error in /tmp/a-1e0778.o(.eh_frame); no .eh_frame_hdr table will be created
/usr/bin/ld.bfd: error in /tmp/b-9963f0.o(.eh_frame); no .eh_frame_hdr table will be created
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```

I have a prototype for a new relocation format (RELLEB). Linking a.o and b.o with unpatched lld and gold create an output file with unrelocated `.text` and will crash at run-time.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVV1v6jgQ_TXmZeQocSAJD3mgH7mtxC1SuVf7iBx7Qrx17Mh2SvvvVw7Q3l1VK632SsjBkJk5Mz7nmHuvjgaxJqsbsrpb8Cn01tXfuX955u-L1sr3unF2gD6E0ZN8Q1hDWDNw_-L4ezIgYU2r7ZGwhqVsSdOcpmvKqbDDyEWgDrUV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