PPCTargetObjectFile.cpp [plain text]
#include "PPCTargetObjectFile.h"
#include "llvm/IR/Mangler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCSectionELF.h"
using namespace llvm;
void
PPC64LinuxTargetObjectFile::
Initialize(MCContext &Ctx, const TargetMachine &TM) {
TargetLoweringObjectFileELF::Initialize(Ctx, TM);
InitializeELF(TM.Options.UseInitArray);
}
const MCSection *PPC64LinuxTargetObjectFile::SelectSectionForGlobal(
const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
const TargetMachine &TM) const {
const MCSection *DefaultSection =
TargetLoweringObjectFileELF::SelectSectionForGlobal(GV, Kind, Mang, TM);
if (DefaultSection != ReadOnlySection)
return DefaultSection;
const GlobalVariable *GVar = dyn_cast<GlobalVariable>(GV);
if (GVar && GVar->isConstant() &&
(GVar->getInitializer()->getRelocationInfo() ==
Constant::GlobalRelocations))
return DataRelROSection;
return DefaultSection;
}
const MCExpr *PPC64LinuxTargetObjectFile::
getDebugThreadLocalSymbol(const MCSymbol *Sym) const {
const MCExpr *Expr =
MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_PPC_DTPREL, getContext());
return MCBinaryExpr::CreateAdd(Expr,
MCConstantExpr::Create(0x8000, getContext()),
getContext());
}