2929 * [Note Sections](#note-sections)
3030 * [Dynamic Table](#dynamic-table)
3131 * [Hash Table](#hash-table)
32+ * [Attributes](#Attributes)
32335 . [ DWARF] ( #dwarf )
3334 * [Dwarf Register Numbers](#dwarf-register-numbers)
34356 . [ Linux-specific ABI] ( #linux-abi )
@@ -980,9 +981,34 @@ typedef struct
980981} tls_index;
981982```
982983
984+ ## <a name =sections ></a >Sections
985+ ### Section Types
986+
987+ The defined processor-specific section types are listed in following table.
988+ Name | Value | Attributes
989+ :-------------------- | :---------- | :-------------
990+ SHT_RISCV_ATTRIBUTES | 0x70000003 | none
991+
992+ ### Special Sections
993+
994+ The following table lists the special sections defined by this ABI.
995+
996+ Name | Type | Attributes
997+ :------------------------- | :------------------- | :-------------
998+ .riscv.attributes | SHT_RISCV_ATTRIBUTES | none
999+
1000+ .riscv.attributes names a section that contains RISC-V ELF attributes.
1001+
9831002## <a name =program-header-table ></a >Program Header Table
9841003
985- There are no RISC-V specific definitions relating to program header tables.
1004+ The defined processor-specific segment types are listed in following
1005+ table.
1006+
1007+ Name | Value | Meaning
1008+ :------------------- | :---------- | :-------------
1009+ PT_RISCV_ATTRIBUTES | 0x70000003 | RISC-V ELF attribute section.
1010+
1011+ ` PT_RISCV_ATTRIBUTES ` describes the location of RISC-V ELF attribute section.
9861012
9871013## <a name =note-sections ></a >Note Sections
9881014
@@ -996,6 +1022,70 @@ There are no RISC-V specific definitions relating to dynamic tables.
9961022
9971023There are no RISC-V specific definitions relating to ELF hash tables.
9981024
1025+ ## <a name =Attributes ></a >Attributes
1026+
1027+ Attributes are used to record information about an object file/binary that a
1028+ linker or runtime loader needs to check compatibility.
1029+
1030+ Attributes are encoded in a vendor-specific section of type SHT_RISCV_ATTRIBUTES
1031+ and name .riscv.attributes. The value of an attribute can hold an integer
1032+ encoded in the uleb128 format or a null-terminated byte string (NTBS).
1033+
1034+ RISC-V attributes have a string value if the tag number is odd and an integer
1035+ value if the tag number is even.
1036+
1037+ ### List of attributes
1038+ Tag | Value | Parameter type | Description
1039+ :---------------------------------- | :------- | :------------- | :---------------------
1040+ Tag_RISCV_stack_align | 4 | uleb128 | Indicates the stack alignment requirement in bytes.
1041+ Tag_RISCV_arch | 5 | NTBS | Indicates the target architecture of this object.
1042+ Tag_RISCV_unaligned_access | 6 | uleb128 | Indicates whether to impose unaligned memory accesses in code generation.
1043+ Tag_RISCV_priv_spec | 8 | uleb128 | Indicates the major version of the privileged specification.
1044+ Tag_RISCV_priv_spec_minor | 10 | uleb128 | Indicates the minor version of the privileged specification.
1045+ Tag_RISCV_priv_spec_revision | 12 | uleb128 | Indicates the revision version of the privileged specification.
1046+ Reserved for non-standard attribute | >= 32768 | - | -
1047+
1048+ ### Detailed attribute description
1049+
1050+ #### How does this specification describe public attributes?
1051+
1052+ Each attribute is described in the following structure:
1053+ ``` <Tag name>, <Value>, <Parameter type 1>=<Parameter name 1>[, <Parameter type 2>=<Parameter name 2>] ```
1054+
1055+ #### Tag_RISCV_stack_align, 4, uleb128=value
1056+ Tag_RISCV_strict_align records the N-byte stack alignment for this object. The
1057+ default value is 16 for RV32I or RV64I, and 4 for RV32E.
1058+
1059+ It will report erros if link object files with different Tag_RISCV_stack_align values.
1060+
1061+ #### Tag_RISCV_arch, 5, NTBS=subarch
1062+ Tag_RISCV_arch contains a string for the target architecture taken from
1063+ the option ` -march ` . Different architectures will be integrated into a superset
1064+ when object files are merged.
1065+
1066+ Note that the version information for target architecture must be presented
1067+ explicitly in the attribute and abbreviations must be expanded. The version
1068+ information, if not given by ` -march ` , must agree with the default
1069+ specified by the tool. For example, the architecture ` RV32I ` has to be recorded
1070+ in the attribute as ` RV32I2P0 ` in which ` 2P0 ` stands for the default version of
1071+ its based ISA. On the other hand, the architecture ` RV32G ` has to be presented
1072+ as ` RV32I2P0_M2P0_A2P0_F2P0_D2P0 ` in which the abbreviation ` G ` is expanded
1073+ to the IMAFD combination with default versions of the standard extensions.
1074+
1075+ #### Tag_RISCV_unaligned_access, 6, uleb128=value
1076+ Tag_RISCV_unaligned_access denotes the code generation policy for this object
1077+ file. Its values are defined as follows:
1078+ - 0: This object does not perform any unaligned memory accesses.
1079+ - 1: This object may perform unaligned memory accesses.
1080+
1081+ #### Tag_RISCV_priv_spec, 8, uleb128=version
1082+ #### Tag_RISCV_priv_spec_minor, 10, uleb128=version
1083+ #### Tag_RISCV_priv_spec_revision, 12, uleb128=version
1084+
1085+ Tag_RISCV_priv_spec contains the major/minor/revision version information of
1086+ the privileged specification. It will report errors if object files of different
1087+ privileged specification versions are merged.
1088+
9991089# <a name =dwarf ></a >DWARF
10001090
10011091Dwarf Register Numbers <a name =dwarf-register-numbers >
0 commit comments