summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2015-09-13 20:22:22 +0000
committerRui Ueyama <ruiu@google.com>2015-09-13 20:22:22 +0000
commit8e186df2f530078b65708d7440ee66f2ea00cdbc (patch)
treee381d962dee154f34256c081d7441f7ec5339261
parentc5c7319fce6babe13d429213708d9abf1dcc2d0f (diff)
downloadbcm5719-llvm-8e186df2f530078b65708d7440ee66f2ea00cdbc.tar.gz
bcm5719-llvm-8e186df2f530078b65708d7440ee66f2ea00cdbc.zip
COFF: Corrected error message if a section failed to load.
There is no sense to use Name in these lines as it is not initialized yet. Patch from Igor Kudrin! llvm-svn: 247531
-rw-r--r--lld/COFF/InputFiles.cpp4
-rw-r--r--lld/test/COFF/invalid-obj.test14
2 files changed, 16 insertions, 2 deletions
diff --git a/lld/COFF/InputFiles.cpp b/lld/COFF/InputFiles.cpp
index a8537ec3965..df92c432b6a 100644
--- a/lld/COFF/InputFiles.cpp
+++ b/lld/COFF/InputFiles.cpp
@@ -115,9 +115,9 @@ void ObjectFile::initializeChunks() {
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;
diff --git a/lld/test/COFF/invalid-obj.test b/lld/test/COFF/invalid-obj.test
new file mode 100644
index 00000000000..fd63f7874cc
--- /dev/null
+++ b/lld/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:
OpenPOWER on IntegriCloud