2010-03-09 18:31:07 +00: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-01-30 01:30:01 +00:00
|
|
|
#include "ARMTargetMachine.h"
|
2012-12-03 16:50:05 +00:00
|
|
|
#include "llvm/ADT/StringExtras.h"
|
2014-01-07 21:19:40 +00:00
|
|
|
#include "llvm/IR/Mangler.h"
|
2014-05-07 07:49:34 +00:00
|
|
|
#include "llvm/MC/MCAsmInfo.h"
|
2010-04-08 21:34:17 +00:00
|
|
|
#include "llvm/MC/MCContext.h"
|
2012-11-14 01:47:00 +00:00
|
|
|
#include "llvm/MC/MCExpr.h"
|
2010-03-09 18:31:07 +00:00
|
|
|
#include "llvm/MC/MCSectionELF.h"
|
|
|
|
#include "llvm/Support/Dwarf.h"
|
2011-01-23 04:28:49 +00:00
|
|
|
#include "llvm/Support/ELF.h"
|
2014-02-19 17:23:20 +00:00
|
|
|
#include "llvm/Target/TargetLowering.h"
|
2010-03-09 18:31:07 +00:00
|
|
|
using namespace llvm;
|
|
|
|
using namespace dwarf;
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// ELF Target
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
void ARMElfTargetObjectFile::Initialize(MCContext &Ctx,
|
|
|
|
const TargetMachine &TM) {
|
2015-01-30 01:30:01 +00:00
|
|
|
bool isAAPCS_ABI = static_cast<const ARMTargetMachine &>(TM).TargetABI ==
|
|
|
|
ARMTargetMachine::ARMABI::ARM_ABI_AAPCS;
|
2010-03-09 18:31:07 +00:00
|
|
|
TargetLoweringObjectFileELF::Initialize(Ctx, TM);
|
2012-06-19 00:48:28 +00:00
|
|
|
InitializeELF(isAAPCS_ABI);
|
2010-03-09 18:31:07 +00:00
|
|
|
|
2012-01-25 22:24:19 +00:00
|
|
|
if (isAAPCS_ABI) {
|
2014-04-25 05:30:21 +00:00
|
|
|
LSDASection = nullptr;
|
2010-03-09 18:31:07 +00:00
|
|
|
}
|
2011-03-05 18:43:15 +00:00
|
|
|
|
2010-10-11 23:01:44 +00:00
|
|
|
AttributesSection =
|
2015-01-29 17:33:21 +00:00
|
|
|
getContext().getELFSection(".ARM.attributes", ELF::SHT_ARM_ATTRIBUTES, 0);
|
2010-03-09 18:31:07 +00:00
|
|
|
}
|
2012-11-14 01:47:00 +00:00
|
|
|
|
2014-02-09 14:50:44 +00:00
|
|
|
const MCExpr *ARMElfTargetObjectFile::getTTypeGlobalReference(
|
|
|
|
const GlobalValue *GV, unsigned Encoding, Mangler &Mang,
|
2014-02-19 17:23:20 +00:00
|
|
|
const TargetMachine &TM, MachineModuleInfo *MMI,
|
|
|
|
MCStreamer &Streamer) const {
|
2014-05-07 07:49:34 +00:00
|
|
|
if (TM.getMCAsmInfo()->getExceptionHandlingType() != ExceptionHandling::ARM)
|
|
|
|
return TargetLoweringObjectFileELF::getTTypeGlobalReference(
|
|
|
|
GV, Encoding, Mang, TM, MMI, Streamer);
|
|
|
|
|
2012-11-14 01:47:00 +00:00
|
|
|
assert(Encoding == DW_EH_PE_absptr && "Can handle absptr encoding only");
|
|
|
|
|
2014-02-19 20:30:41 +00:00
|
|
|
return MCSymbolRefExpr::Create(TM.getSymbol(GV, Mang),
|
2014-02-19 17:23:20 +00:00
|
|
|
MCSymbolRefExpr::VK_ARM_TARGET2, getContext());
|
2012-11-14 01:47:00 +00:00
|
|
|
}
|
2014-02-05 07:23:09 +00:00
|
|
|
|
|
|
|
const MCExpr *ARMElfTargetObjectFile::
|
|
|
|
getDebugThreadLocalSymbol(const MCSymbol *Sym) const {
|
|
|
|
return MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_ARM_TLSLDO,
|
|
|
|
getContext());
|
|
|
|
}
|