summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexei Starovoitov <alexei.starovoitov@gmail.com>2017-05-05 18:05:00 +0000
committerAlexei Starovoitov <alexei.starovoitov@gmail.com>2017-05-05 18:05:00 +0000
commit7bab73b1f858be6df3db0f09e1415ff126693712 (patch)
tree9ccd02f40027a96be62000bf12828ce685e87f24
parent9217b2ed0ac1ba64ff6f0cf3e568895c00a68f7f (diff)
downloadbcm5719-llvm-7bab73b1f858be6df3db0f09e1415ff126693712.tar.gz
bcm5719-llvm-7bab73b1f858be6df3db0f09e1415ff126693712.zip
[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@fb.com> Signed-off-by: Alexei Starovoitov <ast@fb.com> llvm-svn: 302265
-rw-r--r--llvm/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp2
-rw-r--r--llvm/test/CodeGen/BPF/dwarfdump.ll2
2 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 1f355171ebd..80357a63a4e 100644
--- a/llvm/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp
+++ b/llvm/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp
@@ -70,7 +70,7 @@ void BPFAsmBackend::applyFixup(const MCFixup &Fixup, char *Data,
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 {
diff --git a/llvm/test/CodeGen/BPF/dwarfdump.ll b/llvm/test/CodeGen/BPF/dwarfdump.ll
index 7ae64dfb568..6a6913011e6 100644
--- a/llvm/test/CodeGen/BPF/dwarfdump.ll
+++ b/llvm/test/CodeGen/BPF/dwarfdump.ll
@@ -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"
OpenPOWER on IntegriCloud