diff --git a/src/gn/ninja_binary_target_writer.cc b/src/gn/ninja_binary_target_writer.cc
index c244c7ce..204b643b 100644
--- a/src/gn/ninja_binary_target_writer.cc
+++ b/src/gn/ninja_binary_target_writer.cc
@@ -360,7 +360,12 @@ void NinjaBinaryTargetWriter::WriteLinkerFlags(
   WriteLibrarySearchPath(out, tool);
 
   if (optional_def_file) {
+#ifdef _MSC_VER
     out_ << " /DEF:";
+#else
+    // Add a space before DEF file path
+    out_ << " ";
+#endif
     path_output_.WriteFile(out, *optional_def_file);
   }
 }
