blob: dfdf6ab356a3c9f386c6bfa0cd6626371c44fe4c [file] [log] [blame]
Bill Wendlingbdc38e52010-03-09 18:31:07 +00001//===-- llvm/Target/ARMTargetObjectFile.cpp - ARM Object Info Impl --------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include "ARMTargetObjectFile.h"
11#include "ARMSubtarget.h"
Chandler Carruthd04a8d42012-12-03 16:50:05 +000012#include "llvm/ADT/StringExtras.h"
Chris Lattner287df1b2010-04-08 21:34:17 +000013#include "llvm/MC/MCContext.h"
Anton Korobeynikov25efd6d2012-11-14 01:47:00 +000014#include "llvm/MC/MCExpr.h"
Bill Wendlingbdc38e52010-03-09 18:31:07 +000015#include "llvm/MC/MCSectionELF.h"
Bill Wendlingbdc38e52010-03-09 18:31:07 +000016#include "llvm/Support/Dwarf.h"
Rafael Espindolac85dca62011-01-23 04:28:49 +000017#include "llvm/Support/ELF.h"
Chandler Carruthd04a8d42012-12-03 16:50:05 +000018#include "llvm/Target/Mangler.h"
19#include "llvm/Target/TargetMachine.h"
Bill Wendlingbdc38e52010-03-09 18:31:07 +000020using namespace llvm;
21using namespace dwarf;
22
23//===----------------------------------------------------------------------===//
24// ELF Target
25//===----------------------------------------------------------------------===//
26
27void ARMElfTargetObjectFile::Initialize(MCContext &Ctx,
28 const TargetMachine &TM) {
Rafael Espindolad6b43a32012-06-19 00:48:28 +000029 bool isAAPCS_ABI = TM.getSubtarget<ARMSubtarget>().isAAPCS_ABI();
Bill Wendlingbdc38e52010-03-09 18:31:07 +000030 TargetLoweringObjectFileELF::Initialize(Ctx, TM);
Rafael Espindolad6b43a32012-06-19 00:48:28 +000031 InitializeELF(isAAPCS_ABI);
Bill Wendlingbdc38e52010-03-09 18:31:07 +000032
Anton Korobeynikov4a99f592012-01-25 22:24:19 +000033 if (isAAPCS_ABI) {
Anton Korobeynikovb5e16af2011-03-05 18:43:15 +000034 LSDASection = NULL;
Bill Wendlingbdc38e52010-03-09 18:31:07 +000035 }
Anton Korobeynikovb5e16af2011-03-05 18:43:15 +000036
Jason W Kim17b443d2010-10-11 23:01:44 +000037 AttributesSection =
38 getContext().getELFSection(".ARM.attributes",
Rafael Espindolac85dca62011-01-23 04:28:49 +000039 ELF::SHT_ARM_ATTRIBUTES,
Jason W Kim17b443d2010-10-11 23:01:44 +000040 0,
41 SectionKind::getMetadata());
Bill Wendlingbdc38e52010-03-09 18:31:07 +000042}
Anton Korobeynikov25efd6d2012-11-14 01:47:00 +000043
44const MCExpr *ARMElfTargetObjectFile::
45getTTypeGlobalReference(const GlobalValue *GV, Mangler *Mang,
46 MachineModuleInfo *MMI, unsigned Encoding,
47 MCStreamer &Streamer) const {
48 assert(Encoding == DW_EH_PE_absptr && "Can handle absptr encoding only");
49
50 return MCSymbolRefExpr::Create(Mang->getSymbol(GV),
51 MCSymbolRefExpr::VK_ARM_TARGET2,
52 getContext());
53}