[WebAssembly] MCFixupKindInfo's TargetSize is in bits rather than bytes.

llvm-svn: 257655
This commit is contained in:
Dan Gohman 2016-01-13 19:29:37 +00:00
parent f03dbb3cb5
commit 938ff9f0aa
2 changed files with 16 additions and 2 deletions

View File

@ -73,8 +73,8 @@ void WebAssemblyAsmBackend::applyFixup(const MCFixup &Fixup, char *Data,
unsigned DataSize, uint64_t Value,
bool IsPCRel) const {
const MCFixupKindInfo &Info = getFixupKindInfo(Fixup.getKind());
unsigned NumBytes = RoundUpToAlignment(Info.TargetSize, 8);
if (!Value)
unsigned NumBytes = (Info.TargetSize + 7) / 8;
if (Value == 0)
return; // Doesn't change encoding.
// Shift the value into position.

View File

@ -175,3 +175,17 @@ define i8* @call_memcpy(i8* %p, i8* nocapture readonly %q, i32 %n) {
; CHECK: .skip 512{{$}}
; CHECK: .size rom, 512{{$}}
@rom = constant [128 x i32] zeroinitializer, align 16
; CHECK: .type array,@object
; CHECK-NEXT: array:
; CHECK-NEXT: .skip 8
; CHECK-NEXT: .size array, 8
; CHECK: .type pointer_to_array,@object
; CHECK-NEXT: .section .data.rel.ro,"aw",@progbits
; CHECK-NEXT: .globl pointer_to_array
; CHECK-NEXT: .align 2
; CHECK-NEXT: pointer_to_array:
; CHECK-NEXT: .int32 array+4
; CHECK-NEXT: .size pointer_to_array, 4
@array = internal constant [8 x i8] zeroinitializer, align 1
@pointer_to_array = constant i8* getelementptr inbounds ([8 x i8], [8 x i8]* @array, i32 0, i32 4), align 4