diff options
| author | Alexei Starovoitov <alexei.starovoitov@gmail.com> | 2015-05-22 18:47:33 +0000 |
|---|---|---|
| committer | Alexei Starovoitov <alexei.starovoitov@gmail.com> | 2015-05-22 18:47:33 +0000 |
| commit | 6296f6d7d828064d052b2d46155f074f2ece6924 (patch) | |
| tree | 535e41ac5a1678f94eaf5f731ca064ff00ce4c3d | |
| parent | f6c154d53269be701e863b2b810daec75b48b76b (diff) | |
| download | bcm5719-llvm-6296f6d7d828064d052b2d46155f074f2ece6924.tar.gz bcm5719-llvm-6296f6d7d828064d052b2d46155f074f2ece6924.zip | |
[bpf] emit jmp fixups in little endian
The 'off' field of 'struct bpf_insn' is in cpu-endianness,
since the rest is emitted as little endian, make sure
that 'off' field is little endian as well.
llvm-svn: 238038
| -rw-r--r-- | llvm/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp b/llvm/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp index 8393135a2b9..48f34e48459 100644 --- a/llvm/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp +++ b/llvm/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp @@ -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 { |

