Fix broken LTO mode and response file support (#1948)

This commit is contained in:
Sonic
2024-01-11 18:44:40 +08:00
committed by GitHub
parent f75778adfb
commit 4e9c6050d0

View File

@ -2059,7 +2059,6 @@ void add_lto_passes(aflcc_state_t *aflcc) {
#endif
insert_param(aflcc, "-Wl,--allow-multiple-definition");
insert_param(aflcc, aflcc->lto_flag);
}
@ -2295,10 +2294,6 @@ param_st parse_misc_params(aflcc_state_t *aflcc, u8 *cur_argv, u8 scan) {
SCAN_KEEP(aflcc->have_pic, 1);
} else if (cur_argv[0] != '-') {
SCAN_KEEP(aflcc->non_dash, 1);
} else if (!strcmp(cur_argv, "-m32") ||
!strcmp(cur_argv, "armv7a-linux-androideabi")) {
@ -2374,6 +2369,14 @@ param_st parse_misc_params(aflcc_state_t *aflcc, u8 *cur_argv, u8 scan) {
}
} else if (cur_argv[0] != '-') {
/* It's a weak, loose pattern, with very different purpose
than others. We handle it at last, cautiously and robustly. */
if (scan && cur_argv[0] != '@') // response file support
aflcc->non_dash = 1;
}
#undef SCAN_KEEP
@ -2912,11 +2915,17 @@ static void edit_params(aflcc_state_t *aflcc, u32 argc, char **argv,
// use. insert_param(aflcc, "-flegacy-pass-manager");
// #endif
if (aflcc->lto_mode && !aflcc->have_c) {
if (aflcc->lto_mode) {
insert_param(aflcc, aflcc->lto_flag);
if (!aflcc->have_c) {
add_lto_linker(aflcc);
add_lto_passes(aflcc);
}
} else {
if (aflcc->instrument_mode == INSTRUMENT_PCGUARD) {