[clang] [llvm] [MC,llvm-readobj,yaml2obj] Support CREL relocation format (PR #91280)

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Wed May 8 12:02:43 PDT 2024


MaskRay wrote:

```
  // TODO: Experimental CREL relocations. LLVM will change the value and
  // break compatibility in the future.
  SHT_CREL = 0x40000014,
```

Switched to 0x40000014 (generic range) to retain linker errors while making the
experimental status stand out. Add a comment to make the intention clearer.

The `[SHT_LOOS, SHT_HIOS]` range with a `SHF_OS_NONCONFORMING` flag would
change llvm-readelf output differences when we change the section type code.

Avoiding code churn, I'll keep the current `SHT` name.
A helper function like `isCrelType` is not ideal due to existing code using direct comparisons or switch statements.

Clang changes have been removed. I will use `clang -c -Wl,--crel,--allow-experimental-crel` in a dependent patch.

The labels (e.g. `clang llvm:binary-utilities mc objectyaml`) shall notify subscribed folks.

llvm:binary-utilities objectyaml are primarily reviewed by @jh7370 and me.
Almost all functionality changes to llvm/lib/MC/ELFObjectWriter.cpp in the past 5 years are from me.
I'll manually tag some folks on the discourse thread to give this a signal boost.


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


More information about the cfe-commits mailing list