Skip to content

Commit 2f5006c

Browse files
author
Vineet Gupta
committed
Add details of .riscv.attributes section layout
Signed-off-by: Vineet Gupta <[email protected]>
1 parent 9a77e88 commit 2f5006c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

riscv-elf.adoc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,10 +1016,26 @@ linker or runtime loader needs to check compatibility.
10161016
Attributes are encoded in a vendor-specific section of type SHT_RISCV_ATTRIBUTES
10171017
and name .riscv.attributes. The value of an attribute can hold an integer
10181018
encoded in the uleb128 format or a null-terminated byte string (NTBS).
1019+
The tag number is also encoded as uleb128.
10191020

10201021
RISC-V attributes have a string value if the tag number is odd and an integer
10211022
value if the tag number is even.
10221023

1024+
==== Layout of .riscv.attributes section
1025+
1026+
The attributes section start with a format-version (uint8 = 'A') followed by
1027+
vendor specific sub-section(s). A sub-section starts with sub-section length
1028+
(uint32), vendor name (NTBS) and one or more sub-sub-section(s).
1029+
1030+
A sub-sub-section consists of a tag (uleb128), sub-sub-section length (uint32)
1031+
followed by actual attribute tag,value pair(s) as specified above.
1032+
Sub-sub-section Tag Tag_file (value 1) specifies that contained attibutes
1033+
relate to whole file.
1034+
1035+
A sub-section with name "riscv\0" is mandatory. Vendor specific sub-sections
1036+
are allowed in future. Vendor names starting with "[Aa]non" are reserved for
1037+
non-standard ABI extensions.
1038+
10231039
==== List of attributes
10241040

10251041
.RISC-V attributes

0 commit comments

Comments
 (0)