[lld] [ELF] Support relocatable files using CREL (PR #98115)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 1 09:19:22 PDT 2024


MaskRay wrote:

> Thanks for answering the questions.
> 
> I think we will need to support `SHT_REL` to `CREL` conversion for relocatable links and emit-relocs will likely not be supported with `CREL` on `SHT_REL` platforms. I'm thinking that almost all links will have some files from archives like `crt0.o` that will have `SHT_REL` relocations.
> 
> I also think we'll need to have some kind of way of either requiring input CREL relocations to have explicit addends (with diagnostic), or we support implicit addends.
> 
> I'm fine with these being limitations for an experimental CREL implementation though. We can fix these in further patches.
> 
> My last suggestion. Can we add an entry into the release notes about supporting CREL and either link or describe what the limitations are?
> 
> I'm happy to Approve after that.

Thanks! I intentionally omit the `lld/docs/ReleaseNotes.rst` change to avoid back-port complexity. The release note will be added separately. How about this wording?

```
Experimental CREL relocations with explicit addends are now supported using the
temporary section type code 0x40000020 (`clang -c -Wa,--crel,--allow-experimental-crel`).
LLVM will change the code and break compatibility. CREL with implicit addends
are not supported.
```

https://github.com/llvm/llvm-project/pull/98115


More information about the llvm-commits mailing list