Skip to content

Commit fc68140

Browse files
committed
New attribute: Tag_RISCV_reserved_register
- Motivation: Tag_RISCV_reserved_register used for record reserved register information, desiged for resolve checking compatibility between ABI subvariants like overlay ABI. - Meaning: This attribute is a bit-vector of reserved register, but it can also representation as a register list, syntax below: ``` RESERVED_REGS := '{' REG_LIST '}' REG_LIST := REG_LIST ',' REG_LIST | REG_RANGE | REG REG_RANGE := REG '-' REG REG := <register-name> | <abi-register-name> # e.g. x10, t3, f10 or fa2 ``` For example: `x6`, `x7`, `x8` and `f10` are reserved, then the value of Tag_RISCV_reserved_register is `0x400000001c1`, and it also could be represent as `{x6, x7, x8, f10}` or `{x6-x8, f10}`. - Merge Rule: It will report errors if link object files with different Tag_RISCV_reserved_register values, but allowed link with object with and without Tag_RISCV_reserved_register value, the final value will take from the object which has set Tag_RISCV_reserved_register.
1 parent 9001839 commit fc68140

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

riscv-elf.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,6 +1043,7 @@ Tag_RISCV_unaligned_access | 6 | uleb128 | Indicates whet
10431043
Tag_RISCV_priv_spec | 8 | uleb128 | Indicates the major version of the privileged specification.
10441044
Tag_RISCV_priv_spec_minor | 10 | uleb128 | Indicates the minor version of the privileged specification.
10451045
Tag_RISCV_priv_spec_revision | 12 | uleb128 | Indicates the revision version of the privileged specification.
1046+
Tag_RISCV_reserved_register | 14 | uleb128 | Indicates the extra reserved register information.
10461047
Reserved for non-standard attribute | >= 32768 | - | -
10471048

10481049
### Detailed attribute description
@@ -1086,6 +1087,43 @@ Tag_RISCV_priv_spec contains the major/minor/revision version information of
10861087
the privileged specification. It will report errors if object files of different
10871088
privileged specification versions are merged.
10881089

1090+
#### Tag_RISCV_reserved_register, 14, uleb128=register bit-vector
1091+
1092+
Tag_RISCV_reserved_register contains the information about the reserved
1093+
registers which are not reserved by ABI, it might reserved by specific
1094+
compiler option like `-ffixed-x4` or special purpose ABI variant like
1095+
overlay ABI.
1096+
1097+
Format of Tag_RISCV_reserved_register is a bit-vector, each bit corresponding to
1098+
a register, the bit order is same as dwarf register number.
1099+
1100+
First bit is must set, used to distinguish between attribute is unset or having
1101+
empty reserved register set.
1102+
1103+
Tag_RISCV_reserved_register also support register list style representation for
1104+
easier write and understand, the syntax rule is:
1105+
1106+
```
1107+
RESERVED_REGS := '{' REG_LIST '}'
1108+
1109+
REG_LIST := REG_LIST ',' REG_LIST
1110+
| REG_RANGE
1111+
| REG
1112+
1113+
REG_RANGE := REG '-' REG
1114+
1115+
REG := <register-name> | <abi-register-name> # e.g. x10, t3, f10 or fa2
1116+
```
1117+
1118+
For example, x6, x7, x8 and f10 are reserved, then the value of
1119+
Tag_RISCV_reserved_register is 0x400000001c1, and it also could be represent as
1120+
`{x6, x7, x8, f10}` or `{x6-x8, f10}`.
1121+
1122+
It will report errors if link object files with different
1123+
Tag_RISCV_reserved_register values, but allowed link with object with and
1124+
without Tag_RISCV_reserved_register value, the final value will take from the
1125+
object which has set Tag_RISCV_reserved_register.
1126+
10891127
# <a name=dwarf></a>DWARF
10901128

10911129
Dwarf Register Numbers <a name=dwarf-register-numbers>

0 commit comments

Comments
 (0)