[PATCH] D12829: [LLD][COFF] Corrected error message if a section failed to load

Igor Kudrin via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 12 10:02:33 PDT 2015


ikudrin updated this revision to Diff 34630.
ikudrin added a comment.

Added the test for error message generation.


http://reviews.llvm.org/D12829

Files:
  lld/trunk/COFF/InputFiles.cpp
  lld/trunk/test/COFF/invalid-obj.test

Index: lld/trunk/test/COFF/invalid-obj.test
===================================================================
--- /dev/null
+++ lld/trunk/test/COFF/invalid-obj.test
@@ -0,0 +1,14 @@
+# RUN: yaml2obj %s > %t.obj
+# RUN: not lld-link %t.obj 2>&1 | FileCheck %s
+
+# CHECK: getSectionName failed: #1:
+
+---
+header:
+  Machine:         IMAGE_FILE_MACHINE_AMD64
+  Characteristics: [  ]
+sections:
+  - Name:            '/1'
+    Characteristics: [  ]
+    SectionData:     00
+symbols:
Index: lld/trunk/COFF/InputFiles.cpp
===================================================================
--- lld/trunk/COFF/InputFiles.cpp
+++ lld/trunk/COFF/InputFiles.cpp
@@ -115,9 +115,9 @@
     const coff_section *Sec;
     StringRef Name;
     std::error_code EC = COFFObj->getSection(I, Sec);
-    error(EC, Twine("getSection failed: ") + Name);
+    error(EC, Twine("getSection failed: #") + Twine(I));
     EC = COFFObj->getSectionName(Sec, Name);
-    error(EC, Twine("getSectionName failed: ") + Name);
+    error(EC, Twine("getSectionName failed: #") + Twine(I));
     if (Name == ".sxdata") {
       SXData = Sec;
       continue;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12829.34630.patch
Type: text/x-patch
Size: 1129 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150912/8dd7620c/attachment.bin>


More information about the llvm-commits mailing list