summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2017-03-27 20:09:23 +0000
committerKevin Enderby <enderby@apple.com>2017-03-27 20:09:23 +0000
commit6c1d2b4cb2dd5f17c4255d2c703d71707b1543da (patch)
treed36e0fe6b6283fbc23d012b1f0519462eb4806c4 /llvm/include
parentb8ff4a4a700d3d24e20e98a1e849fd57c8b0bbd0 (diff)
downloadbcm5719-llvm-6c1d2b4cb2dd5f17c4255d2c703d71707b1543da.tar.gz
bcm5719-llvm-6c1d2b4cb2dd5f17c4255d2c703d71707b1543da.zip
Add the error handling for Mach-O dyld compact lazy bind, weak bind and
rebase entry errors and test cases for each of the error checks. Also verified with Nick Kledzik that a BIND_OPCODE_SET_ADDEND_SLEB opcode is legal in a lazy bind table, so code that had that as an error check was removed. With MachORebaseEntry and MachOBindEntry classes now returning an llvm::Error in all cases for malformed input the variables Malformed and logic to set use them is no longer needed and has been removed from those classes. Also in a few places, removed the redundant Done assignment to true when also calling moveToEnd() as it does that assignment. This only leaves the dyld compact export entries left to have error handling yet to be added for the dyld compact info. llvm-svn: 298883
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/Object/MachO.h24
1 files changed, 19 insertions, 5 deletions
diff --git a/llvm/include/llvm/Object/MachO.h b/llvm/include/llvm/Object/MachO.h
index 019f777ed65..1ee571cce73 100644
--- a/llvm/include/llvm/Object/MachO.h
+++ b/llvm/include/llvm/Object/MachO.h
@@ -146,7 +146,7 @@ public:
MachORebaseEntry(Error *Err, const MachOObjectFile *O,
ArrayRef<uint8_t> opcodes, bool is64Bit);
- uint32_t segmentIndex() const;
+ int32_t segmentIndex() const;
uint64_t segmentOffset() const;
StringRef typeName() const;
StringRef segmentName() const;
@@ -161,19 +161,18 @@ private:
friend class MachOObjectFile;
void moveToFirst();
void moveToEnd();
- uint64_t readULEB128();
+ uint64_t readULEB128(const char **error);
Error *E;
const MachOObjectFile *O;
ArrayRef<uint8_t> Opcodes;
const uint8_t *Ptr;
uint64_t SegmentOffset;
- uint32_t SegmentIndex;
+ int32_t SegmentIndex;
uint64_t RemainingLoopCount;
uint64_t AdvanceAmount;
uint8_t RebaseType;
uint8_t PointerSize;
- bool Malformed;
bool Done;
};
typedef content_iterator<MachORebaseEntry> rebase_iterator;
@@ -231,7 +230,6 @@ private:
uint8_t BindType;
uint8_t PointerSize;
Kind TableKind;
- bool Malformed;
bool Done;
};
typedef content_iterator<MachOBindEntry> bind_iterator;
@@ -378,6 +376,22 @@ public:
SegIndex, SegOffset);
}
+ /// For use with a SegIndex,SegOffset pair in MachORebaseEntry::moveNext() to
+ /// validate a MachORebaseEntry.
+ const char *RebaseEntryCheckSegAndOffset(int32_t SegIndex, uint64_t SegOffset,
+ bool endInvalid) const {
+ return BindRebaseSectionTable->checkSegAndOffset(SegIndex, SegOffset,
+ endInvalid);
+ }
+ /// For use in MachORebaseEntry::moveNext() to validate a MachORebaseEntry for
+ /// the REBASE_OPCODE_DO_*_TIMES* opcodes.
+ const char *RebaseEntryCheckCountAndSkip(uint32_t Count, uint32_t Skip,
+ uint8_t PointerSize, int32_t SegIndex,
+ uint64_t SegOffset) const {
+ return BindRebaseSectionTable->checkCountAndSkip(Count, Skip, PointerSize,
+ SegIndex, SegOffset);
+ }
+
/// For use with the SegIndex of a checked Mach-O Bind or Rebase entry to
/// get the segment name.
StringRef BindRebaseSegmentName(int32_t SegIndex) const {
OpenPOWER on IntegriCloud