[Object] Split the ELF interface into 3 parts.
* ELFTypes.h contains template magic for defining types based on endianess, size, and alignment.
* ELFFile.h defines the ELFFile class which provides low level ELF specific access.
* ELFObjectFile.h contains ELFObjectFile which uses ELFFile to implement the ObjectFile interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188022 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/llvm-readobj/llvm-readobj.cpp b/tools/llvm-readobj/llvm-readobj.cpp
index 2e95b6b..0e092c0 100644
--- a/tools/llvm-readobj/llvm-readobj.cpp
+++ b/tools/llvm-readobj/llvm-readobj.cpp
@@ -1,4 +1,4 @@
-//===- llvm-readobj.cpp - Dump contents of an Object File -----------------===//
+//===- llvm-readobj.cpp - Dump contents of an Object File -----------------===//
//
// The LLVM Compiler Infrastructure
//
@@ -130,12 +130,15 @@
cl::desc("Expand each shown relocation to multiple lines"));
} // namespace opts
+static int ReturnValue = EXIT_SUCCESS;
+
namespace llvm {
bool error(error_code EC) {
if (!EC)
return false;
+ ReturnValue = EXIT_FAILURE;
outs() << "\nError reading file: " << EC.message() << ".\n";
outs().flush();
return true;
@@ -157,6 +160,7 @@
errs() << Input << ": " << EC.message() << "\n";
errs().flush();
+ ReturnValue = EXIT_FAILURE;
}
static void reportError(StringRef Input, StringRef Message) {
@@ -164,6 +168,7 @@
Input = "<stdin>";
errs() << Input << ": " << Message << "\n";
+ ReturnValue = EXIT_FAILURE;
}
/// @brief Creates an format-specific object file dumper.
@@ -289,5 +294,5 @@
std::for_each(opts::InputFilenames.begin(), opts::InputFilenames.end(),
dumpInput);
- return 0;
+ return ReturnValue;
}