[llvm] r302265 - [bpf] fix a bug which causes incorrect big endian reloc fixup
Alexei Starovoitov via llvm-commits
llvm-commits at lists.llvm.org
Fri May 5 11:05:01 PDT 2017
Author: ast
Date: Fri May 5 13:05:00 2017
New Revision: 302265
URL: http://llvm.org/viewvc/llvm-project?rev=302265&view=rev
Log:
[bpf] fix a bug which causes incorrect big endian reloc fixup
o Add bpfeb support in BPF dwarfdump unit test case
Signed-off-by: Yonghong Song <yhs at fb.com>
Signed-off-by: Alexei Starovoitov <ast at fb.com>
Modified:
llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp
llvm/trunk/test/CodeGen/BPF/dwarfdump.ll
Modified: llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp?rev=302265&r1=302264&r2=302265&view=diff
==============================================================================
--- llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp (original)
+++ llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp Fri May 5 13:05:00 2017
@@ -70,7 +70,7 @@ void BPFAsmBackend::applyFixup(const MCF
unsigned Size = Fixup.getKind() == FK_Data_4 ? 4 : 8;
for (unsigned i = 0; i != Size; ++i) {
- unsigned Idx = IsLittleEndian ? i : Size - i;
+ unsigned Idx = IsLittleEndian ? i : Size - i - 1;
Data[Fixup.getOffset() + Idx] = uint8_t(Value >> (i * 8));
}
} else {
Modified: llvm/trunk/test/CodeGen/BPF/dwarfdump.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/BPF/dwarfdump.ll?rev=302265&r1=302264&r2=302265&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/BPF/dwarfdump.ll (original)
+++ llvm/trunk/test/CodeGen/BPF/dwarfdump.ll Fri May 5 13:05:00 2017
@@ -1,5 +1,7 @@
; RUN: llc -O2 -march=bpfel %s -o %t -filetype=obj
; RUN: llvm-dwarfdump -debug-dump=line %t | FileCheck %s
+; RUN: llc -O2 -march=bpfeb %s -o %t -filetype=obj
+; RUN: llvm-dwarfdump -debug-dump=line %t | FileCheck %s
source_filename = "testprog.c"
target datalayout = "e-m:e-p:64:64-i64:64-n32:64-S128"
More information about the llvm-commits
mailing list