[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
This commit is contained in:
parent
9217b2ed0a
commit
7bab73b1f8
|
@ -70,7 +70,7 @@ void BPFAsmBackend::applyFixup(const MCFixup &Fixup, char *Data,
|
||||||
unsigned Size = Fixup.getKind() == FK_Data_4 ? 4 : 8;
|
unsigned Size = Fixup.getKind() == FK_Data_4 ? 4 : 8;
|
||||||
|
|
||||||
for (unsigned i = 0; i != Size; ++i) {
|
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));
|
Data[Fixup.getOffset() + Idx] = uint8_t(Value >> (i * 8));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
; RUN: llc -O2 -march=bpfel %s -o %t -filetype=obj
|
; RUN: llc -O2 -march=bpfel %s -o %t -filetype=obj
|
||||||
; RUN: llvm-dwarfdump -debug-dump=line %t | FileCheck %s
|
; 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"
|
source_filename = "testprog.c"
|
||||||
target datalayout = "e-m:e-p:64:64-i64:64-n32:64-S128"
|
target datalayout = "e-m:e-p:64:64-i64:64-n32:64-S128"
|
||||||
|
|
Loading…
Reference in New Issue