about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2021-12-15 09:50:35 +0100
committervanhauser-thc <vh@thc.org>2021-12-15 09:50:45 +0100
commit176ede3fc82f8b6315942e103c260b93bf5cfe57 (patch)
tree33ee9e63d20af8c04a72fa62bb5efaa1eb11f37a
parentd89fa8c7adebf1766b1ca41313e7bfef466bb358 (diff)
downloadafl++-176ede3fc82f8b6315942e103c260b93bf5cfe57.tar.gz
afl-cc -v without errors
-rw-r--r--docs/Changelog.md1
-rw-r--r--src/afl-cc.c5
2 files changed, 4 insertions, 2 deletions
diff --git a/docs/Changelog.md b/docs/Changelog.md
index 0253222b..1daa9a75 100644
--- a/docs/Changelog.md
+++ b/docs/Changelog.md
@@ -57,6 +57,7 @@ sending a mail to <afl-users+subscribe@googlegroups.com>.
     - added AFL_USE_TSAN thread sanitizer support
     - llvm and LTO mode modified to work with new llvm 14-dev (again. again.)
     - fix for AFL_REAL_LD
+    - make -v without options work
   - added the very good grammar mutator "GramaTron" to the
     custom_mutators
   - added optimin, a faster and better corpus minimizer by
diff --git a/src/afl-cc.c b/src/afl-cc.c
index cafb8e32..442cf265 100644
--- a/src/afl-cc.c
+++ b/src/afl-cc.c
@@ -695,7 +695,7 @@ static void edit_params(u32 argc, char **argv, char **envp) {
 
   /* Detect stray -v calls from ./configure scripts. */
 
-  u8 skip_next = 0;
+  u8 skip_next = 0, non_dash = 0;
   while (--argc) {
 
     u8 *cur = *(++argv);
@@ -707,6 +707,7 @@ static void edit_params(u32 argc, char **argv, char **envp) {
 
     }
 
+    if (cur[0] != '-') { non_dash = 1; }
     if (!strncmp(cur, "--afl", 5)) continue;
     if (lto_mode && !strncmp(cur, "-fuse-ld=", 9)) continue;
     if (lto_mode && !strncmp(cur, "--ld-path=", 10)) continue;
@@ -1025,7 +1026,7 @@ static void edit_params(u32 argc, char **argv, char **envp) {
 
   }
 
-  if (preprocessor_only || have_c) {
+  if (preprocessor_only || have_c || !non_dash) {
 
     /* In the preprocessor_only case (-E), we are not actually compiling at
        all but requesting the compiler to output preprocessed sources only.