19defa1b519668fa3863291e1de828f208023314
[oota-llvm.git] / lib / Target / ARM / ARMTargetObjectFile.cpp
1 //===-- 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"
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 using namespace llvm;
18 using namespace dwarf;
19
20 //===----------------------------------------------------------------------===//
21 //                               ELF Target
22 //===----------------------------------------------------------------------===//
23
24 void ARMElfTargetObjectFile::Initialize(MCContext &Ctx,
25                                         const TargetMachine &TM) {
26   TargetLoweringObjectFileELF::Initialize(Ctx, TM);
27
28   if (TM.getSubtarget<ARMSubtarget>().isAAPCS_ABI()) {
29     StaticCtorSection =
30       getContext().getELFSection(".init_array", ELF::SHT_INIT_ARRAY,
31                                  ELF::SHF_WRITE |
32                                  ELF::SHF_ALLOC,
33                                  SectionKind::getDataRel());
34     StaticDtorSection =
35       getContext().getELFSection(".fini_array", ELF::SHT_FINI_ARRAY,
36                                  ELF::SHF_WRITE |
37                                  ELF::SHF_ALLOC,
38                                  SectionKind::getDataRel());
39     LSDASection = NULL;
40   }
41
42   AttributesSection =
43     getContext().getELFSection(".ARM.attributes",
44                                ELF::SHT_ARM_ATTRIBUTES,
45                                0,
46                                SectionKind::getMetadata());
47 }