]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
fix: Fall back to compiler when producing assembler listing file
authorJoel Rosdahl <joel@rosdahl.net>
Mon, 6 Jun 2022 20:23:00 +0000 (22:23 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Tue, 7 Jun 2022 07:23:16 +0000 (09:23 +0200)
Ccache currently doesn't store the listing produced by -Wa,...=file, so
fall back to running the real compiler.

See #1083.

src/argprocessing.cpp
test/suites/base.bash

index 6a504812e169c16e87d342df45a6d708331398b8..a3f89e2bcc1b1d3092a0951f3b7716fb2e13d60b 100644 (file)
@@ -401,6 +401,13 @@ process_arg(const Context& ctx,
     ++i;
   }
 
+  if (util::starts_with(args[i], "-Wa,")
+      && args[i].find('=') != std::string::npos) {
+    LOG("Assembler listing file (-Wa,...=file) is currently not supported: {}",
+        args[i]);
+    return Statistic::unsupported_compiler_option;
+  }
+
   // Handle options that should not be passed to the preprocessor.
   if (compopt_affects_compiler_output(args[i])) {
     state.compiler_only_args.push_back(args[i]);
index b2d9149518597685b6c5ee57c21332edda4cd8b8..89cddf3e8bd926ba9bff22fefbf72c058a1ec347 100644 (file)
@@ -1323,6 +1323,30 @@ EOF
     expect_stat cache_miss 0
     expect_stat called_for_preprocessing 1
 
+    # -------------------------------------------------------------------------
+    if $COMPILER -c -Wa,-a test1.c >&/dev/null; then
+        TEST "-Wa,-a"
+
+        $CCACHE_COMPILE -c -Wa,-a test1.c >first.lst
+        expect_stat preprocessed_cache_hit 0
+        expect_stat cache_miss 1
+
+        $CCACHE_COMPILE -c -Wa,-a test1.c >second.lst
+        expect_stat preprocessed_cache_hit 1
+        expect_stat cache_miss 1
+        expect_equal_content first.lst second.lst
+    fi
+
+    # -------------------------------------------------------------------------
+    if $COMPILER -c -Wa,-a=test1.lst test1.c >&/dev/null; then
+        TEST "-Wa,-a=file"
+
+        $CCACHE_COMPILE -c -Wa,-a=test1.lst test1.c
+        expect_stat preprocessed_cache_hit 0
+        expect_stat cache_miss 0
+        expect_stat unsupported_compiler_option 1
+    fi
+
     # -------------------------------------------------------------------------
     TEST "-Wp,-P"