[MachOObject] Fix bind opcode parser error on valid opcode sequence

BIND_OPCODE_SET_DYLIB_SPECIAL_IMM(0) is a valid way to setp library
ordinal. MachOObject should set LibraryOrdinalSet even when IMM is zero.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304362 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Steven Wu 2017-05-31 22:17:43 +00:00
parent 1c5a50caa7
commit b2ab273ef3

View File

@ -3269,7 +3269,6 @@ void MachOBindEntry::moveNext() {
if (ImmValue) {
SignExtended = MachO::BIND_OPCODE_MASK | ImmValue;
Ordinal = SignExtended;
LibraryOrdinalSet = true;
if (Ordinal < MachO::BIND_SPECIAL_DYLIB_FLAT_LOOKUP) {
*E = malformedError("for BIND_OPCODE_SET_DYLIB_SPECIAL_IMM unknown "
"special ordinal: " + Twine((int)Ordinal) + " for opcode at: "
@ -3279,6 +3278,7 @@ void MachOBindEntry::moveNext() {
}
} else
Ordinal = 0;
LibraryOrdinalSet = true;
DEBUG_WITH_TYPE(
"mach-o-bind",
dbgs() << "BIND_OPCODE_SET_DYLIB_SPECIAL_IMM: "