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 "llvm/MC/MCContext.h"
13 #include "llvm/MC/MCSectionELF.h"
14 #include "llvm/Target/TargetMachine.h"
18 void XCoreTargetObjectFile::Initialize(MCContext
&Ctx
, const TargetMachine
&TM
){
19 TargetLoweringObjectFileELF::Initialize(Ctx
, TM
);
22 Ctx
.getELFSection(".dp.data", MCSectionELF::SHT_PROGBITS
,
23 MCSectionELF::SHF_ALLOC
| MCSectionELF::SHF_WRITE
|
24 MCSectionELF::XCORE_SHF_DP_SECTION
,
25 SectionKind::getDataRel(), false);
27 Ctx
.getELFSection(".dp.bss", MCSectionELF::SHT_NOBITS
,
28 MCSectionELF::SHF_ALLOC
| MCSectionELF::SHF_WRITE
|
29 MCSectionELF::XCORE_SHF_DP_SECTION
,
30 SectionKind::getBSS(), false);
32 MergeableConst4Section
=
33 Ctx
.getELFSection(".cp.rodata.cst4", MCSectionELF::SHT_PROGBITS
,
34 MCSectionELF::SHF_ALLOC
| MCSectionELF::SHF_MERGE
|
35 MCSectionELF::XCORE_SHF_CP_SECTION
,
36 SectionKind::getMergeableConst4(), false);
37 MergeableConst8Section
=
38 Ctx
.getELFSection(".cp.rodata.cst8", MCSectionELF::SHT_PROGBITS
,
39 MCSectionELF::SHF_ALLOC
| MCSectionELF::SHF_MERGE
|
40 MCSectionELF::XCORE_SHF_CP_SECTION
,
41 SectionKind::getMergeableConst8(), false);
42 MergeableConst16Section
=
43 Ctx
.getELFSection(".cp.rodata.cst16", MCSectionELF::SHT_PROGBITS
,
44 MCSectionELF::SHF_ALLOC
| MCSectionELF::SHF_MERGE
|
45 MCSectionELF::XCORE_SHF_CP_SECTION
,
46 SectionKind::getMergeableConst16(), false);
48 // TLS globals are lowered in the backend to arrays indexed by the current
49 // thread id. After lowering they require no special handling by the linker
50 // and can be placed in the standard data / bss sections.
51 TLSDataSection
= DataSection
;
52 TLSBSSSection
= BSSSection
;
55 Ctx
.getELFSection(".cp.rodata", MCSectionELF::SHT_PROGBITS
,
56 MCSectionELF::SHF_ALLOC
|
57 MCSectionELF::XCORE_SHF_CP_SECTION
,
58 SectionKind::getReadOnlyWithRel(), false);
60 // Dynamic linking is not supported. Data with relocations is placed in the
61 // same section as data without relocations.
62 DataRelSection
= DataRelLocalSection
= DataSection
;
63 DataRelROSection
= DataRelROLocalSection
= ReadOnlySection
;