diff options
| author | Davide Italiano <davide@freebsd.org> | 2015-11-21 02:15:51 +0000 |
|---|---|---|
| committer | Davide Italiano <davide@freebsd.org> | 2015-11-21 02:15:51 +0000 |
| commit | 07557fc2f10be72c0ee62dc2ef783f2f42f3a882 (patch) | |
| tree | d6dd62ba1512fa3417c44b3d0aae74188978cad4 /llvm/tools/llvm-rtdyld | |
| parent | 84055ecb7dabc7172c395b902106b328d4f08ae1 (diff) | |
| download | bcm5719-llvm-07557fc2f10be72c0ee62dc2ef783f2f42f3a882.tar.gz bcm5719-llvm-07557fc2f10be72c0ee62dc2ef783f2f42f3a882.zip | |
[llvm-rtdyld] Use report_fatal_error().
This is a first step towards saner/uniform error reporting in llvm-rtdyld.
llvm-svn: 253759
Diffstat (limited to 'llvm/tools/llvm-rtdyld')
| -rw-r--r-- | llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp | 35 |
1 files changed, 13 insertions, 22 deletions
diff --git a/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp b/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp index eab74543cbb..c5f2665a5d7 100644 --- a/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp +++ b/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp @@ -463,11 +463,9 @@ applySpecificSectionMappings(RuntimeDyldChecker &Checker) { std::string SectionIDStr = Mapping.substr(0, EqualsIdx); size_t ComaIdx = Mapping.find_first_of(","); - if (ComaIdx == StringRef::npos) { - errs() << "Invalid section specification '" << Mapping - << "'. Should be '<file name>,<section name>=<addr>'\n"; - exit(1); - } + if (ComaIdx == StringRef::npos) + report_fatal_error("Invalid section specification '" + Mapping + + "'. Should be '<file name>,<section name>=<addr>'"); std::string FileName = SectionIDStr.substr(0, ComaIdx); std::string SectionName = SectionIDStr.substr(ComaIdx + 1); @@ -477,20 +475,17 @@ applySpecificSectionMappings(RuntimeDyldChecker &Checker) { std::tie(OldAddrInt, ErrorMsg) = Checker.getSectionAddr(FileName, SectionName, true); - if (ErrorMsg != "") { - errs() << ErrorMsg; - exit(1); - } + if (ErrorMsg != "") + report_fatal_error(ErrorMsg); void* OldAddr = reinterpret_cast<void*>(static_cast<uintptr_t>(OldAddrInt)); std::string NewAddrStr = Mapping.substr(EqualsIdx + 1); uint64_t NewAddr; - if (StringRef(NewAddrStr).getAsInteger(0, NewAddr)) { - errs() << "Invalid section address in mapping '" << Mapping << "'.\n"; - exit(1); - } + if (StringRef(NewAddrStr).getAsInteger(0, NewAddr)) + report_fatal_error("Invalid section address in mapping '" + Mapping + + "'."); Checker.getRTDyld().mapSectionAddress(OldAddr, NewAddr); SpecificMappings[OldAddr] = NewAddr; @@ -579,20 +574,16 @@ static void remapSectionsAndSymbols(const llvm::Triple &TargetTriple, for (const auto &Mapping : DummySymbolMappings) { size_t EqualsIdx = Mapping.find_first_of("="); - if (EqualsIdx == StringRef::npos) { - errs() << "Invalid dummy symbol specification '" << Mapping - << "'. Should be '<symbol name>=<addr>'\n"; - exit(1); - } + if (EqualsIdx == StringRef::npos) + report_fatal_error("Invalid dummy symbol specification '" + Mapping + + "'. Should be '<symbol name>=<addr>'"); std::string Symbol = Mapping.substr(0, EqualsIdx); std::string AddrStr = Mapping.substr(EqualsIdx + 1); uint64_t Addr; - if (StringRef(AddrStr).getAsInteger(0, Addr)) { - errs() << "Invalid symbol mapping '" << Mapping << "'.\n"; - exit(1); - } + if (StringRef(AddrStr).getAsInteger(0, Addr)) + report_fatal_error("Invalid symbol mapping '" + Mapping + "'."); MemMgr.addDummySymbol(Symbol, Addr); } |

