summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-objdump/llvm-objdump.cpp
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2017-03-20 19:46:55 +0000
committerKevin Enderby <enderby@apple.com>2017-03-20 19:46:55 +0000
commita8d256cb366d3a9d368e3bf962bab1e37b7f100c (patch)
tree877d1c3cd85656485e61f1d649aae9e4d8eb3b92 /llvm/tools/llvm-objdump/llvm-objdump.cpp
parent1aa0ed4e0d202fde2c7225aaae513b228cb9a2b3 (diff)
downloadbcm5719-llvm-a8d256cb366d3a9d368e3bf962bab1e37b7f100c.tar.gz
bcm5719-llvm-a8d256cb366d3a9d368e3bf962bab1e37b7f100c.zip
Add the rest of the error checking for Mach-O dyld compact bind entry errors
and test cases for each of the error checks. To do this more plumbing was needed so that the segment indexes and segment offsets can be checked. Basically what was done was the SegInfo from llvm-objdump’s MachODump.cpp was moved into libObject for Mach-O objects as BindRebaseSegInfo and it is only created when an iterator for bind or rebase entries are created. This commit really only adds the error checking and test cases for the bind table entires and the checking for the lazy bind and weak bind entries are still to be fully done as well as the rebase entires. Though some of the plumbing for those are added with this commit. Those other error checks and test cases will be added in follow on commits. Note, the two llvm_unreachable() calls should now actually be unreachable with the error checks in place and would take a logic bug in the error checking code to be reached if the segment indexes and segment offsets are used from a checked bind entry. Comments have been added to the methods that require the arguments to have been checked prior to calling. llvm-svn: 298292
Diffstat (limited to 'llvm/tools/llvm-objdump/llvm-objdump.cpp')
-rw-r--r--llvm/tools/llvm-objdump/llvm-objdump.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp
index 96932eb0a47..613d0643b43 100644
--- a/llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -1885,9 +1885,9 @@ void llvm::printExportsTrie(const ObjectFile *o) {
}
}
-void llvm::printRebaseTable(const ObjectFile *o) {
+void llvm::printRebaseTable(ObjectFile *o) {
outs() << "Rebase table:\n";
- if (const MachOObjectFile *MachO = dyn_cast<MachOObjectFile>(o))
+ if (MachOObjectFile *MachO = dyn_cast<MachOObjectFile>(o))
printMachORebaseTable(MachO);
else {
errs() << "This operation is only currently supported "
@@ -1896,9 +1896,9 @@ void llvm::printRebaseTable(const ObjectFile *o) {
}
}
-void llvm::printBindTable(const ObjectFile *o) {
+void llvm::printBindTable(ObjectFile *o) {
outs() << "Bind table:\n";
- if (const MachOObjectFile *MachO = dyn_cast<MachOObjectFile>(o))
+ if (MachOObjectFile *MachO = dyn_cast<MachOObjectFile>(o))
printMachOBindTable(MachO);
else {
errs() << "This operation is only currently supported "
@@ -1907,9 +1907,9 @@ void llvm::printBindTable(const ObjectFile *o) {
}
}
-void llvm::printLazyBindTable(const ObjectFile *o) {
+void llvm::printLazyBindTable(ObjectFile *o) {
outs() << "Lazy bind table:\n";
- if (const MachOObjectFile *MachO = dyn_cast<MachOObjectFile>(o))
+ if (MachOObjectFile *MachO = dyn_cast<MachOObjectFile>(o))
printMachOLazyBindTable(MachO);
else {
errs() << "This operation is only currently supported "
@@ -1918,9 +1918,9 @@ void llvm::printLazyBindTable(const ObjectFile *o) {
}
}
-void llvm::printWeakBindTable(const ObjectFile *o) {
+void llvm::printWeakBindTable(ObjectFile *o) {
outs() << "Weak bind table:\n";
- if (const MachOObjectFile *MachO = dyn_cast<MachOObjectFile>(o))
+ if (MachOObjectFile *MachO = dyn_cast<MachOObjectFile>(o))
printMachOWeakBindTable(MachO);
else {
errs() << "This operation is only currently supported "
@@ -2018,7 +2018,7 @@ static void printPrivateFileHeaders(const ObjectFile *o, bool onlyFirst) {
report_error(o->getFileName(), "Invalid/Unsupported object file format");
}
-static void DumpObject(const ObjectFile *o, const Archive *a = nullptr) {
+static void DumpObject(ObjectFile *o, const Archive *a = nullptr) {
StringRef ArchiveName = a != nullptr ? a->getFileName() : "";
// Avoid other output when using a raw option.
if (!RawClangAST) {
OpenPOWER on IntegriCloud