mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-24 09:29:42 +00:00
Move the X86 specific bits of the ELF writer to the Target/X86 directory.
Other targets will follow shortly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147060 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
dc9a8a378d
commit
edae8e1e4d
@ -40,6 +40,10 @@ public:
|
||||
|
||||
virtual ~MCELFObjectTargetWriter();
|
||||
|
||||
virtual unsigned GetRelocType(const MCValue &Target, const MCFixup &Fixup,
|
||||
bool IsPCRel, bool IsRelocWithSymbol,
|
||||
int64_t Addend) const; // FIXME: add = 0
|
||||
|
||||
/// @name Accessors
|
||||
/// @{
|
||||
uint8_t getOSABI() { return OSABI; }
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include "llvm/ADT/StringSwitch.h"
|
||||
|
||||
#include "../Target/Mips/MCTargetDesc/MipsFixupKinds.h"
|
||||
#include "../Target/X86/MCTargetDesc/X86FixupKinds.h"
|
||||
#include "../Target/ARM/MCTargetDesc/ARMFixupKinds.h"
|
||||
#include "../Target/PowerPC/MCTargetDesc/PPCFixupKinds.h"
|
||||
|
||||
@ -1261,7 +1260,7 @@ MCObjectWriter *llvm::createELFObjectWriter(MCELFObjectTargetWriter *MOTW,
|
||||
switch (MOTW->getEMachine()) {
|
||||
case ELF::EM_386:
|
||||
case ELF::EM_X86_64:
|
||||
return new X86ELFObjectWriter(MOTW, OS, IsLittleEndian); break;
|
||||
return new ELFObjectWriter(MOTW, OS, IsLittleEndian); break;
|
||||
case ELF::EM_ARM:
|
||||
return new ARMELFObjectWriter(MOTW, OS, IsLittleEndian); break;
|
||||
case ELF::EM_MBLAZE:
|
||||
@ -1275,6 +1274,15 @@ MCObjectWriter *llvm::createELFObjectWriter(MCELFObjectTargetWriter *MOTW,
|
||||
}
|
||||
}
|
||||
|
||||
unsigned ELFObjectWriter::GetRelocType(const MCValue &Target,
|
||||
const MCFixup &Fixup,
|
||||
bool IsPCRel,
|
||||
bool IsRelocWithSymbol,
|
||||
int64_t Addend) const {
|
||||
return TargetObjectWriter->GetRelocType(Target, Fixup, IsPCRel,
|
||||
IsRelocWithSymbol, Addend);
|
||||
}
|
||||
|
||||
/// START OF SUBCLASSES for ELFObjectWriter
|
||||
//===- ARMELFObjectWriter -------------------------------------------===//
|
||||
|
||||
@ -1628,195 +1636,6 @@ unsigned MBlazeELFObjectWriter::GetRelocType(const MCValue &Target,
|
||||
return Type;
|
||||
}
|
||||
|
||||
//===- X86ELFObjectWriter -------------------------------------------===//
|
||||
|
||||
|
||||
X86ELFObjectWriter::X86ELFObjectWriter(MCELFObjectTargetWriter *MOTW,
|
||||
raw_ostream &_OS,
|
||||
bool IsLittleEndian)
|
||||
: ELFObjectWriter(MOTW, _OS, IsLittleEndian)
|
||||
{}
|
||||
|
||||
X86ELFObjectWriter::~X86ELFObjectWriter()
|
||||
{}
|
||||
|
||||
unsigned X86ELFObjectWriter::GetRelocType(const MCValue &Target,
|
||||
const MCFixup &Fixup,
|
||||
bool IsPCRel,
|
||||
bool IsRelocWithSymbol,
|
||||
int64_t Addend) const {
|
||||
// determine the type of the relocation
|
||||
|
||||
MCSymbolRefExpr::VariantKind Modifier = Target.isAbsolute() ?
|
||||
MCSymbolRefExpr::VK_None : Target.getSymA()->getKind();
|
||||
unsigned Type;
|
||||
if (is64Bit()) {
|
||||
if (IsPCRel) {
|
||||
switch ((unsigned)Fixup.getKind()) {
|
||||
default: llvm_unreachable("invalid fixup kind!");
|
||||
|
||||
case FK_Data_8: Type = ELF::R_X86_64_PC64; break;
|
||||
case FK_Data_4: Type = ELF::R_X86_64_PC32; break;
|
||||
case FK_Data_2: Type = ELF::R_X86_64_PC16; break;
|
||||
|
||||
case FK_PCRel_8:
|
||||
assert(Modifier == MCSymbolRefExpr::VK_None);
|
||||
Type = ELF::R_X86_64_PC64;
|
||||
break;
|
||||
case X86::reloc_signed_4byte:
|
||||
case X86::reloc_riprel_4byte_movq_load:
|
||||
case X86::reloc_riprel_4byte:
|
||||
case FK_PCRel_4:
|
||||
switch (Modifier) {
|
||||
default:
|
||||
llvm_unreachable("Unimplemented");
|
||||
case MCSymbolRefExpr::VK_None:
|
||||
Type = ELF::R_X86_64_PC32;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_PLT:
|
||||
Type = ELF::R_X86_64_PLT32;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_GOTPCREL:
|
||||
Type = ELF::R_X86_64_GOTPCREL;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_GOTTPOFF:
|
||||
Type = ELF::R_X86_64_GOTTPOFF;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_TLSGD:
|
||||
Type = ELF::R_X86_64_TLSGD;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_TLSLD:
|
||||
Type = ELF::R_X86_64_TLSLD;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case FK_PCRel_2:
|
||||
assert(Modifier == MCSymbolRefExpr::VK_None);
|
||||
Type = ELF::R_X86_64_PC16;
|
||||
break;
|
||||
case FK_PCRel_1:
|
||||
assert(Modifier == MCSymbolRefExpr::VK_None);
|
||||
Type = ELF::R_X86_64_PC8;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch ((unsigned)Fixup.getKind()) {
|
||||
default: llvm_unreachable("invalid fixup kind!");
|
||||
case FK_Data_8: Type = ELF::R_X86_64_64; break;
|
||||
case X86::reloc_signed_4byte:
|
||||
switch (Modifier) {
|
||||
default:
|
||||
llvm_unreachable("Unimplemented");
|
||||
case MCSymbolRefExpr::VK_None:
|
||||
Type = ELF::R_X86_64_32S;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_GOT:
|
||||
Type = ELF::R_X86_64_GOT32;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_GOTPCREL:
|
||||
Type = ELF::R_X86_64_GOTPCREL;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_TPOFF:
|
||||
Type = ELF::R_X86_64_TPOFF32;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_DTPOFF:
|
||||
Type = ELF::R_X86_64_DTPOFF32;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case FK_Data_4:
|
||||
Type = ELF::R_X86_64_32;
|
||||
break;
|
||||
case FK_Data_2: Type = ELF::R_X86_64_16; break;
|
||||
case FK_PCRel_1:
|
||||
case FK_Data_1: Type = ELF::R_X86_64_8; break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (IsPCRel) {
|
||||
switch ((unsigned)Fixup.getKind()) {
|
||||
default: llvm_unreachable("invalid fixup kind!");
|
||||
|
||||
case X86::reloc_global_offset_table:
|
||||
Type = ELF::R_386_GOTPC;
|
||||
break;
|
||||
|
||||
case X86::reloc_signed_4byte:
|
||||
case FK_PCRel_4:
|
||||
case FK_Data_4:
|
||||
switch (Modifier) {
|
||||
default:
|
||||
llvm_unreachable("Unimplemented");
|
||||
case MCSymbolRefExpr::VK_None:
|
||||
Type = ELF::R_386_PC32;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_PLT:
|
||||
Type = ELF::R_386_PLT32;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch ((unsigned)Fixup.getKind()) {
|
||||
default: llvm_unreachable("invalid fixup kind!");
|
||||
|
||||
case X86::reloc_global_offset_table:
|
||||
Type = ELF::R_386_GOTPC;
|
||||
break;
|
||||
|
||||
// FIXME: Should we avoid selecting reloc_signed_4byte in 32 bit mode
|
||||
// instead?
|
||||
case X86::reloc_signed_4byte:
|
||||
case FK_PCRel_4:
|
||||
case FK_Data_4:
|
||||
switch (Modifier) {
|
||||
default:
|
||||
llvm_unreachable("Unimplemented");
|
||||
case MCSymbolRefExpr::VK_None:
|
||||
Type = ELF::R_386_32;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_GOT:
|
||||
Type = ELF::R_386_GOT32;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_GOTOFF:
|
||||
Type = ELF::R_386_GOTOFF;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_TLSGD:
|
||||
Type = ELF::R_386_TLS_GD;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_TPOFF:
|
||||
Type = ELF::R_386_TLS_LE_32;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_INDNTPOFF:
|
||||
Type = ELF::R_386_TLS_IE;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_NTPOFF:
|
||||
Type = ELF::R_386_TLS_LE;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_GOTNTPOFF:
|
||||
Type = ELF::R_386_TLS_GOTIE;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_TLSLDM:
|
||||
Type = ELF::R_386_TLS_LDM;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_DTPOFF:
|
||||
Type = ELF::R_386_TLS_LDO_32;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_GOTTPOFF:
|
||||
Type = ELF::R_386_TLS_IE_32;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case FK_Data_2: Type = ELF::R_386_16; break;
|
||||
case FK_PCRel_1:
|
||||
case FK_Data_1: Type = ELF::R_386_8; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Type;
|
||||
}
|
||||
|
||||
//===- MipsELFObjectWriter -------------------------------------------===//
|
||||
|
||||
MipsELFObjectWriter::MipsELFObjectWriter(MCELFObjectTargetWriter *MOTW,
|
||||
|
@ -351,27 +351,11 @@ class ELFObjectWriter : public MCObjectWriter {
|
||||
protected:
|
||||
virtual unsigned GetRelocType(const MCValue &Target, const MCFixup &Fixup,
|
||||
bool IsPCRel, bool IsRelocWithSymbol,
|
||||
int64_t Addend) const = 0;
|
||||
int64_t Addend) const;
|
||||
virtual void adjustFixupOffset(const MCFixup &Fixup,
|
||||
uint64_t &RelocOffset) {}
|
||||
};
|
||||
|
||||
//===- X86ELFObjectWriter -------------------------------------------===//
|
||||
|
||||
class X86ELFObjectWriter : public ELFObjectWriter {
|
||||
public:
|
||||
X86ELFObjectWriter(MCELFObjectTargetWriter *MOTW,
|
||||
raw_ostream &_OS,
|
||||
bool IsLittleEndian);
|
||||
|
||||
virtual ~X86ELFObjectWriter();
|
||||
protected:
|
||||
virtual unsigned GetRelocType(const MCValue &Target, const MCFixup &Fixup,
|
||||
bool IsPCRel, bool IsRelocWithSymbol,
|
||||
int64_t Addend) const;
|
||||
};
|
||||
|
||||
|
||||
//===- ARMELFObjectWriter -------------------------------------------===//
|
||||
|
||||
class ARMELFObjectWriter : public ELFObjectWriter {
|
||||
|
@ -19,5 +19,13 @@ MCELFObjectTargetWriter::MCELFObjectTargetWriter(bool Is64Bit_,
|
||||
HasRelocationAddend(HasRelocationAddend_), Is64Bit(Is64Bit_) {
|
||||
}
|
||||
|
||||
unsigned MCELFObjectTargetWriter::GetRelocType(const MCValue &Target,
|
||||
const MCFixup &Fixup,
|
||||
bool IsPCRel,
|
||||
bool IsRelocWithSymbol,
|
||||
int64_t Addend) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
MCELFObjectTargetWriter::~MCELFObjectTargetWriter() {
|
||||
}
|
||||
|
@ -2,8 +2,9 @@ add_llvm_library(LLVMX86Desc
|
||||
X86AsmBackend.cpp
|
||||
X86MCTargetDesc.cpp
|
||||
X86MCAsmInfo.cpp
|
||||
X86MCCodeEmitter.cpp
|
||||
X86MCCodeEmitter.cpp
|
||||
X86MachObjectWriter.cpp
|
||||
X86ELFObjectWriter.cpp
|
||||
)
|
||||
|
||||
add_dependencies(LLVMX86Desc X86CommonTableGen)
|
||||
|
@ -343,12 +343,7 @@ public:
|
||||
: ELFX86AsmBackend(T, OSABI) {}
|
||||
|
||||
MCObjectWriter *createObjectWriter(raw_ostream &OS) const {
|
||||
return createELFObjectWriter(createELFObjectTargetWriter(),
|
||||
OS, /*IsLittleEndian*/ true);
|
||||
}
|
||||
|
||||
MCELFObjectTargetWriter *createELFObjectTargetWriter() const {
|
||||
return new X86ELFObjectWriter(false, OSABI, ELF::EM_386, false, false);
|
||||
return createX86ELFObjectWriter(OS, /*Is64Bit*/ false, OSABI);
|
||||
}
|
||||
};
|
||||
|
||||
@ -358,12 +353,7 @@ public:
|
||||
: ELFX86AsmBackend(T, OSABI) {}
|
||||
|
||||
MCObjectWriter *createObjectWriter(raw_ostream &OS) const {
|
||||
return createELFObjectWriter(createELFObjectTargetWriter(),
|
||||
OS, /*IsLittleEndian*/ true);
|
||||
}
|
||||
|
||||
MCELFObjectTargetWriter *createELFObjectTargetWriter() const {
|
||||
return new X86ELFObjectWriter(true, OSABI, ELF::EM_X86_64, true, false);
|
||||
return createX86ELFObjectWriter(OS, /*Is64Bit*/ true, OSABI);
|
||||
}
|
||||
};
|
||||
|
||||
|
224
lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp
Normal file
224
lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp
Normal file
@ -0,0 +1,224 @@
|
||||
//===-- X86ELFObjectWriter.cpp - X86 ELF Writer ---------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "MCTargetDesc/X86FixupKinds.h"
|
||||
#include "MCTargetDesc/X86MCTargetDesc.h"
|
||||
#include "llvm/MC/MCELFObjectWriter.h"
|
||||
#include "llvm/MC/MCExpr.h"
|
||||
#include "llvm/MC/MCValue.h"
|
||||
#include "llvm/Support/ELF.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
class X86ELFObjectWriter : public MCELFObjectTargetWriter {
|
||||
public:
|
||||
X86ELFObjectWriter(bool is64Bit, uint8_t OSABI);
|
||||
|
||||
virtual ~X86ELFObjectWriter();
|
||||
protected:
|
||||
virtual unsigned GetRelocType(const MCValue &Target, const MCFixup &Fixup,
|
||||
bool IsPCRel, bool IsRelocWithSymbol,
|
||||
int64_t Addend) const;
|
||||
};
|
||||
}
|
||||
|
||||
X86ELFObjectWriter::X86ELFObjectWriter(bool Is64Bit, uint8_t OSABI)
|
||||
: MCELFObjectTargetWriter(Is64Bit, OSABI,
|
||||
Is64Bit ? ELF::EM_X86_64 : ELF::EM_386,
|
||||
/*HasRelocationAddend*/ Is64Bit) {}
|
||||
|
||||
X86ELFObjectWriter::~X86ELFObjectWriter()
|
||||
{}
|
||||
|
||||
unsigned X86ELFObjectWriter::GetRelocType(const MCValue &Target,
|
||||
const MCFixup &Fixup,
|
||||
bool IsPCRel,
|
||||
bool IsRelocWithSymbol,
|
||||
int64_t Addend) const {
|
||||
// determine the type of the relocation
|
||||
|
||||
MCSymbolRefExpr::VariantKind Modifier = Target.isAbsolute() ?
|
||||
MCSymbolRefExpr::VK_None : Target.getSymA()->getKind();
|
||||
unsigned Type;
|
||||
if (is64Bit()) {
|
||||
if (IsPCRel) {
|
||||
switch ((unsigned)Fixup.getKind()) {
|
||||
default: llvm_unreachable("invalid fixup kind!");
|
||||
|
||||
case FK_Data_8: Type = ELF::R_X86_64_PC64; break;
|
||||
case FK_Data_4: Type = ELF::R_X86_64_PC32; break;
|
||||
case FK_Data_2: Type = ELF::R_X86_64_PC16; break;
|
||||
|
||||
case FK_PCRel_8:
|
||||
assert(Modifier == MCSymbolRefExpr::VK_None);
|
||||
Type = ELF::R_X86_64_PC64;
|
||||
break;
|
||||
case X86::reloc_signed_4byte:
|
||||
case X86::reloc_riprel_4byte_movq_load:
|
||||
case X86::reloc_riprel_4byte:
|
||||
case FK_PCRel_4:
|
||||
switch (Modifier) {
|
||||
default:
|
||||
llvm_unreachable("Unimplemented");
|
||||
case MCSymbolRefExpr::VK_None:
|
||||
Type = ELF::R_X86_64_PC32;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_PLT:
|
||||
Type = ELF::R_X86_64_PLT32;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_GOTPCREL:
|
||||
Type = ELF::R_X86_64_GOTPCREL;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_GOTTPOFF:
|
||||
Type = ELF::R_X86_64_GOTTPOFF;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_TLSGD:
|
||||
Type = ELF::R_X86_64_TLSGD;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_TLSLD:
|
||||
Type = ELF::R_X86_64_TLSLD;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case FK_PCRel_2:
|
||||
assert(Modifier == MCSymbolRefExpr::VK_None);
|
||||
Type = ELF::R_X86_64_PC16;
|
||||
break;
|
||||
case FK_PCRel_1:
|
||||
assert(Modifier == MCSymbolRefExpr::VK_None);
|
||||
Type = ELF::R_X86_64_PC8;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch ((unsigned)Fixup.getKind()) {
|
||||
default: llvm_unreachable("invalid fixup kind!");
|
||||
case FK_Data_8: Type = ELF::R_X86_64_64; break;
|
||||
case X86::reloc_signed_4byte:
|
||||
switch (Modifier) {
|
||||
default:
|
||||
llvm_unreachable("Unimplemented");
|
||||
case MCSymbolRefExpr::VK_None:
|
||||
Type = ELF::R_X86_64_32S;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_GOT:
|
||||
Type = ELF::R_X86_64_GOT32;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_GOTPCREL:
|
||||
Type = ELF::R_X86_64_GOTPCREL;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_TPOFF:
|
||||
Type = ELF::R_X86_64_TPOFF32;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_DTPOFF:
|
||||
Type = ELF::R_X86_64_DTPOFF32;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case FK_Data_4:
|
||||
Type = ELF::R_X86_64_32;
|
||||
break;
|
||||
case FK_Data_2: Type = ELF::R_X86_64_16; break;
|
||||
case FK_PCRel_1:
|
||||
case FK_Data_1: Type = ELF::R_X86_64_8; break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (IsPCRel) {
|
||||
switch ((unsigned)Fixup.getKind()) {
|
||||
default: llvm_unreachable("invalid fixup kind!");
|
||||
|
||||
case X86::reloc_global_offset_table:
|
||||
Type = ELF::R_386_GOTPC;
|
||||
break;
|
||||
|
||||
case X86::reloc_signed_4byte:
|
||||
case FK_PCRel_4:
|
||||
case FK_Data_4:
|
||||
switch (Modifier) {
|
||||
default:
|
||||
llvm_unreachable("Unimplemented");
|
||||
case MCSymbolRefExpr::VK_None:
|
||||
Type = ELF::R_386_PC32;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_PLT:
|
||||
Type = ELF::R_386_PLT32;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch ((unsigned)Fixup.getKind()) {
|
||||
default: llvm_unreachable("invalid fixup kind!");
|
||||
|
||||
case X86::reloc_global_offset_table:
|
||||
Type = ELF::R_386_GOTPC;
|
||||
break;
|
||||
|
||||
// FIXME: Should we avoid selecting reloc_signed_4byte in 32 bit mode
|
||||
// instead?
|
||||
case X86::reloc_signed_4byte:
|
||||
case FK_PCRel_4:
|
||||
case FK_Data_4:
|
||||
switch (Modifier) {
|
||||
default:
|
||||
llvm_unreachable("Unimplemented");
|
||||
case MCSymbolRefExpr::VK_None:
|
||||
Type = ELF::R_386_32;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_GOT:
|
||||
Type = ELF::R_386_GOT32;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_GOTOFF:
|
||||
Type = ELF::R_386_GOTOFF;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_TLSGD:
|
||||
Type = ELF::R_386_TLS_GD;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_TPOFF:
|
||||
Type = ELF::R_386_TLS_LE_32;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_INDNTPOFF:
|
||||
Type = ELF::R_386_TLS_IE;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_NTPOFF:
|
||||
Type = ELF::R_386_TLS_LE;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_GOTNTPOFF:
|
||||
Type = ELF::R_386_TLS_GOTIE;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_TLSLDM:
|
||||
Type = ELF::R_386_TLS_LDM;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_DTPOFF:
|
||||
Type = ELF::R_386_TLS_LDO_32;
|
||||
break;
|
||||
case MCSymbolRefExpr::VK_GOTTPOFF:
|
||||
Type = ELF::R_386_TLS_IE_32;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case FK_Data_2: Type = ELF::R_386_16; break;
|
||||
case FK_PCRel_1:
|
||||
case FK_Data_1: Type = ELF::R_386_8; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Type;
|
||||
}
|
||||
|
||||
MCObjectWriter *llvm::createX86ELFObjectWriter(raw_ostream &OS,
|
||||
bool Is64Bit,
|
||||
uint8_t OSABI) {
|
||||
MCELFObjectTargetWriter *MOTW =
|
||||
new X86ELFObjectWriter(Is64Bit, OSABI);
|
||||
return createELFObjectWriter(MOTW, OS, /*IsLittleEndian=*/true);
|
||||
}
|
@ -88,6 +88,10 @@ MCObjectWriter *createX86MachObjectWriter(raw_ostream &OS,
|
||||
uint32_t CPUType,
|
||||
uint32_t CPUSubtype);
|
||||
|
||||
/// createX86ELFObjectWriter - Construct an X86 ELF object writer.
|
||||
MCObjectWriter *createX86ELFObjectWriter(raw_ostream &OS,
|
||||
bool Is64Bit,
|
||||
uint8_t OSABI);
|
||||
} // End llvm namespace
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user