@@ -1531,6 +1531,7 @@ provided by the Zicfilp extension in the unlabeled scheme: Executables and
15311531shared libraries with this bit set are required to generate PLTs in the
15321532unlabeled landing pad PLT style, and all of the labels of lpad instructions are
15331533set to 0, i.e. unlabeled.
1534+ See <<Tool Requirements for Generating Landing Pad Instruction>> for more details.
15341535
15351536`GNU_PROPERTY_RISCV_FEATURE_1_CFI_SS`: This bit indicates that all executable
15361537sections are built to be compatible with the shadow stack mechanism provided by
@@ -1540,6 +1541,39 @@ or the `Zimop` extension. When the executable or shared library is compiled with
15401541compressed instructions then loading it with this bit set requires the execution
15411542environment to provide the `Zicfiss` extension or the `Zcmop` extensions.
15421543
1544+ === Tool Requirements for Generating Landing Pad Instructions
1545+
1546+ For an executable or shared library to set the GNU property
1547+ `GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_UNLABELED`, every indirect branch targeting
1548+ a location guarded by landing pads must point to a landing pad (`lpad`)
1549+ instruction with a compatible label value. Indirect branches may originate from:
1550+
1551+ * Relocatable object producers, such as a compiler or assembler.
1552+
1553+ * Static linkers when generating PLT entries.
1554+
1555+ * Other executables and shared libraries via calls through PLT entries or
1556+ function pointers.
1557+
1558+ It is desirable to minimize the number of landing pad instructions to limit the
1559+ number of indirect branch destinations within the program. The following tool
1560+ requirements determine which tool is responsible for inserting landing pad
1561+ instructions, allowing tools to omit landing pad instructions if it can be
1562+ proven that there are no indirect branches targeting the location.
1563+
1564+ A relocatable object producer is required to insert a landing pad instruction at
1565+ the target of an indirect branch originating from within the same relocatable
1566+ object.
1567+
1568+ A relocatable object producer must insert a landing pad instruction at any
1569+ location whose address escapes the relocatable object. This includes all symbols
1570+ that can be exported into the dynamic symbol table by a static linker.
1571+
1572+ A static linker is required to generate PLT entries with appropriate landing pad
1573+ instructions. During linker relaxation, a static linker may remove unnecessary
1574+ landing pad instructions if it can prove that there are no indirect branches
1575+ targeting the corresponding location.
1576+
15431577=== Mapping Symbol
15441578
15451579The section can have a mixture of code and data or code with different ISAs.
0 commit comments