Skip to content

Commit 3c1fc34

Browse files
authored
Merge pull request #357 from vineetgarc/topic-elf-attr
Add details of .riscv.attributes section layout
2 parents 0c7e6d8 + 2f5006c commit 3c1fc34

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
@@ -1018,10 +1018,26 @@ linker or runtime loader needs to check compatibility.
10181018
Attributes are encoded in a vendor-specific section of type SHT_RISCV_ATTRIBUTES
10191019
and name .riscv.attributes. The value of an attribute can hold an integer
10201020
encoded in the uleb128 format or a null-terminated byte string (NTBS).
1021+
The tag number is also encoded as uleb128.
10211022

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

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

10271043
.RISC-V attributes

0 commit comments

Comments
 (0)