| Issue |
165672
|
| Summary |
[LLD] Sorting in RelocationBaseSection::computeRels() breaks R_RISCV_VENDOR
|
| Labels |
lld
|
| Assignees |
|
| Reporter |
resistor
|
RISCV vendor-specific relocations are implemented be placing an `R_RISCV_VENDOR` relocation (which points to a vendor-specific symbol) before each `R_RISCV_CUSTOM[192-155]` relocations. This prepending order needs to be preserved in the dynamic relocations in order for them to be correctly parsed.
Today, we sort dynamic relocations in this code: https://github.com/llvm/llvm-project/blob/98ceb458f42ed05e2c3e9fb5bc75cd6b1df7a438/lld/ELF/SyntheticSections.cpp#L1722
based on the tuple of (tuple, offset). This is incompatible with `R_RISCV_VENDOR`, since the `R_RISCV_VENDOR` will point to a difference symbol than the following custom relocation.
I can see a few possible solutions, and would like to get input:
- Should we sort only by offset on RISCV?
- Should we sort only be offset if we know vendor-specific relocations are present?
- Should we try to be clever and treat the pair of relocations as a unit for the purposes of sorting?
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs