2010-03-10 12:45:15 -05:00
|
|
|
//===-- llvm/Target/ARMTargetObjectFile.cpp - ARM Object Info Impl --------===//
|
|
|
|
|
//
|
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
|
//
|
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
|
//
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
|
|
#include "ARMTargetObjectFile.h"
|
2015-05-27 14:44:32 -04:00
|
|
|
#include "ARMTargetMachine.h"
|
2013-04-08 14:41:23 -04:00
|
|
|
#include "llvm/ADT/StringExtras.h"
|
2014-11-24 04:08:18 -05:00
|
|
|
#include "llvm/IR/Mangler.h"
|
|
|
|
|
#include "llvm/MC/MCAsmInfo.h"
|
2010-05-04 12:11:02 -04:00
|
|
|
#include "llvm/MC/MCContext.h"
|
2013-04-08 14:41:23 -04:00
|
|
|
#include "llvm/MC/MCExpr.h"
|
2010-03-10 12:45:15 -05:00
|
|
|
#include "llvm/MC/MCSectionELF.h"
|
|
|
|
|
#include "llvm/Support/Dwarf.h"
|
2011-02-20 07:57:14 -05:00
|
|
|
#include "llvm/Support/ELF.h"
|
2014-11-24 04:08:18 -05:00
|
|
|
#include "llvm/Target/TargetLowering.h"
|
2010-03-10 12:45:15 -05:00
|
|
|
using namespace llvm;
|
|
|
|
|
using namespace dwarf;
|
|
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
// ELF Target
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
|
|
void ARMElfTargetObjectFile::Initialize(MCContext &Ctx,
|
|
|
|
|
const TargetMachine &TM) {
|
2015-05-27 14:44:32 -04:00
|
|
|
bool isAAPCS_ABI = static_cast<const ARMTargetMachine &>(TM).TargetABI ==
|
|
|
|
|
ARMTargetMachine::ARMABI::ARM_ABI_AAPCS;
|
2010-03-10 12:45:15 -05:00
|
|
|
TargetLoweringObjectFileELF::Initialize(Ctx, TM);
|
2012-08-15 15:34:23 -04:00
|
|
|
InitializeELF(isAAPCS_ABI);
|
2010-03-10 12:45:15 -05:00
|
|
|
|
2012-04-14 09:54:10 -04:00
|
|
|
if (isAAPCS_ABI) {
|
2014-11-24 04:08:18 -05:00
|
|
|
LSDASection = nullptr;
|
2010-03-10 12:45:15 -05:00
|
|
|
}
|
2011-05-02 15:34:44 -04:00
|
|
|
|
2011-02-20 07:57:14 -05:00
|
|
|
AttributesSection =
|
2015-05-27 14:44:32 -04:00
|
|
|
getContext().getELFSection(".ARM.attributes", ELF::SHT_ARM_ATTRIBUTES, 0);
|
2010-03-10 12:45:15 -05:00
|
|
|
}
|
2013-04-08 14:41:23 -04:00
|
|
|
|
2014-11-24 04:08:18 -05:00
|
|
|
const MCExpr *ARMElfTargetObjectFile::getTTypeGlobalReference(
|
|
|
|
|
const GlobalValue *GV, unsigned Encoding, Mangler &Mang,
|
|
|
|
|
const TargetMachine &TM, MachineModuleInfo *MMI,
|
|
|
|
|
MCStreamer &Streamer) const {
|
|
|
|
|
if (TM.getMCAsmInfo()->getExceptionHandlingType() != ExceptionHandling::ARM)
|
|
|
|
|
return TargetLoweringObjectFileELF::getTTypeGlobalReference(
|
|
|
|
|
GV, Encoding, Mang, TM, MMI, Streamer);
|
|
|
|
|
|
2013-04-08 14:41:23 -04:00
|
|
|
assert(Encoding == DW_EH_PE_absptr && "Can handle absptr encoding only");
|
|
|
|
|
|
2015-06-09 15:06:30 -04:00
|
|
|
return MCSymbolRefExpr::create(TM.getSymbol(GV, Mang),
|
2014-11-24 04:08:18 -05:00
|
|
|
MCSymbolRefExpr::VK_ARM_TARGET2, getContext());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const MCExpr *ARMElfTargetObjectFile::
|
|
|
|
|
getDebugThreadLocalSymbol(const MCSymbol *Sym) const {
|
2015-06-09 15:06:30 -04:00
|
|
|
return MCSymbolRefExpr::create(Sym, MCSymbolRefExpr::VK_ARM_TLSLDO,
|
2013-04-08 14:41:23 -04:00
|
|
|
getContext());
|
|
|
|
|
}
|