From 97620dd47394322e38a33021560a5a570db6a57f Mon Sep 17 00:00:00 2001 From: DavidKorczynski Date: Sat, 6 Nov 2021 13:24:12 +0000 Subject: [PATCH] binutils: extract various types of symbols in dlltool (#6785) --- projects/binutils/fuzz_dlltool.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/projects/binutils/fuzz_dlltool.c b/projects/binutils/fuzz_dlltool.c index 91cfabad4..ee8f93bdc 100644 --- a/projects/binutils/fuzz_dlltool.c +++ b/projects/binutils/fuzz_dlltool.c @@ -41,6 +41,20 @@ init_dlltool_global_state() { def_file = NULL; } +void callIntoDlltool(char *, char*, bool); +void +callIntoDlltool(char *deffile, char *objfile, bool var_export_all_symbols) { + init_dlltool_global_state(); + program_name = "fuzz_dlltool"; + mname = "mcore-elf"; + export_all_symbols = var_export_all_symbols; + + // At the moment we focus on the def file processing + def_file = deffile; + process_def_file(deffile); + scan_obj_file(objfile); +} + int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size); int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) @@ -72,15 +86,8 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) fwrite(data, size, 1, fp2); fclose(fp2); - init_dlltool_global_state(); - - program_name = "fuzz_dlltool"; - mname = "mcore-elf"; - - // At the moment we focus on the def file processing - def_file = filename; - process_def_file(filename); - scan_obj_file(filename2); + callIntoDlltool(filename, filename2, true); + callIntoDlltool(filename, filename2, false); unlink(filename); unlink(filename2);