From 9f480abd89decd94de74fc6fbeb5b199bebd9145 Mon Sep 17 00:00:00 2001 From: Kito Cheng Date: Mon, 30 Jan 2023 16:32:59 +0800 Subject: [PATCH] Define mandatory/optional attribute tag It's mandatory when (tag number % 128) < 64 and optional when (tag number % 128) >= 64. Fix #352 --- riscv-elf.adoc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/riscv-elf.adoc b/riscv-elf.adoc index 427489b4..223114e4 100644 --- a/riscv-elf.adoc +++ b/riscv-elf.adoc @@ -1020,8 +1020,16 @@ 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. +In order to improve the compatibility of the tool, the attribute follows below rules: + +- RISC-V attributes have a string value if the tag number is odd and an integer + value if the tag number is even. + +- The tag is mandatory; If the tool does not recognize this attribute and the tag number + modulo 128 is less than 64 (`(N % 128) < 64`), errors should be reported. + +- The tag is optional; If the tool does not recognize this attribute and the tag number + modulo 128 is greater than or equal to 64 (`(N % 128) >= 64`), the tag can be ignored. ==== Layout of .riscv.attributes section