1 //===-- XCoreTargetObjectFile.cpp - XCore object files --------------------===//
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 "XCoreTargetObjectFile.h"
11 #include "XCoreSubtarget.h"
12 #include "MCSectionXCore.h"
13 #include "llvm/Target/TargetMachine.h"
17 void XCoreTargetObjectFile::Initialize(MCContext
&Ctx
, const TargetMachine
&TM
){
18 TargetLoweringObjectFileELF::Initialize(Ctx
, TM
);
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());
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());
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,
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,
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,
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
;
56 if (TM
.getSubtarget
<XCoreSubtarget
>().isXS1A())
57 ReadOnlySection
= // FIXME: Why is this a writable section for XS1A?
58 MCSectionXCore::Create(".dp.rodata", MCSectionELF::SHT_PROGBITS
,
59 MCSectionELF::SHF_ALLOC
| MCSectionELF::SHF_WRITE
|
60 MCSectionXCore::SHF_DP_SECTION
,
61 SectionKind::getDataRel(), false, getContext());
64 MCSectionXCore::Create(".cp.rodata", MCSectionELF::SHT_PROGBITS
,
65 MCSectionELF::SHF_ALLOC
|
66 MCSectionXCore::SHF_CP_SECTION
,
67 SectionKind::getReadOnlyWithRel(), false,
70 // Dynamic linking is not supported. Data with relocations is placed in the
71 // same section as data without relocations.
72 DataRelSection
= DataRelLocalSection
= DataSection
;
73 DataRelROSection
= DataRelROLocalSection
= ReadOnlySection
;