diff options
author | vanhauser-thc <vh@thc.org> | 2023-01-23 12:45:21 +0100 |
---|---|---|
committer | vanhauser-thc <vh@thc.org> | 2023-01-23 12:45:21 +0100 |
commit | 8bc7b3cf26c2e94ee99fa854c9f7007092bc9949 (patch) | |
tree | dcd70774207b5c39ad79861b1943b1f9e008511b /src | |
parent | 5163a49350ed17149cb3c52bc79bd87e86402510 (diff) | |
download | afl++-8bc7b3cf26c2e94ee99fa854c9f7007092bc9949.tar.gz |
add CFI variant for gcc
Diffstat (limited to 'src')
-rw-r--r-- | src/afl-cc.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/afl-cc.c b/src/afl-cc.c index 803e784e..cbf57047 100644 --- a/src/afl-cc.c +++ b/src/afl-cc.c @@ -1050,17 +1050,25 @@ 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"; + + } } |