Skip to content

Commit 31ba3a1

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 5ffe5b5 commit 31ba3a1

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
@@ -1085,13 +1085,16 @@ The defined processor-specific section types are listed in <<rv-section-type>>.
10851085

10861086
| .riscv.attributes | SHT_RISCV_ATTRIBUTES | none
10871087
| .riscv.jvt | SHT_PROGBITS | SHF_ALLOC + SHF_EXECINSTR
1088+
| .note.gnu.property | SHT_NOTE | SHF_ALLOC
10881089
|===
10891090

10901091
+++.riscv.attributes+++ names a section that contains RISC-V ELF attributes.
10911092

10921093
+++.riscv.jvt+++ is a linker-created section to store table jump
10931094
target addresses. The minimum alignment of this section is 64 bytes.
10941095

1096+
+++.note.gnu.property+++ names a section that contains a program property note.
1097+
10951098
=== Program Header Table
10961099

10971100
The defined processor-specific segment types are listed in <<rv-seg-type>>.
@@ -1355,6 +1358,43 @@ value. After the merge, the resulting value will be the non-zero one.
13551358

13561359
--
13571360

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

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

0 commit comments

Comments
 (0)