X86: Rename X86MCExpr::VK_ to X86::S_
Rename these relocation specifier constants, aligning with the naming convention used by other targets (`S_` instead of `VK_`). Move constants to X86MCAsmInfo.h, with the goal of eventually removing X86MCExpr.h. Similar to #144633 for AArch64.
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include "MCTargetDesc/X86BaseInfo.h"
|
||||
#include "MCTargetDesc/X86EncodingOptimization.h"
|
||||
#include "MCTargetDesc/X86IntelInstPrinter.h"
|
||||
#include "MCTargetDesc/X86MCAsmInfo.h"
|
||||
#include "MCTargetDesc/X86MCExpr.h"
|
||||
#include "MCTargetDesc/X86MCTargetDesc.h"
|
||||
#include "MCTargetDesc/X86TargetStreamer.h"
|
||||
@@ -2118,7 +2119,7 @@ bool X86AsmParser::ParseIntelExpression(IntelExprStateMachine &SM, SMLoc &End) {
|
||||
if (IDVal == "f" || IDVal == "b") {
|
||||
MCSymbol *Sym =
|
||||
getContext().getDirectionalLocalSymbol(IntVal, IDVal == "b");
|
||||
auto Variant = X86MCExpr::VK_None;
|
||||
auto Variant = X86::S_None;
|
||||
const MCExpr *Val =
|
||||
MCSymbolRefExpr::create(Sym, Variant, getContext());
|
||||
if (IDVal == "b" && Sym->isUndefined())
|
||||
@@ -2265,7 +2266,7 @@ bool X86AsmParser::ParseIntelInlineAsmIdentifier(
|
||||
return false;
|
||||
// Create the symbol reference.
|
||||
MCSymbol *Sym = getContext().getOrCreateSymbol(Identifier);
|
||||
auto Variant = X86MCExpr::VK_None;
|
||||
auto Variant = X86::S_None;
|
||||
Val = MCSymbolRefExpr::create(Sym, Variant, getParser().getContext());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "MCTargetDesc/X86BaseInfo.h"
|
||||
#include "MCTargetDesc/X86EncodingOptimization.h"
|
||||
#include "MCTargetDesc/X86FixupKinds.h"
|
||||
#include "MCTargetDesc/X86MCExpr.h"
|
||||
#include "MCTargetDesc/X86MCAsmInfo.h"
|
||||
#include "llvm/ADT/StringSwitch.h"
|
||||
#include "llvm/BinaryFormat/ELF.h"
|
||||
#include "llvm/BinaryFormat/MachO.h"
|
||||
@@ -359,7 +359,7 @@ static bool hasVariantSymbol(const MCInst &MI) {
|
||||
continue;
|
||||
const MCExpr &Expr = *Operand.getExpr();
|
||||
if (Expr.getKind() == MCExpr::SymbolRef &&
|
||||
getSpecifier(cast<MCSymbolRefExpr>(&Expr)) != X86MCExpr::VK_None)
|
||||
cast<MCSymbolRefExpr>(&Expr)->getSpecifier())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -748,7 +748,7 @@ bool X86AsmBackend::fixupNeedsRelaxationAdvanced(const MCFixup &Fixup,
|
||||
|
||||
// Otherwise, relax unless there is a @ABS8 specifier.
|
||||
if (Fixup.getKind() == FK_Data_1 && Target.getAddSym() &&
|
||||
Target.getSpecifier() == X86MCExpr::VK_ABS8)
|
||||
Target.getSpecifier() == X86::S_ABS8)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "MCTargetDesc/X86FixupKinds.h"
|
||||
#include "MCTargetDesc/X86MCExpr.h"
|
||||
#include "MCTargetDesc/X86MCAsmInfo.h"
|
||||
#include "MCTargetDesc/X86MCTargetDesc.h"
|
||||
#include "llvm/BinaryFormat/ELF.h"
|
||||
#include "llvm/MC/MCAsmInfo.h"
|
||||
@@ -39,10 +39,10 @@ protected:
|
||||
|
||||
void checkIs32(SMLoc Loc, X86_64RelType Type) const;
|
||||
void checkIs64(SMLoc Loc, X86_64RelType Type) const;
|
||||
unsigned getRelocType32(SMLoc Loc, X86MCExpr::Specifier Specifier,
|
||||
unsigned getRelocType32(SMLoc Loc, X86::Specifier Specifier,
|
||||
X86_32RelType Type, bool IsPCRel,
|
||||
MCFixupKind Kind) const;
|
||||
unsigned getRelocType64(SMLoc Loc, X86MCExpr::Specifier Specifier,
|
||||
unsigned getRelocType64(SMLoc Loc, X86::Specifier Specifier,
|
||||
X86_64RelType Type, bool IsPCRel,
|
||||
MCFixupKind Kind) const;
|
||||
};
|
||||
@@ -57,8 +57,8 @@ X86ELFObjectWriter::X86ELFObjectWriter(bool IsELF64, uint8_t OSABI,
|
||||
(EMachine != ELF::EM_386) &&
|
||||
(EMachine != ELF::EM_IAMCU)) {}
|
||||
|
||||
static X86_64RelType getType64(MCFixupKind Kind,
|
||||
X86MCExpr::Specifier &Specifier, bool &IsPCRel) {
|
||||
static X86_64RelType getType64(MCFixupKind Kind, X86::Specifier &Specifier,
|
||||
bool &IsPCRel) {
|
||||
switch (unsigned(Kind)) {
|
||||
default:
|
||||
llvm_unreachable("Unimplemented");
|
||||
@@ -68,11 +68,11 @@ static X86_64RelType getType64(MCFixupKind Kind,
|
||||
return RT64_64;
|
||||
case X86::reloc_signed_4byte:
|
||||
case X86::reloc_signed_4byte_relax:
|
||||
if (Specifier == X86MCExpr::VK_None && !IsPCRel)
|
||||
if (Specifier == X86::S_None && !IsPCRel)
|
||||
return RT64_32S;
|
||||
return RT64_32;
|
||||
case X86::reloc_global_offset_table:
|
||||
Specifier = X86MCExpr::VK_GOT;
|
||||
Specifier = X86::S_GOT;
|
||||
IsPCRel = true;
|
||||
return RT64_32;
|
||||
case FK_Data_4:
|
||||
@@ -86,7 +86,7 @@ static X86_64RelType getType64(MCFixupKind Kind,
|
||||
case X86::reloc_riprel_4byte_relax_evex:
|
||||
return RT64_32;
|
||||
case X86::reloc_branch_4byte_pcrel:
|
||||
Specifier = X86MCExpr::VK_PLT;
|
||||
Specifier = X86::S_PLT;
|
||||
return RT64_32;
|
||||
case FK_PCRel_2:
|
||||
case FK_Data_2:
|
||||
@@ -107,18 +107,17 @@ void X86ELFObjectWriter::checkIs64(SMLoc Loc, X86_64RelType Type) const {
|
||||
reportError(Loc, "64 bit reloc applied to a field with a different size");
|
||||
}
|
||||
|
||||
unsigned X86ELFObjectWriter::getRelocType64(SMLoc Loc,
|
||||
X86MCExpr::Specifier Specifier,
|
||||
unsigned X86ELFObjectWriter::getRelocType64(SMLoc Loc, X86::Specifier Specifier,
|
||||
X86_64RelType Type, bool IsPCRel,
|
||||
MCFixupKind Kind) const {
|
||||
switch (Specifier) {
|
||||
default:
|
||||
llvm_unreachable("Unimplemented");
|
||||
case X86MCExpr::VK_None:
|
||||
case X86MCExpr::VK_ABS8:
|
||||
case X86::S_None:
|
||||
case X86::S_ABS8:
|
||||
switch (Type) {
|
||||
case RT64_NONE:
|
||||
if (Specifier == X86MCExpr::VK_None)
|
||||
if (Specifier == X86::S_None)
|
||||
return ELF::R_X86_64_NONE;
|
||||
llvm_unreachable("Unimplemented");
|
||||
case RT64_64:
|
||||
@@ -133,7 +132,7 @@ unsigned X86ELFObjectWriter::getRelocType64(SMLoc Loc,
|
||||
return IsPCRel ? ELF::R_X86_64_PC8 : ELF::R_X86_64_8;
|
||||
}
|
||||
llvm_unreachable("unexpected relocation type!");
|
||||
case X86MCExpr::VK_GOT:
|
||||
case X86::S_GOT:
|
||||
switch (Type) {
|
||||
case RT64_64:
|
||||
return IsPCRel ? ELF::R_X86_64_GOTPC64 : ELF::R_X86_64_GOT64;
|
||||
@@ -146,12 +145,12 @@ unsigned X86ELFObjectWriter::getRelocType64(SMLoc Loc,
|
||||
llvm_unreachable("Unimplemented");
|
||||
}
|
||||
llvm_unreachable("unexpected relocation type!");
|
||||
case X86MCExpr::VK_GOTOFF:
|
||||
case X86::S_GOTOFF:
|
||||
assert(!IsPCRel);
|
||||
if (Type != RT64_64)
|
||||
reportError(Loc, "unsupported relocation type");
|
||||
return ELF::R_X86_64_GOTOFF64;
|
||||
case X86MCExpr::VK_TPOFF:
|
||||
case X86::S_TPOFF:
|
||||
assert(!IsPCRel);
|
||||
switch (Type) {
|
||||
case RT64_64:
|
||||
@@ -165,7 +164,7 @@ unsigned X86ELFObjectWriter::getRelocType64(SMLoc Loc,
|
||||
llvm_unreachable("Unimplemented");
|
||||
}
|
||||
llvm_unreachable("unexpected relocation type!");
|
||||
case X86MCExpr::VK_DTPOFF:
|
||||
case X86::S_DTPOFF:
|
||||
assert(!IsPCRel);
|
||||
switch (Type) {
|
||||
case RT64_64:
|
||||
@@ -179,7 +178,7 @@ unsigned X86ELFObjectWriter::getRelocType64(SMLoc Loc,
|
||||
llvm_unreachable("Unimplemented");
|
||||
}
|
||||
llvm_unreachable("unexpected relocation type!");
|
||||
case X86MCExpr::VK_SIZE:
|
||||
case X86::S_SIZE:
|
||||
assert(!IsPCRel);
|
||||
switch (Type) {
|
||||
case RT64_64:
|
||||
@@ -193,16 +192,16 @@ unsigned X86ELFObjectWriter::getRelocType64(SMLoc Loc,
|
||||
llvm_unreachable("Unimplemented");
|
||||
}
|
||||
llvm_unreachable("unexpected relocation type!");
|
||||
case X86MCExpr::VK_TLSCALL:
|
||||
case X86::S_TLSCALL:
|
||||
return ELF::R_X86_64_TLSDESC_CALL;
|
||||
case X86MCExpr::VK_TLSDESC:
|
||||
case X86::S_TLSDESC:
|
||||
return ((unsigned)Kind == X86::reloc_riprel_4byte_relax_rex2)
|
||||
? ELF::R_X86_64_CODE_4_GOTPC32_TLSDESC
|
||||
: ELF::R_X86_64_GOTPC32_TLSDESC;
|
||||
case X86MCExpr::VK_TLSGD:
|
||||
case X86::S_TLSGD:
|
||||
checkIs32(Loc, Type);
|
||||
return ELF::R_X86_64_TLSGD;
|
||||
case X86MCExpr::VK_GOTTPOFF:
|
||||
case X86::S_GOTTPOFF:
|
||||
checkIs32(Loc, Type);
|
||||
if ((unsigned)Kind == X86::reloc_riprel_4byte_movq_load_rex2 ||
|
||||
(unsigned)Kind == X86::reloc_riprel_4byte_relax_rex2)
|
||||
@@ -210,13 +209,13 @@ unsigned X86ELFObjectWriter::getRelocType64(SMLoc Loc,
|
||||
else if ((unsigned)Kind == X86::reloc_riprel_4byte_relax_evex)
|
||||
return ELF::R_X86_64_CODE_6_GOTTPOFF;
|
||||
return ELF::R_X86_64_GOTTPOFF;
|
||||
case X86MCExpr::VK_TLSLD:
|
||||
case X86::S_TLSLD:
|
||||
checkIs32(Loc, Type);
|
||||
return ELF::R_X86_64_TLSLD;
|
||||
case X86MCExpr::VK_PLT:
|
||||
case X86::S_PLT:
|
||||
checkIs32(Loc, Type);
|
||||
return ELF::R_X86_64_PLT32;
|
||||
case X86MCExpr::VK_GOTPCREL:
|
||||
case X86::S_GOTPCREL:
|
||||
checkIs32(Loc, Type);
|
||||
// Older versions of ld.bfd/ld.gold/lld
|
||||
// do not support GOTPCRELX/REX_GOTPCRELX/CODE_4_GOTPCRELX,
|
||||
@@ -236,27 +235,26 @@ unsigned X86ELFObjectWriter::getRelocType64(SMLoc Loc,
|
||||
return ELF::R_X86_64_CODE_4_GOTPCRELX;
|
||||
}
|
||||
llvm_unreachable("unexpected relocation type!");
|
||||
case X86MCExpr::VK_GOTPCREL_NORELAX:
|
||||
case X86::S_GOTPCREL_NORELAX:
|
||||
checkIs32(Loc, Type);
|
||||
return ELF::R_X86_64_GOTPCREL;
|
||||
case X86MCExpr::VK_PLTOFF:
|
||||
case X86::S_PLTOFF:
|
||||
checkIs64(Loc, Type);
|
||||
return ELF::R_X86_64_PLTOFF64;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned X86ELFObjectWriter::getRelocType32(SMLoc Loc,
|
||||
X86MCExpr::Specifier Specifier,
|
||||
unsigned X86ELFObjectWriter::getRelocType32(SMLoc Loc, X86::Specifier Specifier,
|
||||
X86_32RelType Type, bool IsPCRel,
|
||||
MCFixupKind Kind) const {
|
||||
switch (Specifier) {
|
||||
default:
|
||||
llvm_unreachable("Unimplemented");
|
||||
case X86MCExpr::VK_None:
|
||||
case X86MCExpr::VK_ABS8:
|
||||
case X86::S_None:
|
||||
case X86::S_ABS8:
|
||||
switch (Type) {
|
||||
case RT32_NONE:
|
||||
if (Specifier == X86MCExpr::VK_None)
|
||||
if (Specifier == X86::S_None)
|
||||
return ELF::R_386_NONE;
|
||||
llvm_unreachable("Unimplemented");
|
||||
case RT32_32:
|
||||
@@ -267,7 +265,7 @@ unsigned X86ELFObjectWriter::getRelocType32(SMLoc Loc,
|
||||
return IsPCRel ? ELF::R_386_PC8 : ELF::R_386_8;
|
||||
}
|
||||
llvm_unreachable("unexpected relocation type!");
|
||||
case X86MCExpr::VK_GOT:
|
||||
case X86::S_GOT:
|
||||
if (Type != RT32_32)
|
||||
break;
|
||||
if (IsPCRel)
|
||||
@@ -280,55 +278,55 @@ unsigned X86ELFObjectWriter::getRelocType32(SMLoc Loc,
|
||||
return Kind == MCFixupKind(X86::reloc_signed_4byte_relax)
|
||||
? ELF::R_386_GOT32X
|
||||
: ELF::R_386_GOT32;
|
||||
case X86MCExpr::VK_GOTOFF:
|
||||
case X86::S_GOTOFF:
|
||||
assert(!IsPCRel);
|
||||
if (Type != RT32_32)
|
||||
break;
|
||||
return ELF::R_386_GOTOFF;
|
||||
case X86MCExpr::VK_TLSCALL:
|
||||
case X86::S_TLSCALL:
|
||||
return ELF::R_386_TLS_DESC_CALL;
|
||||
case X86MCExpr::VK_TLSDESC:
|
||||
case X86::S_TLSDESC:
|
||||
return ELF::R_386_TLS_GOTDESC;
|
||||
case X86MCExpr::VK_TPOFF:
|
||||
case X86::S_TPOFF:
|
||||
if (Type != RT32_32)
|
||||
break;
|
||||
assert(!IsPCRel);
|
||||
return ELF::R_386_TLS_LE_32;
|
||||
case X86MCExpr::VK_DTPOFF:
|
||||
case X86::S_DTPOFF:
|
||||
if (Type != RT32_32)
|
||||
break;
|
||||
assert(!IsPCRel);
|
||||
return ELF::R_386_TLS_LDO_32;
|
||||
case X86MCExpr::VK_TLSGD:
|
||||
case X86::S_TLSGD:
|
||||
if (Type != RT32_32)
|
||||
break;
|
||||
assert(!IsPCRel);
|
||||
return ELF::R_386_TLS_GD;
|
||||
case X86MCExpr::VK_GOTTPOFF:
|
||||
case X86::S_GOTTPOFF:
|
||||
if (Type != RT32_32)
|
||||
break;
|
||||
assert(!IsPCRel);
|
||||
return ELF::R_386_TLS_IE_32;
|
||||
case X86MCExpr::VK_PLT:
|
||||
case X86::S_PLT:
|
||||
if (Type != RT32_32)
|
||||
break;
|
||||
return ELF::R_386_PLT32;
|
||||
case X86MCExpr::VK_INDNTPOFF:
|
||||
case X86::S_INDNTPOFF:
|
||||
if (Type != RT32_32)
|
||||
break;
|
||||
assert(!IsPCRel);
|
||||
return ELF::R_386_TLS_IE;
|
||||
case X86MCExpr::VK_NTPOFF:
|
||||
case X86::S_NTPOFF:
|
||||
if (Type != RT32_32)
|
||||
break;
|
||||
assert(!IsPCRel);
|
||||
return ELF::R_386_TLS_LE;
|
||||
case X86MCExpr::VK_GOTNTPOFF:
|
||||
case X86::S_GOTNTPOFF:
|
||||
if (Type != RT32_32)
|
||||
break;
|
||||
assert(!IsPCRel);
|
||||
return ELF::R_386_TLS_GOTIE;
|
||||
case X86MCExpr::VK_TLSLDM:
|
||||
case X86::S_TLSLDM:
|
||||
if (Type != RT32_32)
|
||||
break;
|
||||
assert(!IsPCRel);
|
||||
@@ -342,19 +340,19 @@ unsigned X86ELFObjectWriter::getRelocType(const MCFixup &Fixup,
|
||||
const MCValue &Target,
|
||||
bool IsPCRel) const {
|
||||
MCFixupKind Kind = Fixup.getKind();
|
||||
auto Specifier = X86MCExpr::Specifier(Target.getSpecifier());
|
||||
auto Specifier = X86::Specifier(Target.getSpecifier());
|
||||
switch (Specifier) {
|
||||
case X86MCExpr::VK_GOTTPOFF:
|
||||
case X86MCExpr::VK_INDNTPOFF:
|
||||
case X86MCExpr::VK_NTPOFF:
|
||||
case X86MCExpr::VK_GOTNTPOFF:
|
||||
case X86MCExpr::VK_TLSCALL:
|
||||
case X86MCExpr::VK_TLSDESC:
|
||||
case X86MCExpr::VK_TLSGD:
|
||||
case X86MCExpr::VK_TLSLD:
|
||||
case X86MCExpr::VK_TLSLDM:
|
||||
case X86MCExpr::VK_TPOFF:
|
||||
case X86MCExpr::VK_DTPOFF:
|
||||
case X86::S_GOTTPOFF:
|
||||
case X86::S_INDNTPOFF:
|
||||
case X86::S_NTPOFF:
|
||||
case X86::S_GOTNTPOFF:
|
||||
case X86::S_TLSCALL:
|
||||
case X86::S_TLSDESC:
|
||||
case X86::S_TLSGD:
|
||||
case X86::S_TLSLD:
|
||||
case X86::S_TLSLDM:
|
||||
case X86::S_TPOFF:
|
||||
case X86::S_DTPOFF:
|
||||
if (auto *S = Target.getAddSym())
|
||||
cast<MCSymbolELF>(S)->setType(ELF::STT_TLS);
|
||||
break;
|
||||
@@ -393,10 +391,10 @@ unsigned X86ELFObjectWriter::getRelocType(const MCFixup &Fixup,
|
||||
bool X86ELFObjectWriter::needsRelocateWithSymbol(const MCValue &V,
|
||||
unsigned Type) const {
|
||||
switch (V.getSpecifier()) {
|
||||
case X86MCExpr::VK_GOT:
|
||||
case X86MCExpr::VK_PLT:
|
||||
case X86MCExpr::VK_GOTPCREL:
|
||||
case X86MCExpr::VK_GOTPCREL_NORELAX:
|
||||
case X86::S_GOT:
|
||||
case X86::S_PLT:
|
||||
case X86::S_GOTPCREL:
|
||||
case X86::S_GOTPCREL_NORELAX:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "X86EncodingOptimization.h"
|
||||
#include "MCTargetDesc/X86MCExpr.h"
|
||||
#include "MCTargetDesc/X86MCAsmInfo.h"
|
||||
#include "X86BaseInfo.h"
|
||||
#include "llvm/MC/MCExpr.h"
|
||||
#include "llvm/MC/MCInst.h"
|
||||
@@ -375,7 +375,7 @@ bool X86::optimizeMOV(MCInst &MI, bool In64BitMode) {
|
||||
if (MI.getOperand(AddrOp).isExpr()) {
|
||||
const MCExpr *MCE = MI.getOperand(AddrOp).getExpr();
|
||||
if (const MCSymbolRefExpr *SRE = dyn_cast<MCSymbolRefExpr>(MCE))
|
||||
if (getSpecifier(SRE) == X86MCExpr::VK_TLVP)
|
||||
if (SRE->getSpecifier() == X86::S_TLVP)
|
||||
Absolute = false;
|
||||
}
|
||||
if (Absolute && (MI.getOperand(AddrBase + X86::AddrBaseReg).getReg() ||
|
||||
@@ -486,7 +486,7 @@ static bool optimizeToShortImmediateForm(MCInst &MI) {
|
||||
MCOperand &LastOp = MI.getOperand(MI.getNumOperands() - 1 - SkipOperands);
|
||||
if (LastOp.isExpr()) {
|
||||
const MCSymbolRefExpr *SRE = dyn_cast<MCSymbolRefExpr>(LastOp.getExpr());
|
||||
if (!SRE || getSpecifier(SRE) != X86MCExpr::VK_ABS8)
|
||||
if (!SRE || SRE->getSpecifier() != X86::S_ABS8)
|
||||
return false;
|
||||
} else if (LastOp.isImm()) {
|
||||
if (!isInt<8>(LastOp.getImm()))
|
||||
|
||||
@@ -36,34 +36,34 @@ MarkedJTDataRegions("mark-data-regions", cl::init(true),
|
||||
cl::Hidden);
|
||||
|
||||
const MCAsmInfo::AtSpecifier atSpecifiers[] = {
|
||||
{X86MCExpr::VK_ABS8, "ABS8"},
|
||||
{X86MCExpr::VK_DTPOFF, "DTPOFF"},
|
||||
{X86MCExpr::VK_DTPREL, "DTPREL"},
|
||||
{X86MCExpr::VK_GOT, "GOT"},
|
||||
{X86MCExpr::VK_GOTENT, "GOTENT"},
|
||||
{X86MCExpr::VK_GOTNTPOFF, "GOTNTPOFF"},
|
||||
{X86MCExpr::VK_GOTOFF, "GOTOFF"},
|
||||
{X86MCExpr::VK_GOTPCREL, "GOTPCREL"},
|
||||
{X86MCExpr::VK_GOTPCREL_NORELAX, "GOTPCREL_NORELAX"},
|
||||
{X86MCExpr::VK_GOTREL, "GOTREL"},
|
||||
{X86MCExpr::VK_GOTTPOFF, "GOTTPOFF"},
|
||||
{X86MCExpr::VK_INDNTPOFF, "INDNTPOFF"},
|
||||
{X86::S_ABS8, "ABS8"},
|
||||
{X86::S_DTPOFF, "DTPOFF"},
|
||||
{X86::S_DTPREL, "DTPREL"},
|
||||
{X86::S_GOT, "GOT"},
|
||||
{X86::S_GOTENT, "GOTENT"},
|
||||
{X86::S_GOTNTPOFF, "GOTNTPOFF"},
|
||||
{X86::S_GOTOFF, "GOTOFF"},
|
||||
{X86::S_GOTPCREL, "GOTPCREL"},
|
||||
{X86::S_GOTPCREL_NORELAX, "GOTPCREL_NORELAX"},
|
||||
{X86::S_GOTREL, "GOTREL"},
|
||||
{X86::S_GOTTPOFF, "GOTTPOFF"},
|
||||
{X86::S_INDNTPOFF, "INDNTPOFF"},
|
||||
{MCSymbolRefExpr::VK_COFF_IMGREL32, "IMGREL"},
|
||||
{X86MCExpr::VK_NTPOFF, "NTPOFF"},
|
||||
{X86MCExpr::VK_PCREL, "PCREL"},
|
||||
{X86MCExpr::VK_PLT, "PLT"},
|
||||
{X86MCExpr::VK_PLTOFF, "PLTOFF"},
|
||||
{X86::S_NTPOFF, "NTPOFF"},
|
||||
{X86::S_PCREL, "PCREL"},
|
||||
{X86::S_PLT, "PLT"},
|
||||
{X86::S_PLTOFF, "PLTOFF"},
|
||||
{MCSymbolRefExpr::VK_SECREL, "SECREL32"},
|
||||
{X86MCExpr::VK_SIZE, "SIZE"},
|
||||
{X86MCExpr::VK_TLSCALL, "tlscall"},
|
||||
{X86MCExpr::VK_TLSDESC, "tlsdesc"},
|
||||
{X86MCExpr::VK_TLSGD, "TLSGD"},
|
||||
{X86MCExpr::VK_TLSLD, "TLSLD"},
|
||||
{X86MCExpr::VK_TLSLDM, "TLSLDM"},
|
||||
{X86MCExpr::VK_TLVP, "TLVP"},
|
||||
{X86MCExpr::VK_TLVPPAGE, "TLVPPAGE"},
|
||||
{X86MCExpr::VK_TLVPPAGEOFF, "TLVPPAGEOFF"},
|
||||
{X86MCExpr::VK_TPOFF, "TPOFF"},
|
||||
{X86::S_SIZE, "SIZE"},
|
||||
{X86::S_TLSCALL, "tlscall"},
|
||||
{X86::S_TLSDESC, "tlsdesc"},
|
||||
{X86::S_TLSGD, "TLSGD"},
|
||||
{X86::S_TLSLD, "TLSLD"},
|
||||
{X86::S_TLSLDM, "TLSLDM"},
|
||||
{X86::S_TLVP, "TLVP"},
|
||||
{X86::S_TLVPPAGE, "TLVPPAGE"},
|
||||
{X86::S_TLVPPAGEOFF, "TLVPPAGEOFF"},
|
||||
{X86::S_TPOFF, "TPOFF"},
|
||||
};
|
||||
|
||||
void X86MCAsmInfoDarwin::anchor() { }
|
||||
@@ -139,8 +139,7 @@ X86_64MCAsmInfoDarwin::getExprForPersonalitySymbol(const MCSymbol *Sym,
|
||||
unsigned Encoding,
|
||||
MCStreamer &Streamer) const {
|
||||
MCContext &Context = Streamer.getContext();
|
||||
const MCExpr *Res =
|
||||
MCSymbolRefExpr::create(Sym, X86MCExpr::VK_GOTPCREL, Context);
|
||||
const MCExpr *Res = MCSymbolRefExpr::create(Sym, X86::S_GOTPCREL, Context);
|
||||
const MCExpr *Four = MCConstantExpr::create(4, Context);
|
||||
return MCBinaryExpr::createAdd(Res, Four, Context);
|
||||
}
|
||||
|
||||
@@ -13,9 +13,11 @@
|
||||
#ifndef LLVM_LIB_TARGET_X86_MCTARGETDESC_X86MCASMINFO_H
|
||||
#define LLVM_LIB_TARGET_X86_MCTARGETDESC_X86MCASMINFO_H
|
||||
|
||||
#include "MCTargetDesc/X86MCExpr.h"
|
||||
#include "llvm/MC/MCAsmInfoCOFF.h"
|
||||
#include "llvm/MC/MCAsmInfoDarwin.h"
|
||||
#include "llvm/MC/MCAsmInfoELF.h"
|
||||
#include "llvm/MC/MCExpr.h"
|
||||
|
||||
namespace llvm {
|
||||
class Triple;
|
||||
@@ -61,6 +63,41 @@ class X86MCAsmInfoGNUCOFF : public MCAsmInfoGNUCOFF {
|
||||
public:
|
||||
explicit X86MCAsmInfoGNUCOFF(const Triple &Triple);
|
||||
};
|
||||
|
||||
namespace X86 {
|
||||
using Specifier = uint16_t;
|
||||
|
||||
enum {
|
||||
S_None,
|
||||
|
||||
S_ABS8 = MCSymbolRefExpr::FirstTargetSpecifier,
|
||||
S_DTPOFF,
|
||||
S_DTPREL,
|
||||
S_GOT,
|
||||
S_GOTENT,
|
||||
S_GOTNTPOFF,
|
||||
S_GOTOFF,
|
||||
S_GOTPCREL,
|
||||
S_GOTPCREL_NORELAX,
|
||||
S_GOTREL,
|
||||
S_GOTTPOFF,
|
||||
S_INDNTPOFF,
|
||||
S_NTPOFF,
|
||||
S_PCREL,
|
||||
S_PLT,
|
||||
S_PLTOFF,
|
||||
S_SIZE,
|
||||
S_TLSCALL,
|
||||
S_TLSDESC,
|
||||
S_TLSGD,
|
||||
S_TLSLD,
|
||||
S_TLSLDM,
|
||||
S_TLVP,
|
||||
S_TLVPPAGE,
|
||||
S_TLVPPAGEOFF,
|
||||
S_TPOFF,
|
||||
};
|
||||
} // namespace X86
|
||||
} // namespace llvm
|
||||
|
||||
#endif
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
#include "MCTargetDesc/X86BaseInfo.h"
|
||||
#include "MCTargetDesc/X86FixupKinds.h"
|
||||
#include "MCTargetDesc/X86MCExpr.h"
|
||||
#include "MCTargetDesc/X86MCAsmInfo.h"
|
||||
#include "MCTargetDesc/X86MCTargetDesc.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/BinaryFormat/ELF.h"
|
||||
@@ -515,7 +515,7 @@ static bool isPCRel32Branch(const MCInst &MI, const MCInstrInfo &MCII) {
|
||||
return false;
|
||||
|
||||
auto *Ref = dyn_cast<MCSymbolRefExpr>(Op.getExpr());
|
||||
return Ref && getSpecifier(Ref) == X86MCExpr::VK_None;
|
||||
return Ref && Ref->getSpecifier() == X86::S_None;
|
||||
}
|
||||
|
||||
unsigned X86MCCodeEmitter::getX86RegNum(const MCOperand &MO) const {
|
||||
@@ -809,7 +809,7 @@ void X86MCCodeEmitter::emitMemModRMByte(
|
||||
// If the displacement is @tlscall, treat it as a zero.
|
||||
if (Disp.isExpr()) {
|
||||
auto *Sym = dyn_cast<MCSymbolRefExpr>(Disp.getExpr());
|
||||
if (Sym && getSpecifier(Sym) == X86MCExpr::VK_TLSCALL) {
|
||||
if (Sym && Sym->getSpecifier() == X86::S_TLSCALL) {
|
||||
// This is exclusively used by call *a@tlscall(base). The relocation
|
||||
// (R_386_TLSCALL or R_X86_64_TLSCALL) applies to the beginning.
|
||||
Fixups.push_back(MCFixup::create(0, Sym, FK_NONE, MI.getLoc()));
|
||||
@@ -1385,8 +1385,8 @@ PrefixKind X86MCCodeEmitter::emitREXPrefix(int MemOperand, const MCInst &MI,
|
||||
// handled as a special case here so that it also works for hand-written
|
||||
// assembly without the user needing to write REX, as with GNU as.
|
||||
const auto *Ref = dyn_cast<MCSymbolRefExpr>(MO.getExpr());
|
||||
if (Ref && (getSpecifier(Ref) == X86MCExpr::VK_GOTTPOFF ||
|
||||
getSpecifier(Ref) == X86MCExpr::VK_TLSDESC)) {
|
||||
if (Ref && (Ref->getSpecifier() == X86::S_GOTTPOFF ||
|
||||
Ref->getSpecifier() == X86::S_TLSDESC)) {
|
||||
Prefix.setLowerBound(REX);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,54 +31,13 @@ private:
|
||||
explicit X86MCExpr(MCRegister R) : Reg(R) {}
|
||||
|
||||
public:
|
||||
// Relocation specifier. Named VK_ for legacy reasons.
|
||||
enum Specifier {
|
||||
VK_None,
|
||||
|
||||
VK_ABS8 = MCSymbolRefExpr::FirstTargetSpecifier,
|
||||
VK_DTPOFF,
|
||||
VK_DTPREL,
|
||||
VK_GOT,
|
||||
VK_GOTENT,
|
||||
VK_GOTNTPOFF,
|
||||
VK_GOTOFF,
|
||||
VK_GOTPCREL,
|
||||
VK_GOTPCREL_NORELAX,
|
||||
VK_GOTREL,
|
||||
VK_GOTTPOFF,
|
||||
VK_INDNTPOFF,
|
||||
VK_NTPOFF,
|
||||
VK_PCREL,
|
||||
VK_PLT,
|
||||
VK_PLTOFF,
|
||||
VK_SIZE,
|
||||
VK_TLSCALL,
|
||||
VK_TLSDESC,
|
||||
VK_TLSGD,
|
||||
VK_TLSLD,
|
||||
VK_TLSLDM,
|
||||
VK_TLVP,
|
||||
VK_TLVPPAGE,
|
||||
VK_TLVPPAGEOFF,
|
||||
VK_TPOFF,
|
||||
};
|
||||
|
||||
/// @name Construction
|
||||
/// @{
|
||||
|
||||
static const X86MCExpr *create(MCRegister Reg, MCContext &Ctx) {
|
||||
return new (Ctx) X86MCExpr(Reg);
|
||||
}
|
||||
|
||||
/// @}
|
||||
/// @name Accessors
|
||||
/// @{
|
||||
|
||||
/// getSubExpr - Get the child of this expression.
|
||||
MCRegister getReg() const { return Reg; }
|
||||
|
||||
/// @}
|
||||
|
||||
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override {
|
||||
if (!MAI || MAI->getAssemblerDialect() == 0)
|
||||
OS << '%';
|
||||
@@ -103,10 +62,6 @@ public:
|
||||
return E->getKind() == MCExpr::Target;
|
||||
}
|
||||
};
|
||||
|
||||
static inline X86MCExpr::Specifier getSpecifier(const MCSymbolRefExpr *SRE) {
|
||||
return X86MCExpr::Specifier(SRE->getKind());
|
||||
}
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "MCTargetDesc/X86FixupKinds.h"
|
||||
#include "MCTargetDesc/X86MCExpr.h"
|
||||
#include "MCTargetDesc/X86MCAsmInfo.h"
|
||||
#include "MCTargetDesc/X86MCTargetDesc.h"
|
||||
#include "llvm/ADT/Twine.h"
|
||||
#include "llvm/BinaryFormat/MachO.h"
|
||||
@@ -257,7 +257,7 @@ void X86MachObjectWriter::RecordX86_64Relocation(
|
||||
auto Specifier = Target.getSpecifier();
|
||||
if (IsPCRel) {
|
||||
if (IsRIPRel) {
|
||||
if (Specifier == X86MCExpr::VK_GOTPCREL) {
|
||||
if (Specifier == X86::S_GOTPCREL) {
|
||||
// x86_64 distinguishes movq foo@GOTPCREL so that the linker can
|
||||
// rewrite the movq to an leaq at link time if the symbol ends up in
|
||||
// the same linkage unit.
|
||||
@@ -265,7 +265,7 @@ void X86MachObjectWriter::RecordX86_64Relocation(
|
||||
Type = MachO::X86_64_RELOC_GOT_LOAD;
|
||||
else
|
||||
Type = MachO::X86_64_RELOC_GOT;
|
||||
} else if (Specifier == X86MCExpr::VK_TLVP) {
|
||||
} else if (Specifier == X86::S_TLVP) {
|
||||
Type = MachO::X86_64_RELOC_TLV;
|
||||
} else if (Specifier) {
|
||||
reportError(Fixup.getLoc(),
|
||||
@@ -304,16 +304,16 @@ void X86MachObjectWriter::RecordX86_64Relocation(
|
||||
Type = MachO::X86_64_RELOC_BRANCH;
|
||||
}
|
||||
} else {
|
||||
if (Specifier == X86MCExpr::VK_GOT) {
|
||||
if (Specifier == X86::S_GOT) {
|
||||
Type = MachO::X86_64_RELOC_GOT;
|
||||
} else if (Specifier == X86MCExpr::VK_GOTPCREL) {
|
||||
} else if (Specifier == X86::S_GOTPCREL) {
|
||||
// GOTPCREL is allowed as a modifier on non-PCrel instructions, in which
|
||||
// case all we do is set the PCrel bit in the relocation entry; this is
|
||||
// used with exception handling, for example. The source is required to
|
||||
// include any necessary offset directly.
|
||||
Type = MachO::X86_64_RELOC_GOT;
|
||||
IsPCRel = 1;
|
||||
} else if (Specifier == X86MCExpr::VK_TLVP) {
|
||||
} else if (Specifier == X86::S_TLVP) {
|
||||
reportError(Fixup.getLoc(),
|
||||
"TLVP symbol modifier should have been rip-rel");
|
||||
return;
|
||||
@@ -446,7 +446,7 @@ void X86MachObjectWriter::recordTLVPRelocation(MachObjectWriter *Writer,
|
||||
MCValue Target,
|
||||
uint64_t &FixedValue) {
|
||||
const MCSymbol *SymA = Target.getAddSym();
|
||||
assert(Target.getSpecifier() == X86MCExpr::VK_TLVP && !is64Bit() &&
|
||||
assert(Target.getSpecifier() == X86::S_TLVP && !is64Bit() &&
|
||||
"Should only be called with a 32-bit TLVP relocation!");
|
||||
|
||||
unsigned Log2Size = getFixupKindLog2Size(Fixup.getKind());
|
||||
@@ -488,7 +488,7 @@ void X86MachObjectWriter::RecordX86Relocation(MachObjectWriter *Writer,
|
||||
const MCSymbol *A = Target.getAddSym();
|
||||
|
||||
// If this is a 32-bit TLVP reloc it's handled a bit differently.
|
||||
if (A && Target.getSpecifier() == X86MCExpr::VK_TLVP) {
|
||||
if (A && Target.getSpecifier() == X86::S_TLVP) {
|
||||
recordTLVPRelocation(Writer, Asm, Fragment, Fixup, Target, FixedValue);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "MCTargetDesc/X86MCExpr.h"
|
||||
#include "MCTargetDesc/X86MCAsmInfo.h"
|
||||
#include "X86.h"
|
||||
#include "X86CallingConv.h"
|
||||
#include "X86FrameLowering.h"
|
||||
@@ -472,7 +472,7 @@ X86TargetLowering::LowerCustomJumpTableEntry(const MachineJumpTableInfo *MJTI,
|
||||
assert(isPositionIndependent() && Subtarget.isPICStyleGOT());
|
||||
// In 32-bit ELF systems, our jump table entries are formed with @GOTOFF
|
||||
// entries.
|
||||
return MCSymbolRefExpr::create(MBB->getSymbol(), X86MCExpr::VK_GOTOFF, Ctx);
|
||||
return MCSymbolRefExpr::create(MBB->getSymbol(), X86::S_GOTOFF, Ctx);
|
||||
}
|
||||
|
||||
/// Returns relocation base for the given PIC jumptable.
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "MCTargetDesc/X86BaseInfo.h"
|
||||
#include "MCTargetDesc/X86EncodingOptimization.h"
|
||||
#include "MCTargetDesc/X86InstComments.h"
|
||||
#include "MCTargetDesc/X86MCExpr.h"
|
||||
#include "MCTargetDesc/X86MCAsmInfo.h"
|
||||
#include "MCTargetDesc/X86ShuffleDecode.h"
|
||||
#include "MCTargetDesc/X86TargetStreamer.h"
|
||||
#include "X86AsmPrinter.h"
|
||||
@@ -234,7 +234,7 @@ MCOperand X86MCInstLower::LowerSymbolOperand(const MachineOperand &MO,
|
||||
// FIXME: We would like an efficient form for this, so we don't have to do a
|
||||
// lot of extra uniquing.
|
||||
const MCExpr *Expr = nullptr;
|
||||
auto Specifier = X86MCExpr::VK_None;
|
||||
uint16_t Specifier = X86::S_None;
|
||||
|
||||
switch (MO.getTargetFlags()) {
|
||||
default:
|
||||
@@ -247,61 +247,61 @@ MCOperand X86MCInstLower::LowerSymbolOperand(const MachineOperand &MO,
|
||||
break;
|
||||
|
||||
case X86II::MO_TLVP:
|
||||
Specifier = X86MCExpr::VK_TLVP;
|
||||
Specifier = X86::S_TLVP;
|
||||
break;
|
||||
case X86II::MO_TLVP_PIC_BASE:
|
||||
Expr = MCSymbolRefExpr::create(Sym, X86MCExpr::VK_TLVP, Ctx);
|
||||
Expr = MCSymbolRefExpr::create(Sym, X86::S_TLVP, Ctx);
|
||||
// Subtract the pic base.
|
||||
Expr = MCBinaryExpr::createSub(
|
||||
Expr, MCSymbolRefExpr::create(MF.getPICBaseSymbol(), Ctx), Ctx);
|
||||
break;
|
||||
case X86II::MO_SECREL:
|
||||
Specifier = X86MCExpr::Specifier(MCSymbolRefExpr::VK_SECREL);
|
||||
Specifier = uint16_t(MCSymbolRefExpr::VK_SECREL);
|
||||
break;
|
||||
case X86II::MO_TLSGD:
|
||||
Specifier = X86MCExpr::VK_TLSGD;
|
||||
Specifier = X86::S_TLSGD;
|
||||
break;
|
||||
case X86II::MO_TLSLD:
|
||||
Specifier = X86MCExpr::VK_TLSLD;
|
||||
Specifier = X86::S_TLSLD;
|
||||
break;
|
||||
case X86II::MO_TLSLDM:
|
||||
Specifier = X86MCExpr::VK_TLSLDM;
|
||||
Specifier = X86::S_TLSLDM;
|
||||
break;
|
||||
case X86II::MO_GOTTPOFF:
|
||||
Specifier = X86MCExpr::VK_GOTTPOFF;
|
||||
Specifier = X86::S_GOTTPOFF;
|
||||
break;
|
||||
case X86II::MO_INDNTPOFF:
|
||||
Specifier = X86MCExpr::VK_INDNTPOFF;
|
||||
Specifier = X86::S_INDNTPOFF;
|
||||
break;
|
||||
case X86II::MO_TPOFF:
|
||||
Specifier = X86MCExpr::VK_TPOFF;
|
||||
Specifier = X86::S_TPOFF;
|
||||
break;
|
||||
case X86II::MO_DTPOFF:
|
||||
Specifier = X86MCExpr::VK_DTPOFF;
|
||||
Specifier = X86::S_DTPOFF;
|
||||
break;
|
||||
case X86II::MO_NTPOFF:
|
||||
Specifier = X86MCExpr::VK_NTPOFF;
|
||||
Specifier = X86::S_NTPOFF;
|
||||
break;
|
||||
case X86II::MO_GOTNTPOFF:
|
||||
Specifier = X86MCExpr::VK_GOTNTPOFF;
|
||||
Specifier = X86::S_GOTNTPOFF;
|
||||
break;
|
||||
case X86II::MO_GOTPCREL:
|
||||
Specifier = X86MCExpr::VK_GOTPCREL;
|
||||
Specifier = X86::S_GOTPCREL;
|
||||
break;
|
||||
case X86II::MO_GOTPCREL_NORELAX:
|
||||
Specifier = X86MCExpr::VK_GOTPCREL_NORELAX;
|
||||
Specifier = X86::S_GOTPCREL_NORELAX;
|
||||
break;
|
||||
case X86II::MO_GOT:
|
||||
Specifier = X86MCExpr::VK_GOT;
|
||||
Specifier = X86::S_GOT;
|
||||
break;
|
||||
case X86II::MO_GOTOFF:
|
||||
Specifier = X86MCExpr::VK_GOTOFF;
|
||||
Specifier = X86::S_GOTOFF;
|
||||
break;
|
||||
case X86II::MO_PLT:
|
||||
Specifier = X86MCExpr::VK_PLT;
|
||||
Specifier = X86::S_PLT;
|
||||
break;
|
||||
case X86II::MO_ABS8:
|
||||
Specifier = X86MCExpr::VK_ABS8;
|
||||
Specifier = X86::S_ABS8;
|
||||
break;
|
||||
case X86II::MO_PIC_BASE_OFFSET:
|
||||
case X86II::MO_DARWIN_NONLAZY_PIC_BASE:
|
||||
@@ -533,23 +533,23 @@ void X86AsmPrinter::LowerTlsAddr(X86MCInstLower &MCInstLowering,
|
||||
bool Is64BitsLP64 = getSubtarget().isTarget64BitLP64();
|
||||
MCContext &Ctx = OutStreamer->getContext();
|
||||
|
||||
X86MCExpr::Specifier Specifier;
|
||||
X86::Specifier Specifier;
|
||||
switch (MI.getOpcode()) {
|
||||
case X86::TLS_addr32:
|
||||
case X86::TLS_addr64:
|
||||
case X86::TLS_addrX32:
|
||||
Specifier = X86MCExpr::VK_TLSGD;
|
||||
Specifier = X86::S_TLSGD;
|
||||
break;
|
||||
case X86::TLS_base_addr32:
|
||||
Specifier = X86MCExpr::VK_TLSLDM;
|
||||
Specifier = X86::S_TLSLDM;
|
||||
break;
|
||||
case X86::TLS_base_addr64:
|
||||
case X86::TLS_base_addrX32:
|
||||
Specifier = X86MCExpr::VK_TLSLD;
|
||||
Specifier = X86::S_TLSLD;
|
||||
break;
|
||||
case X86::TLS_desc32:
|
||||
case X86::TLS_desc64:
|
||||
Specifier = X86MCExpr::VK_TLSDESC;
|
||||
Specifier = X86::S_TLSDESC;
|
||||
break;
|
||||
default:
|
||||
llvm_unreachable("unexpected opcode");
|
||||
@@ -566,10 +566,10 @@ void X86AsmPrinter::LowerTlsAddr(X86MCInstLower &MCInstLowering,
|
||||
bool UseGot = MMI->getModule()->getRtLibUseGOT() &&
|
||||
Ctx.getTargetOptions()->X86RelaxRelocations;
|
||||
|
||||
if (Specifier == X86MCExpr::VK_TLSDESC) {
|
||||
if (Specifier == X86::S_TLSDESC) {
|
||||
const MCSymbolRefExpr *Expr = MCSymbolRefExpr::create(
|
||||
MCInstLowering.GetSymbolFromOperand(MI.getOperand(3)),
|
||||
X86MCExpr::VK_TLSCALL, Ctx);
|
||||
MCInstLowering.GetSymbolFromOperand(MI.getOperand(3)), X86::S_TLSCALL,
|
||||
Ctx);
|
||||
EmitAndCountInstruction(
|
||||
MCInstBuilder(Is64BitsLP64 ? X86::LEA64r : X86::LEA32r)
|
||||
.addReg(Is64BitsLP64 ? X86::RAX : X86::EAX)
|
||||
@@ -586,7 +586,7 @@ void X86AsmPrinter::LowerTlsAddr(X86MCInstLower &MCInstLowering,
|
||||
.addExpr(Expr)
|
||||
.addReg(0));
|
||||
} else if (Is64Bits) {
|
||||
bool NeedsPadding = Specifier == X86MCExpr::VK_TLSGD;
|
||||
bool NeedsPadding = Specifier == X86::S_TLSGD;
|
||||
if (NeedsPadding && Is64BitsLP64)
|
||||
EmitAndCountInstruction(MCInstBuilder(X86::DATA16_PREFIX));
|
||||
EmitAndCountInstruction(MCInstBuilder(X86::LEA64r)
|
||||
@@ -605,7 +605,7 @@ void X86AsmPrinter::LowerTlsAddr(X86MCInstLower &MCInstLowering,
|
||||
}
|
||||
if (UseGot) {
|
||||
const MCExpr *Expr =
|
||||
MCSymbolRefExpr::create(TlsGetAddr, X86MCExpr::VK_GOTPCREL, Ctx);
|
||||
MCSymbolRefExpr::create(TlsGetAddr, X86::S_GOTPCREL, Ctx);
|
||||
EmitAndCountInstruction(MCInstBuilder(X86::CALL64m)
|
||||
.addReg(X86::RIP)
|
||||
.addImm(1)
|
||||
@@ -613,12 +613,12 @@ void X86AsmPrinter::LowerTlsAddr(X86MCInstLower &MCInstLowering,
|
||||
.addExpr(Expr)
|
||||
.addReg(0));
|
||||
} else {
|
||||
EmitAndCountInstruction(MCInstBuilder(X86::CALL64pcrel32)
|
||||
.addExpr(MCSymbolRefExpr::create(
|
||||
TlsGetAddr, X86MCExpr::VK_PLT, Ctx)));
|
||||
EmitAndCountInstruction(
|
||||
MCInstBuilder(X86::CALL64pcrel32)
|
||||
.addExpr(MCSymbolRefExpr::create(TlsGetAddr, X86::S_PLT, Ctx)));
|
||||
}
|
||||
} else {
|
||||
if (Specifier == X86MCExpr::VK_TLSGD && !UseGot) {
|
||||
if (Specifier == X86::S_TLSGD && !UseGot) {
|
||||
EmitAndCountInstruction(MCInstBuilder(X86::LEA32r)
|
||||
.addReg(X86::EAX)
|
||||
.addReg(0)
|
||||
@@ -638,8 +638,7 @@ void X86AsmPrinter::LowerTlsAddr(X86MCInstLower &MCInstLowering,
|
||||
|
||||
const MCSymbol *TlsGetAddr = Ctx.getOrCreateSymbol("___tls_get_addr");
|
||||
if (UseGot) {
|
||||
const MCExpr *Expr =
|
||||
MCSymbolRefExpr::create(TlsGetAddr, X86MCExpr::VK_GOT, Ctx);
|
||||
const MCExpr *Expr = MCSymbolRefExpr::create(TlsGetAddr, X86::S_GOT, Ctx);
|
||||
EmitAndCountInstruction(MCInstBuilder(X86::CALL32m)
|
||||
.addReg(X86::EBX)
|
||||
.addImm(1)
|
||||
@@ -647,9 +646,9 @@ void X86AsmPrinter::LowerTlsAddr(X86MCInstLower &MCInstLowering,
|
||||
.addExpr(Expr)
|
||||
.addReg(0));
|
||||
} else {
|
||||
EmitAndCountInstruction(MCInstBuilder(X86::CALLpcrel32)
|
||||
.addExpr(MCSymbolRefExpr::create(
|
||||
TlsGetAddr, X86MCExpr::VK_PLT, Ctx)));
|
||||
EmitAndCountInstruction(
|
||||
MCInstBuilder(X86::CALLpcrel32)
|
||||
.addExpr(MCSymbolRefExpr::create(TlsGetAddr, X86::S_PLT, Ctx)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "X86TargetObjectFile.h"
|
||||
#include "MCTargetDesc/X86MCExpr.h"
|
||||
#include "MCTargetDesc/X86MCAsmInfo.h"
|
||||
#include "llvm/BinaryFormat/Dwarf.h"
|
||||
#include "llvm/MC/MCExpr.h"
|
||||
#include "llvm/MC/MCValue.h"
|
||||
@@ -25,7 +25,7 @@ const MCExpr *X86_64MachoTargetObjectFile::getTTypeGlobalReference(
|
||||
if ((Encoding & DW_EH_PE_indirect) && (Encoding & DW_EH_PE_pcrel)) {
|
||||
const MCSymbol *Sym = TM.getSymbol(GV);
|
||||
const MCExpr *Res =
|
||||
MCSymbolRefExpr::create(Sym, X86MCExpr::VK_GOTPCREL, getContext());
|
||||
MCSymbolRefExpr::create(Sym, X86::S_GOTPCREL, getContext());
|
||||
const MCExpr *Four = MCConstantExpr::create(4, getContext());
|
||||
return MCBinaryExpr::createAdd(Res, Four, getContext());
|
||||
}
|
||||
@@ -48,18 +48,18 @@ const MCExpr *X86_64MachoTargetObjectFile::getIndirectSymViaGOTPCRel(
|
||||
// foo@GOTPCREL+4+<offset>.
|
||||
unsigned FinalOff = Offset+MV.getConstant()+4;
|
||||
const MCExpr *Res =
|
||||
MCSymbolRefExpr::create(Sym, X86MCExpr::VK_GOTPCREL, getContext());
|
||||
MCSymbolRefExpr::create(Sym, X86::S_GOTPCREL, getContext());
|
||||
const MCExpr *Off = MCConstantExpr::create(FinalOff, getContext());
|
||||
return MCBinaryExpr::createAdd(Res, Off, getContext());
|
||||
}
|
||||
|
||||
X86ELFTargetObjectFile::X86ELFTargetObjectFile() {
|
||||
PLTRelativeSpecifier = X86MCExpr::VK_PLT;
|
||||
PLTRelativeSpecifier = X86::S_PLT;
|
||||
}
|
||||
|
||||
const MCExpr *X86ELFTargetObjectFile::getDebugThreadLocalSymbol(
|
||||
const MCSymbol *Sym) const {
|
||||
return MCSymbolRefExpr::create(Sym, X86MCExpr::VK_DTPOFF, getContext());
|
||||
return MCSymbolRefExpr::create(Sym, X86::S_DTPOFF, getContext());
|
||||
}
|
||||
|
||||
const MCExpr *X86_64ELFTargetObjectFile::getIndirectSymViaGOTPCRel(
|
||||
@@ -67,7 +67,7 @@ const MCExpr *X86_64ELFTargetObjectFile::getIndirectSymViaGOTPCRel(
|
||||
int64_t Offset, MachineModuleInfo *MMI, MCStreamer &Streamer) const {
|
||||
int64_t FinalOffset = Offset + MV.getConstant();
|
||||
const MCExpr *Res =
|
||||
MCSymbolRefExpr::create(Sym, X86MCExpr::VK_GOTPCREL, getContext());
|
||||
MCSymbolRefExpr::create(Sym, X86::S_GOTPCREL, getContext());
|
||||
const MCExpr *Off = MCConstantExpr::create(FinalOffset, getContext());
|
||||
return MCBinaryExpr::createAdd(Res, Off, getContext());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user