|
6 | 6 | //
|
7 | 7 | //===----------------------------------------------------------------------===//
|
8 | 8 |
|
9 |
| -#ifndef ELF_RISCV_NONSTANDARD_RELOC |
10 |
| -#error "ELF_RISCV_NONSTANDARD_RELOC must be defined" |
| 9 | +// This file defines information about RISC-V's nonstandard relocation codes. |
| 10 | +// This can be used when parsing relocations, or when printing them, to provide |
| 11 | +// better information. |
| 12 | +// |
| 13 | +// Unlike the mappings provided in RISCV.def via `ELF_RELOC`, these are not |
| 14 | +// expected to be 1:1 mappings - multiple vendors may reuse relocation IDs. |
| 15 | + |
| 16 | +// For ease of use, `ELF_RISCV_NONSTANDARD_RELOC_ALL` invokes the macros for |
| 17 | +// each vendor. |
| 18 | + |
| 19 | +#ifdef ELF_RISCV_NONSTANDARD_RELOC_ALL |
| 20 | +#define ELF_RISCV_NONSTANDARD_RELOC_QUALCOMM(NAME, ID) ELF_RISCV_NONSTANDARD_RELOC_ALL(NAME, ID) |
11 | 21 | #endif
|
12 | 22 |
|
13 |
| -// ELF_RISCV_NONSTANDARD_RELOC(VENDOR, NAME, ID) defines information about |
14 |
| -// nonstandard relocation codes. This can be used when parsing relocations, or |
15 |
| -// when printing them, to provide better information. |
16 |
| -// |
17 |
| -// VENDOR should be the symbol name expected in the associated `R_RISCV_VENDOR` |
18 |
| -// relocation. NAME and ID work like `ELF_RELOC` but the mapping is not expected |
19 |
| -// to be 1:1. |
20 |
| -// |
21 |
| -// The mapping in RISCV.def is 1:1, and should be used when the only information |
22 |
| -// available is the relocation enum value. |
| 23 | +// For each Vendor identifier, VENDOR, as associated with an `R_RISCV_VENDOR`, |
| 24 | +// the `ELF_RISCV_NONSTANDARD_RELOC_<VENDOR>(NAME, ID)` macro defines the |
| 25 | +// relocations available for that vendor identifier. |
23 | 26 |
|
24 |
| -// Qualcomm Nonstandard Relocations |
25 |
| -ELF_RISCV_NONSTANDARD_RELOC(QUALCOMM, R_RISCV_QC_ABS20_U, 192) |
26 |
| -ELF_RISCV_NONSTANDARD_RELOC(QUALCOMM, R_RISCV_QC_E_BRANCH, 193) |
27 |
| -ELF_RISCV_NONSTANDARD_RELOC(QUALCOMM, R_RISCV_QC_E_32, 194) |
28 |
| -ELF_RISCV_NONSTANDARD_RELOC(QUALCOMM, R_RISCV_QC_E_JUMP_PLT, 195) |
| 27 | +// QUALCOMM Nonstandard Relocations |
| 28 | +#ifndef ELF_RISCV_NONSTANDARD_RELOC_QUALCOMM |
| 29 | +#define ELF_RISCV_NONSTANDARD_RELOC_QUALCOMM(_NAME, _ID) |
| 30 | +#endif |
| 31 | + |
| 32 | +ELF_RISCV_NONSTANDARD_RELOC_QUALCOMM(R_RISCV_QC_ABS20_U, 192) |
| 33 | +ELF_RISCV_NONSTANDARD_RELOC_QUALCOMM(R_RISCV_QC_E_BRANCH, 193) |
| 34 | +ELF_RISCV_NONSTANDARD_RELOC_QUALCOMM(R_RISCV_QC_E_32, 194) |
| 35 | +ELF_RISCV_NONSTANDARD_RELOC_QUALCOMM(R_RISCV_QC_E_JUMP_PLT, 195) |
| 36 | + |
| 37 | +#ifdef ELF_RISCV_NONSTANDARD_RELOC_ALL |
| 38 | +#undef ELF_RISCV_NONSTANDARD_RELOC_QUALCOMM |
| 39 | +#endif |
0 commit comments