From 2f5006c170ad15e0440a10fbd5c8c6e6b33dc3fd Mon Sep 17 00:00:00 2001 From: Vineet Gupta Date: Mon, 9 Jan 2023 12:57:01 -0800 Subject: [PATCH] Add details of .riscv.attributes section layout Signed-off-by: Vineet Gupta --- riscv-elf.adoc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/riscv-elf.adoc b/riscv-elf.adoc index 8c452e97..a2864ca8 100644 --- a/riscv-elf.adoc +++ b/riscv-elf.adoc @@ -1016,10 +1016,26 @@ linker or runtime loader needs to check compatibility. Attributes are encoded in a vendor-specific section of type SHT_RISCV_ATTRIBUTES and name .riscv.attributes. The value of an attribute can hold an integer encoded in the uleb128 format or a null-terminated byte string (NTBS). +The tag number is also encoded as uleb128. RISC-V attributes have a string value if the tag number is odd and an integer value if the tag number is even. +==== Layout of .riscv.attributes section + +The attributes section start with a format-version (uint8 = 'A') followed by +vendor specific sub-section(s). A sub-section starts with sub-section length +(uint32), vendor name (NTBS) and one or more sub-sub-section(s). + +A sub-sub-section consists of a tag (uleb128), sub-sub-section length (uint32) +followed by actual attribute tag,value pair(s) as specified above. +Sub-sub-section Tag Tag_file (value 1) specifies that contained attibutes +relate to whole file. + +A sub-section with name "riscv\0" is mandatory. Vendor specific sub-sections +are allowed in future. Vendor names starting with "[Aa]non" are reserved for +non-standard ABI extensions. + ==== List of attributes .RISC-V attributes