[lld] r292336 - Return early if writeMapFile failed.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 17 19:34:39 PST 2017


Author: ruiu
Date: Tue Jan 17 21:34:38 2017
New Revision: 292336

URL: http://llvm.org/viewvc/llvm-project?rev=292336&view=rev
Log:
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.

Modified:
    lld/trunk/ELF/Writer.cpp
    lld/trunk/test/ELF/map-file.s

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=292336&r1=292335&r2=292336&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Tue Jan 17 21:34:38 2017
@@ -237,7 +237,11 @@ template <class ELFT> void Writer<ELFT>:
   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());
 

Modified: lld/trunk/test/ELF/map-file.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/map-file.s?rev=292336&r1=292335&r2=292336&view=diff
==============================================================================
--- lld/trunk/test/ELF/map-file.s (original)
+++ lld/trunk/test/ELF/map-file.s Tue Jan 17 21:34:38 2017
@@ -54,3 +54,7 @@ local:
 // CHECK-NEXT: 0000000000000000 0000000000000039     1         .shstrtab
 // CHECK-NEXT: 0000000000000000 000000000000002f     1 .strtab
 // CHECK-NEXT: 0000000000000000 000000000000002f     1         .strtab
+
+// RUN: not ld.lld %t1.o %t2.o %t3.o %t4.a -o %t -Map=/ 2>&1 \
+// RUN:  | FileCheck -check-prefix=FAIL %s
+// FAIL: cannot open /




More information about the llvm-commits mailing list