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/MCSectionELF.h"
13 #include "llvm/Target/TargetMachine.h"
17 void XCoreTargetObjectFile::Initialize(MCContext &Ctx, const TargetMachine &TM){
18 TargetLoweringObjectFileELF::Initialize(Ctx, TM);
20 DataSection = getELFSection(".dp.data", MCSectionELF::SHT_PROGBITS,
21 MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_WRITE,
22 SectionKind::getDataRel());
23 BSSSection = getELFSection(".dp.bss", MCSectionELF::SHT_NOBITS,
24 MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_WRITE,
25 SectionKind::getBSS());
27 // TLS globals are lowered in the backend to arrays indexed by the current
28 // thread id. After lowering they require no special handling by the linker
29 // and can be placed in the standard data / bss sections.
30 TLSDataSection = DataSection;
31 TLSBSSSection = BSSSection;
33 if (TM.getSubtarget<XCoreSubtarget>().isXS1A())
34 // FIXME: Why is this writable ("datarel")???
36 getELFSection(".dp.rodata", MCSectionELF::SHT_PROGBITS,
37 MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_WRITE,
38 SectionKind::getDataRel());
41 getELFSection(".cp.rodata", MCSectionELF::SHT_PROGBITS,
42 MCSectionELF::SHF_ALLOC, SectionKind::getReadOnly());