Fix indentation.
[oota-llvm.git] / lib / Target / XCore / XCoreTargetObjectFile.cpp
1 //===-- XCoreTargetObjectFile.cpp - XCore object files --------------------===//
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 "XCoreTargetObjectFile.h"
11 #include "XCoreSubtarget.h"
12 #include "MCSectionXCore.h"
13 #include "llvm/Target/TargetMachine.h"
14 using namespace llvm;
15
16
17 void XCoreTargetObjectFile::Initialize(MCContext &Ctx, const TargetMachine &TM){
18   TargetLoweringObjectFileELF::Initialize(Ctx, TM);
19
20   DataSection =
21     MCSectionXCore::Create(".dp.data", MCSectionELF::SHT_PROGBITS, 
22                            MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_WRITE |
23                            MCSectionXCore::SHF_DP_SECTION,
24                            SectionKind::getDataRel(), false, getContext());
25   BSSSection =
26     MCSectionXCore::Create(".dp.bss", MCSectionELF::SHT_NOBITS,
27                            MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_WRITE |
28                            MCSectionXCore::SHF_DP_SECTION,
29                            SectionKind::getBSS(), false, getContext());
30   
31   MergeableConst4Section = 
32     MCSectionXCore::Create(".cp.rodata.cst4", MCSectionELF::SHT_PROGBITS,
33                            MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_MERGE |
34                            MCSectionXCore::SHF_CP_SECTION,
35                            SectionKind::getMergeableConst4(), false,
36                            getContext());
37   MergeableConst8Section = 
38     MCSectionXCore::Create(".cp.rodata.cst8", MCSectionELF::SHT_PROGBITS,
39                            MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_MERGE |
40                            MCSectionXCore::SHF_CP_SECTION,
41                            SectionKind::getMergeableConst8(), false,
42                            getContext());
43   MergeableConst16Section = 
44     MCSectionXCore::Create(".cp.rodata.cst16", MCSectionELF::SHT_PROGBITS,
45                            MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_MERGE |
46                            MCSectionXCore::SHF_CP_SECTION,
47                            SectionKind::getMergeableConst16(), false,
48                            getContext());
49   
50   // TLS globals are lowered in the backend to arrays indexed by the current
51   // thread id. After lowering they require no special handling by the linker
52   // and can be placed in the standard data / bss sections.
53   TLSDataSection = DataSection;
54   TLSBSSSection = BSSSection;
55
56   ReadOnlySection = 
57     MCSectionXCore::Create(".cp.rodata", MCSectionELF::SHT_PROGBITS,
58                            MCSectionELF::SHF_ALLOC |
59                            MCSectionXCore::SHF_CP_SECTION,
60                            SectionKind::getReadOnlyWithRel(), false,
61                            getContext());
62
63   // Dynamic linking is not supported. Data with relocations is placed in the
64   // same section as data without relocations.
65   DataRelSection = DataRelLocalSection = DataSection;
66   DataRelROSection = DataRelROLocalSection = ReadOnlySection;
67 }