1 //===-- llvm/Target/ARMTargetObjectFile.cpp - ARM Object Info Impl --------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "ARMTargetObjectFile.h"
11 #include "ARMSubtarget.h"
12 #include "llvm/MC/MCContext.h"
13 #include "llvm/MC/MCSectionELF.h"
14 #include "llvm/Support/Dwarf.h"
15 #include "llvm/Support/ELF.h"
16 #include "llvm/Target/TargetMachine.h"
17 #include "llvm/ADT/StringExtras.h"
19 using namespace dwarf;
21 //===----------------------------------------------------------------------===//
23 //===----------------------------------------------------------------------===//
25 void ARMElfTargetObjectFile::Initialize(MCContext &Ctx,
26 const TargetMachine &TM) {
27 TargetLoweringObjectFileELF::Initialize(Ctx, TM);
28 isAAPCS_ABI = TM.getSubtarget<ARMSubtarget>().isAAPCS_ABI();
32 getContext().getELFSection(".init_array", ELF::SHT_INIT_ARRAY,
35 SectionKind::getDataRel());
37 getContext().getELFSection(".fini_array", ELF::SHT_FINI_ARRAY,
40 SectionKind::getDataRel());
45 getContext().getELFSection(".ARM.attributes",
46 ELF::SHT_ARM_ATTRIBUTES,
48 SectionKind::getMetadata());
52 ARMElfTargetObjectFile::getStaticCtorSection(unsigned Priority) const {
54 return TargetLoweringObjectFileELF::getStaticCtorSection(Priority);
56 if (Priority == 65535)
57 return StaticCtorSection;
59 // Emit ctors in priority order.
60 std::string Name = std::string(".init_array.") + utostr(Priority);
61 return getContext().getELFSection(Name, ELF::SHT_INIT_ARRAY,
62 ELF::SHF_ALLOC | ELF::SHF_WRITE,
63 SectionKind::getDataRel());
67 ARMElfTargetObjectFile::getStaticDtorSection(unsigned Priority) const {
69 return TargetLoweringObjectFileELF::getStaticDtorSection(Priority);
71 if (Priority == 65535)
72 return StaticDtorSection;
74 // Emit dtors in priority order.
75 std::string Name = std::string(".fini_array.") + utostr(Priority);
76 return getContext().getELFSection(Name, ELF::SHT_FINI_ARRAY,
77 ELF::SHF_ALLOC | ELF::SHF_WRITE,
78 SectionKind::getDataRel());