shared linking fix

This commit is contained in:
vanhauser-thc
2021-03-17 12:44:07 +01:00
parent cdd30c766b
commit 513bd70384
2 changed files with 43 additions and 2 deletions

View File

@ -5,6 +5,22 @@
"__afl_auto_init"; "__afl_auto_init";
"__afl_area_initial"; "__afl_area_initial";
"__afl_prev_loc"; "__afl_prev_loc";
"__afl_prev_caller";
"__afl_prev_ctx";
"__afl_final_loc";
"__afl_map_addr";
"__afl_dictionary";
"__afl_dictionary_len";
"__afl_selective_coverage";
"__afl_selective_coverage_start_off";
"__afl_selective_coverage_temp;"
"__afl_coverage_discard";
"__afl_coverage_skip";
"__afl_coverage_on";
"__afl_coverage_off";
"__afl_coverage_interesting";
"__afl_fuzz_len";
"__afl_fuzz_ptr";
"__sanitizer_cov_trace_pc_guard"; "__sanitizer_cov_trace_pc_guard";
"__sanitizer_cov_trace_pc_guard_init"; "__sanitizer_cov_trace_pc_guard_init";
}; };

View File

@ -682,17 +682,42 @@ static void edit_params(u32 argc, char **argv, char **envp) {
/* Detect stray -v calls from ./configure scripts. */ /* Detect stray -v calls from ./configure scripts. */
u8 skip_next = 0;
while (--argc) { while (--argc) {
u8 *cur = *(++argv); u8 *cur = *(++argv);
if (skip_next) {
skip_next = 0;
continue;
}
if (!strncmp(cur, "--afl", 5)) continue; if (!strncmp(cur, "--afl", 5)) continue;
if (lto_mode && !strncmp(cur, "-fuse-ld=", 9)) continue; if (lto_mode && !strncmp(cur, "-fuse-ld=", 9)) continue;
if (lto_mode && !strncmp(cur, "--ld-path=", 10)) continue; if (lto_mode && !strncmp(cur, "--ld-path=", 10)) continue;
if (!strncmp(cur, "-fno-unroll", 11)) continue; if (!strncmp(cur, "-fno-unroll", 11)) continue;
if (strstr(cur, "afl-compiler-rt") || strstr(cur, "afl-llvm-rt")) continue; if (strstr(cur, "afl-compiler-rt") || strstr(cur, "afl-llvm-rt")) continue;
if (!strcmp(cur, "-Wl,-z,defs") || !strcmp(cur, "-Wl,--no-undefined")) if (!strcmp(cur, "-Wl,-z,defs") || !strcmp(cur, "-Wl,--no-undefined") ||
!strcmp(cur, "--no-undefined")) {
continue; continue;
}
if (!strcmp(cur, "-z")) {
u8 *param = *(argv + 1);
if (!strcmp(param, "defs")) {
skip_next = 1;
continue;
}
}
if (!strncmp(cur, "-fsanitize=fuzzer-", strlen("-fsanitize=fuzzer-")) || if (!strncmp(cur, "-fsanitize=fuzzer-", strlen("-fsanitize=fuzzer-")) ||
!strncmp(cur, "-fsanitize-coverage", strlen("-fsanitize-coverage"))) { !strncmp(cur, "-fsanitize-coverage", strlen("-fsanitize-coverage"))) {
@ -1015,7 +1040,7 @@ static void edit_params(u32 argc, char **argv, char **envp) {
} }
#if !defined(__APPLE__) && !defined(__sun) #if !defined(__APPLE__) && !defined(__sun)
if (!shared_linking) if (shared_linking)
cc_params[cc_par_cnt++] = cc_params[cc_par_cnt++] =
alloc_printf("-Wl,--dynamic-list=%s/dynamic_list.txt", obj_path); alloc_printf("-Wl,--dynamic-list=%s/dynamic_list.txt", obj_path);
#endif #endif