RISC-V: Add linker options for Zicfilp and Zicfiss CFI properties
Introduces new linker options for RISC-V Control Flow Integrity (CFI) features.
Binutils now supports new linker options -z zicfilp= and -z zicfiss= for RISC-V Control Flow Integrity (CFI) features, aligning with lld’s functionality. These options control the inclusion and reporting of CFI-related properties in the output binary. The default behavior is ‘implicit,’ meaning the property is set only if all inputs have it. Options like ‘unlabeled’ and ‘always’ explicitly set the property, while ‘never’ clears it. Separate ‘report’ options control diagnostic messages.
In Details
This change integrates support for the RISC-V Zicfilp (Control-Flow Integrity Landing Pad) and Zicfiss (Control-Flow Integrity Signature) extensions into the binutils linker. The new -z options allow fine-grained control over how these CFI properties are propagated or suppressed in the final ELF executable. The implementation updates linker scripts and BFD backend code for RISC-V, mirroring lld's behavior and adhering to the RISC-V toolchain conventions.
- Zicfilp
- A RISC-V extension that enables compiler-generated landing pads in the Procedure Linkage Table (PLT) to facilitate Control-Flow Integrity (CFI) checks. It helps ensure that indirect calls and returns go to valid targets.
- Zicfiss
- A RISC-V extension related to Control-Flow Integrity, likely involving checks or signatures within function prologues or at call sites to prevent control-flow hijacking.
- CFI
- Control-Flow Integrity is a security technique that aims to prevent attackers from redirecting program execution to unintended locations, such as malicious code or unintended legitimate code paths.
- PLT
- Procedure Linkage Table. A table used in ELF executables to resolve calls to shared library functions dynamically at runtime. It acts as an intermediary between the calling code and the actual function in a shared library.
- ELF
- Executable and Linkable Format. A standard file format for executables, object code, shared libraries, and core dumps, used on many Unix-like systems.
- lld
- The LLVM linker, known for its speed and modern design. It is often used as an alternative to the GNU linker (ld).