From 4e8d5fe51021e32450b35c7003f185dd1f56e11a Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Tue, 1 Sep 2009 22:06:53 +0000 Subject: [PATCH] X86/Encoding: Support ExternalSymbol operands in emitDisplacementField (for consistency). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80727 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86CodeEmitter.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/Target/X86/X86CodeEmitter.cpp b/lib/Target/X86/X86CodeEmitter.cpp index 7e2fd975c1c..6367623a01a 100644 --- a/lib/Target/X86/X86CodeEmitter.cpp +++ b/lib/Target/X86/X86CodeEmitter.cpp @@ -337,6 +337,11 @@ void Emitter::emitDisplacementField(const MachineOperand *RelocOp, bool Indirect = gvNeedsNonLazyPtr(*RelocOp, TM); emitGlobalAddress(RelocOp->getGlobal(), rt, RelocOp->getOffset(), Adj, NeedStub, Indirect); + } else if (RelocOp->isSymbol()) { + unsigned rt = Is64BitMode ? + (IsPCRel ? X86::reloc_pcrel_word : X86::reloc_absolute_word_sext) + : (IsPCRel ? X86::reloc_picrel_word : X86::reloc_absolute_word); + emitExternalSymbolAddress(RelocOp->getSymbolName(), rt); } else if (RelocOp->isCPI()) { unsigned rt = Is64BitMode ? (IsPCRel ? X86::reloc_pcrel_word : X86::reloc_absolute_word_sext) @@ -364,6 +369,8 @@ void Emitter::emitMemModRMByte(const MachineInstr &MI, // Figure out what sort of displacement we have to handle here. if (Op3.isGlobal()) { DispForReloc = &Op3; + } else if (Op3.isSymbol()) { + DispForReloc = &Op3; } else if (Op3.isCPI()) { if (!MCE.earlyResolveAddresses() || Is64BitMode || IsPIC) { DispForReloc = &Op3;