diff options
-rw-r--r-- | lld/ELF/Writer.cpp | 4 | ||||
-rw-r--r-- | lld/test/ELF/map-file.s | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index d93468fef34..acfba4e0921 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -237,7 +237,11 @@ template <class ELFT> void Writer<ELFT>::run() { 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()); diff --git a/lld/test/ELF/map-file.s b/lld/test/ELF/map-file.s index ccf6d12f6d5..b7a4aef2f29 100644 --- a/lld/test/ELF/map-file.s +++ b/lld/test/ELF/map-file.s @@ -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 / |