Return early if writeMapFile failed.

This patch adds a test for an invalid output path for -Map option,
though that test is not for verifying that we are using error()
instead of fatal() in writeMapFile.

llvm-svn: 292336
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index d93468f..acfba4e 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -237,7 +237,11 @@
   if (ErrorCount)
     return;
 
+  // Handle -Map option.
   writeMapFile<ELFT>(OutputSections);
+  if (ErrorCount)
+    return;
+
   if (auto EC = Buffer->commit())
     error("failed to write to the output file: " + EC.message());