-control_flow_integrity [Professional Edition only] [V2.08.00 or later] |
< Compile Options / Object Options >
Code for the detection of illegal indirect function calls is not generated.
When this option is specified, code for the following processing is generated in the C/C++ source program.
(1) The __control_flow_integrity checking function is called with an indirect calling address as an argument immediately before indirect function calls.
(2) Within the checking function, the address given as the argument is checked against a list of the addresses of functions (hereafter referred to as the function list) which may be indirectly called. If the list does not include the address, the __control_flow_chk_fail function will be called since this is regarded as an illegal indirect function call.
The correctness of processing to change the flow of the program, such as through indirect function calls, is referred to as control flow integrity (CFI), and CFI techniques are used to verify this.
void __control_flow_integrity(void *addr);
Calling the checking function in the same way as normal functions is prohibited.
The compiler automatically extracts the information on the functions which may be indirectly called from the C/C++ source program. The linker consolidates that information in creating the function list. For the linker to create a function list, the -cfi link option must be specified. |
For details, refer to section 2.5.3 Optimizing Linkage Editor (rlink) Options.
The __control_flow_chk_fail function contains code for the processing which is to be executed when an illegal indirect function call is detected. The user must define this function. |
Note the following when defining the __control_flow_chk_fail function.
The __control_flow_chk_fail function is not for the creation of code for detecting illegal indirect function calls. |
In the __control_flow_chk_fail function, note that execution must not be returned to the checking function, for example, by calling abort() to terminate the program. |
When -isa=rxv2 -output=src -control_flow_integrity is specified for compilation