summaryrefslogtreecommitdiffstats
path: root/llvm/tools/obj2yaml/elf2yaml.cpp
diff options
context:
space:
mode:
authorGeorge Rimar <grimar@accesssoftek.com>2019-07-29 07:58:29 +0000
committerGeorge Rimar <grimar@accesssoftek.com>2019-07-29 07:58:29 +0000
commitaef03e86c1c6cadbbb2e7fdd1a2947f7e7cc5961 (patch)
tree6dc064301f97cbdbf5f1adbb893cef5a05e762ef /llvm/tools/obj2yaml/elf2yaml.cpp
parent99f73ebe5c96de340c3a148c4a99e4aca5d13b7a (diff)
downloadbcm5719-llvm-aef03e86c1c6cadbbb2e7fdd1a2947f7e7cc5961.tar.gz
bcm5719-llvm-aef03e86c1c6cadbbb2e7fdd1a2947f7e7cc5961.zip
[obj2yaml] - Report a error when unable to resolve a sh_link reference properly.
Because of a bug we did not report a error in the case shown in the test. With this patch we do. Differential revision: https://reviews.llvm.org/D65214 llvm-svn: 367203
Diffstat (limited to 'llvm/tools/obj2yaml/elf2yaml.cpp')
-rw-r--r--llvm/tools/obj2yaml/elf2yaml.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/tools/obj2yaml/elf2yaml.cpp b/llvm/tools/obj2yaml/elf2yaml.cpp
index bd27c103403..dea3cf73a5d 100644
--- a/llvm/tools/obj2yaml/elf2yaml.cpp
+++ b/llvm/tools/obj2yaml/elf2yaml.cpp
@@ -376,8 +376,12 @@ Error ELFDumper<ELFT>::dumpCommonSection(const Elf_Shdr *Shdr,
if (Shdr->sh_link != ELF::SHN_UNDEF) {
auto LinkSection = Obj.getSection(Shdr->sh_link);
- if (LinkSection.takeError())
- return LinkSection.takeError();
+ if (!LinkSection)
+ return make_error<StringError>(
+ "unable to resolve sh_link reference in section '" + S.Name +
+ "': " + toString(LinkSection.takeError()),
+ inconvertibleErrorCode());
+
NameOrErr = getUniquedSectionName(*LinkSection);
if (!NameOrErr)
return NameOrErr.takeError();
OpenPOWER on IntegriCloud