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 // For now, disable lowering of mergable sections, just drop everything into
33 MergeableConst4Section
= 0;
34 MergeableConst8Section
= 0;
35 MergeableConst16Section
= 0;
37 // TLS globals are lowered in the backend to arrays indexed by the current
38 // thread id. After lowering they require no special handling by the linker
39 // and can be placed in the standard data / bss sections.
40 TLSDataSection
= DataSection
;
41 TLSBSSSection
= BSSSection
;
43 if (TM
.getSubtarget
<XCoreSubtarget
>().isXS1A())
44 ReadOnlySection
= // FIXME: Why is this a writable section for XS1A?
45 MCSectionXCore::Create(".dp.rodata", MCSectionELF::SHT_PROGBITS
,
46 MCSectionELF::SHF_ALLOC
| MCSectionELF::SHF_WRITE
|
47 MCSectionXCore::SHF_DP_SECTION
,
48 SectionKind::getDataRel(), false, getContext());
51 MCSectionXCore::Create(".cp.rodata", MCSectionELF::SHT_PROGBITS
,
52 MCSectionELF::SHF_ALLOC
|
53 MCSectionXCore::SHF_CP_SECTION
,
54 SectionKind::getReadOnly(), false, getContext());