Skip to content

Commit 9ee857d

Browse files
committed
Add program property
We introduce .note.gnu.property section to store infomations that linker or runtime system may use, and we define 4 program property classes to specifying the merge semantics, it's used for forward compatibility in linker implementations, allowing linker can correctly handle program property types even if they are not recognized. We don't define any program property within this PR, it would be separate PR like #417
1 parent 6072b0d commit 9ee857d

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

riscv-elf.adoc

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,13 +1077,16 @@ The defined processor-specific section types are listed in <<rv-section-type>>.
10771077

10781078
| .riscv.attributes | SHT_RISCV_ATTRIBUTES | none
10791079
| .riscv.jvt | SHT_PROGBITS | SHF_ALLOC + SHF_EXECINSTR
1080+
| .note.gnu.property | SHT_NOTE | SHF_ALLOC
10801081
|===
10811082

10821083
+++.riscv.attributes+++ names a section that contains RISC-V ELF attributes.
10831084

10841085
+++.riscv.jvt+++ is a linker-created section to store table jump
10851086
target addresses. The minimum alignment of this section is 64 bytes.
10861087

1088+
+++.note.gnu.property+++ names a section that contains a program property note.
1089+
10871090
=== Program Header Table
10881091

10891092
The defined processor-specific segment types are listed in <<rv-seg-type>>.
@@ -1350,6 +1353,43 @@ value. After the merge, the resulting value will be the non-zero one.
13501353

13511354
--
13521355

1356+
=== Program Property
1357+
1358+
Program property are used to record information about an object file/binary that
1359+
a linker or runtime loader needs to check compatibility.
1360+
1361+
The program property is divided into different classes, each defining a range
1362+
of program property types and specifying the merge semantics. This is designed
1363+
for forward compatibility in linker implementations, allowing them to correctly
1364+
handle program property types even if they are not recognized.
1365+
1366+
[[rv-prog-prop-classes]]
1367+
.RISC-V-specific program property classes
1368+
[cols="3,2,2,5"]
1369+
[width=100%]
1370+
|===
1371+
| Name | Range | Data Type | Merge Semantic
1372+
1373+
| UINT32_AND | 0xc0000000 ~ 0xc0007fff | 4-bytes | A bit is set if it is set in all inputs.
1374+
| UINT32_OR | 0xc0008000 ~ 0xc000ffff | 4-bytes | A bit is set if it is set in any inputs.
1375+
| UINT32_OR_AND | 0xc0010000 ~ 0xc0017fff | 4-bytes | A bit is set if it is set in any inputs and the property is present in all inputs.
1376+
|===
1377+
1378+
[[rv-prog-prop-class-constants]]
1379+
.Constants for RISC-V-specific program property class
1380+
[cols="3,2"]
1381+
[width=80%]
1382+
|===
1383+
| Name | Value
1384+
1385+
| GNU_PROPERTY_RISCV_UINT32_AND_LO | 0xc0000000
1386+
| GNU_PROPERTY_RISCV_UINT32_AND_HI | 0xc0007fff
1387+
| GNU_PROPERTY_RISCV_UINT32_OR_LO | 0xc0008000
1388+
| GNU_PROPERTY_RISCV_UINT32_OR_HI | 0xc000ffff
1389+
| GNU_PROPERTY_RISCV_UINT32_OR_AND_LO | 0xc0010000
1390+
| GNU_PROPERTY_RISCV_UINT32_OR_AND_HI | 0xc0017fff
1391+
|===
1392+
13531393
=== Mapping Symbol
13541394

13551395
The section can have a mixture of code and data or code with different ISAs.

0 commit comments

Comments
 (0)