blob: 163971f96fefa5b0d8f60e0d4dd74d72cd8fef83 [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"
Chris Lattner287df1b2010-04-08 21:34:17 +000012#include "llvm/MC/MCContext.h"
Bill Wendlingbdc38e52010-03-09 18:31:07 +000013#include "llvm/MC/MCSectionELF.h"
Bill Wendlingbdc38e52010-03-09 18:31:07 +000014#include "llvm/Support/Dwarf.h"
Rafael Espindolac85dca62011-01-23 04:28:49 +000015#include "llvm/Support/ELF.h"
Bill Wendlingbdc38e52010-03-09 18:31:07 +000016#include "llvm/Target/TargetMachine.h"
17using namespace llvm;
18using namespace dwarf;
19
20//===----------------------------------------------------------------------===//
21// ELF Target
22//===----------------------------------------------------------------------===//
23
24void ARMElfTargetObjectFile::Initialize(MCContext &Ctx,
25 const TargetMachine &TM) {
26 TargetLoweringObjectFileELF::Initialize(Ctx, TM);
27
28 if (TM.getSubtarget<ARMSubtarget>().isAAPCS_ABI()) {
29 StaticCtorSection =
Rafael Espindolac85dca62011-01-23 04:28:49 +000030 getContext().getELFSection(".init_array", ELF::SHT_INIT_ARRAY,
Chris Lattner287df1b2010-04-08 21:34:17 +000031 MCSectionELF::SHF_WRITE |
32 MCSectionELF::SHF_ALLOC,
33 SectionKind::getDataRel());
Bill Wendlingbdc38e52010-03-09 18:31:07 +000034 StaticDtorSection =
Rafael Espindolac85dca62011-01-23 04:28:49 +000035 getContext().getELFSection(".fini_array", ELF::SHT_FINI_ARRAY,
Chris Lattner287df1b2010-04-08 21:34:17 +000036 MCSectionELF::SHF_WRITE |
37 MCSectionELF::SHF_ALLOC,
38 SectionKind::getDataRel());
Bill Wendlingbdc38e52010-03-09 18:31:07 +000039 }
Jason W Kim17b443d2010-10-11 23:01:44 +000040
41 AttributesSection =
42 getContext().getELFSection(".ARM.attributes",
Rafael Espindolac85dca62011-01-23 04:28:49 +000043 ELF::SHT_ARM_ATTRIBUTES,
Jason W Kim17b443d2010-10-11 23:01:44 +000044 0,
45 SectionKind::getMetadata());
Bill Wendlingbdc38e52010-03-09 18:31:07 +000046}