[bpf] emit jmp fixups in little endian
[oota-llvm.git] / lib / Target / BPF / MCTargetDesc / BPFAsmBackend.cpp
index 8393135a2b9c1a3f6083dfe43fddeae258ea09a8..48f34e484590af47a1083cb270614845e792de20 100644 (file)
@@ -68,7 +68,9 @@ void BPFAsmBackend::applyFixup(const MCFixup &Fixup, char *Data,
     return;
   }
   assert(Fixup.getKind() == FK_PCRel_2);
-  *(uint16_t *)&Data[Fixup.getOffset() + 2] = (uint16_t)((Value - 8) / 8);
+  Value = (uint16_t)((Value - 8) / 8);
+  Data[Fixup.getOffset() + 2] = Value & 0xFF;
+  Data[Fixup.getOffset() + 3] = Value >> 8;
 }
 
 MCObjectWriter *BPFAsmBackend::createObjectWriter(raw_pwrite_stream &OS) const {