llvm.org GIT mirror llvm / a9d6e8b
[SystemZ] Fix applyFixup for 12-bit fixups Now that we have fixups that only fill parts of a byte, it turns out we have to mask off the bits outside the fixup area when applying them. Failing to do so caused invalid object code to be emitted for bprp with a negative 12-bit displacement. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288374 91177308-0d34-0410-b5e6-96231b3b80d8 Ulrich Weigand 3 years ago
1 changed file(s) with 3 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
9393 bool IsPCRel) const {
9494 MCFixupKind Kind = Fixup.getKind();
9595 unsigned Offset = Fixup.getOffset();
96 unsigned Size = (getFixupKindInfo(Kind).TargetSize + 7) / 8;
96 unsigned BitSize = getFixupKindInfo(Kind).TargetSize;
97 unsigned Size = (BitSize + 7) / 8;
9798
9899 assert(Offset + Size <= DataSize && "Invalid fixup offset!");
99100
100101 // Big-endian insertion of Size bytes.
101102 Value = extractBitsForFixup(Kind, Value);
103 Value &= ((uint64_t)1 << BitSize) - 1;
102104 unsigned ShiftValue = (Size * 8) - 8;
103105 for (unsigned I = 0; I != Size; ++I) {
104106 Data[Offset + I] |= uint8_t(Value >> ShiftValue);