diff --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp --- a/llvm/lib/MC/MCAssembler.cpp +++ b/llvm/lib/MC/MCAssembler.cpp @@ -273,7 +273,7 @@ "FKF_IsAlignedDownTo32Bits is only allowed on PC-relative fixups!"); if (IsPCRel) { - uint32_t Offset = Layout.getFragmentOffset(DF) + Fixup.getOffset(); + uint64_t Offset = Layout.getFragmentOffset(DF) + Fixup.getOffset(); // A number of ARM fixups in Thumb mode require that the effective PC // address be determined as the 32-bit aligned version of the actual offset. diff --git a/llvm/test/MC/AArch64/fixup-out-of-range-64-bit.s b/llvm/test/MC/AArch64/fixup-out-of-range-64-bit.s new file mode 100644 --- /dev/null +++ b/llvm/test/MC/AArch64/fixup-out-of-range-64-bit.s @@ -0,0 +1,10 @@ +// RUN: not llvm-mc -triple aarch64--none-eabi -filetype obj < %s -o /dev/null 2>&1 | FileCheck %s + +distant: + .byte 0 + + .space 1<<32 + .balign 8 + +// CHECK: :[[@LINE+1]]:{{[0-9]+}}: error: fixup value out of range + b distant \ No newline at end of file