diff options
author | Akira Hatanaka <ahatanaka@mips.com> | 2012-03-27 02:33:05 +0000 |
---|---|---|
committer | Akira Hatanaka <ahatanaka@mips.com> | 2012-03-27 02:33:05 +0000 |
commit | fe384a2c84fb9808be47c894bd445bc18891556a (patch) | |
tree | 968973a426433514724fd0f3a98f388e95f8517b /llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp | |
parent | a06bc1c6e31e37451dfcbc0a67618ad4168ead9a (diff) | |
download | bcm5719-llvm-fe384a2c84fb9808be47c894bd445bc18891556a.tar.gz bcm5719-llvm-fe384a2c84fb9808be47c894bd445bc18891556a.zip |
Retrieve and add the offset of a symbol in applyFixup rather than retrieve and
set it in MipsMCCodeEmitter::getMachineOpValue. Assert in getMachineOpValue if
MachineOperand MO is of an unexpected type.
llvm-svn: 153494
Diffstat (limited to 'llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp')
-rw-r--r-- | llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp index 6e8dacefe0e..ea86f48f09a 100644 --- a/llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp +++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// // +#include "MipsBaseInfo.h" #include "MipsFixupKinds.h" #include "MCTargetDesc/MipsMCTargetDesc.h" #include "llvm/MC/MCAsmBackend.h" @@ -82,8 +83,9 @@ public: uint64_t Value) const { MCFixupKind Kind = Fixup.getKind(); Value = adjustFixupValue((unsigned)Kind, Value); + int64_t SymOffset = MipsGetSymAndOffset(Fixup).second; - if (!Value) + if (!Value && !SymOffset) return; // Doesn't change encoding. // Where do we start in the object @@ -114,7 +116,7 @@ public: } uint64_t Mask = ((uint64_t)(-1) >> (64 - getFixupKindInfo(Kind).TargetSize)); - CurVal = (CurVal & ~Mask) | ((CurVal + Value) & Mask); + CurVal |= (Value + SymOffset) & Mask; // Write out the fixed up bytes back to the code/data bits. for (unsigned i = 0; i != NumBytes; ++i) { |