summaryrefslogtreecommitdiff
path: root/lib/MC/MCAssembler.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2010-12-17 21:49:48 +0000
committerOwen Anderson <resistor@mac.com>2010-12-17 21:49:48 +0000
commit175fb36f101a20df10db90bfe4d0c44a7d05325b (patch)
tree09c2c546474b81e51617499ddd053a3888a77d4e /lib/MC/MCAssembler.cpp
parentf5daf8bb7ff9539f7a6e0113609b39e4b9b64ff5 (diff)
downloadllvm-175fb36f101a20df10db90bfe4d0c44a7d05325b.tar.gz
llvm-175fb36f101a20df10db90bfe4d0c44a7d05325b.tar.bz2
llvm-175fb36f101a20df10db90bfe4d0c44a7d05325b.tar.xz
Thumb's forced-PC-alignment requirement applies to the _total_ displacement, not just to the fragment relative
portion. While the fragment boundary is usually already aligned, it is possible for it not to be, which would lead to a non-aligned final displacement. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122091 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCAssembler.cpp')
-rw-r--r--lib/MC/MCAssembler.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/MC/MCAssembler.cpp b/lib/MC/MCAssembler.cpp
index 0a9783d885..2d89fb3ed9 100644
--- a/lib/MC/MCAssembler.cpp
+++ b/lib/MC/MCAssembler.cpp
@@ -254,12 +254,12 @@ bool MCAssembler::EvaluateFixup(const MCAsmLayout &Layout,
"FKF_IsAlignedDownTo32Bits is only allowed on PC-relative fixups!");
if (IsPCRel) {
- uint32_t Offset = Fixup.getOffset();
+ uint32_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.
if (ShouldAlignPC) Offset &= ~0x3;
- Value -= Layout.getFragmentOffset(DF) + Offset;
+ Value -= Offset;
}
// ARM fixups based from a thumb function address need to have the low