mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-19 04:58:08 +00:00
add CFI variant for gcc
This commit is contained in:
24
src/afl-cc.c
24
src/afl-cc.c
@ -1050,18 +1050,26 @@ static void edit_params(u32 argc, char **argv, char **envp) {
|
||||
|
||||
if (getenv("AFL_USE_CFISAN")) {
|
||||
|
||||
if (!lto_mode) {
|
||||
if (compiler_mode == GCC_PLUGIN || compiler_mode == GCC) {
|
||||
|
||||
uint32_t i = 0, found = 0;
|
||||
while (envp[i] != NULL && !found)
|
||||
if (strncmp("-flto", envp[i++], 5) == 0) found = 1;
|
||||
if (!found) cc_params[cc_par_cnt++] = "-flto";
|
||||
cc_params[cc_par_cnt++] = "-fcf-protection";
|
||||
|
||||
} else {
|
||||
|
||||
if (!lto_mode) {
|
||||
|
||||
uint32_t i = 0, found = 0;
|
||||
while (envp[i] != NULL && !found)
|
||||
if (strncmp("-flto", envp[i++], 5) == 0) found = 1;
|
||||
if (!found) cc_params[cc_par_cnt++] = "-flto";
|
||||
|
||||
}
|
||||
|
||||
cc_params[cc_par_cnt++] = "-fsanitize=cfi";
|
||||
cc_params[cc_par_cnt++] = "-fvisibility=hidden";
|
||||
|
||||
}
|
||||
|
||||
cc_params[cc_par_cnt++] = "-fsanitize=cfi";
|
||||
cc_params[cc_par_cnt++] = "-fvisibility=hidden";
|
||||
|
||||
}
|
||||
|
||||
if (!getenv("AFL_DONT_OPTIMIZE")) {
|
||||
|
Reference in New Issue
Block a user