]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Disable split-dwarf code paths when outputting to /dev/null
authorJoel Rosdahl <joel@rosdahl.net>
Mon, 5 Apr 2021 17:12:10 +0000 (19:12 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Mon, 5 Apr 2021 17:12:10 +0000 (19:12 +0200)
This avoids an attempt to delete /dev/null.dwo, which is harmless but
apparently flagged by the sandboxing feature of Gentoo’s build system.

Fixes #833.

src/argprocessing.cpp

index e39c4e54fd062bb403158a47e1c1c37caa2bd215..a2e600bf99b9717a3b69db967bf4a55c181719b8 100644 (file)
@@ -1107,7 +1107,14 @@ process_args(Context& ctx)
   }
 
   if (args_info.seen_split_dwarf) {
-    args_info.output_dwo = Util::change_extension(args_info.output_obj, ".dwo");
+    if (args_info.output_obj == "/dev/null") {
+      // Outputting to /dev/null -> compiler won't write a .dwo, so just pretend
+      // we haven't seen the -gsplit-dwarf option.
+      args_info.seen_split_dwarf = false;
+    } else {
+      args_info.output_dwo =
+        Util::change_extension(args_info.output_obj, ".dwo");
+    }
   }
 
   // Cope with -o /dev/null.