Thread local globals don't require special handling by the linker and so can
[oota-llvm.git] / lib / Target / XCore / XCoreTargetAsmInfo.cpp
1 //===-- XCoreTargetAsmInfo.cpp - XCore asm properties -----------*- C++ -*-===//
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 // This file contains the declarations of the XCoreTargetAsmInfo properties.
11 // We use the small section flag for the CP relative and DP relative
12 // flags. If a section is small and writable then it is DP relative. If a
13 // section is small and not writable then it is CP relative.
14 //
15 //===----------------------------------------------------------------------===//
16
17 #include "XCoreTargetAsmInfo.h"
18 #include "XCoreTargetMachine.h"
19 #include "llvm/GlobalVariable.h"
20 #include "llvm/ADT/StringExtras.h"
21
22 using namespace llvm;
23
24 XCoreTargetAsmInfo::XCoreTargetAsmInfo(const XCoreTargetMachine &TM)
25   : ELFTargetAsmInfo(TM) {
26   SupportsDebugInformation = true;
27   TextSection = getUnnamedSection("\t.text", SectionFlags::Code);
28   DataSection = getNamedSection("\t.dp.data", SectionFlags::Writeable |
29                                 SectionFlags::Small);
30   BSSSection_  = getNamedSection("\t.dp.bss", SectionFlags::Writeable |
31                                  SectionFlags::BSS | SectionFlags::Small);
32
33   // TLS globals are lowered in the backend to arrays indexed by the current
34   // thread id. After lowering they require no special handling by the linker
35   // and can be placed in the standard data / bss sections.
36   TLSDataSection = DataSection;
37   TLSBSSSection = BSSSection_;
38
39   if (TM.getSubtargetImpl()->isXS1A()) {
40     ReadOnlySection = getNamedSection("\t.dp.rodata", SectionFlags::None |
41                                       SectionFlags::Writeable |
42                                       SectionFlags::Small);
43   } else {
44     ReadOnlySection = getNamedSection("\t.cp.rodata", SectionFlags::None |
45                                       SectionFlags::Small);
46   }
47   Data16bitsDirective = "\t.short\t";
48   Data32bitsDirective = "\t.long\t";
49   Data64bitsDirective = 0;
50   ZeroDirective = "\t.space\t";
51   CommentString = "#";
52   ConstantPoolSection = "\t.section\t.cp.rodata,\"ac\",@progbits";
53   JumpTableDataSection = "\t.section\t.dp.data,\"awd\",@progbits";
54   PrivateGlobalPrefix = ".L";
55   AscizDirective = ".asciiz";
56   WeakDefDirective = "\t.weak\t";
57   WeakRefDirective = "\t.weak\t";
58   SetDirective = "\t.set\t";
59
60   // Debug
61   HasLEB128 = true;
62   AbsoluteDebugSectionOffsets = true;
63   
64   DwarfAbbrevSection = "\t.section\t.debug_abbrev,\"\",@progbits";
65   DwarfInfoSection = "\t.section\t.debug_info,\"\",@progbits";
66   DwarfLineSection = "\t.section\t.debug_line,\"\",@progbits";
67   DwarfFrameSection = "\t.section\t.debug_frame,\"\",@progbits";
68   DwarfPubNamesSection = "\t.section\t.debug_pubnames,\"\",@progbits";
69   DwarfPubTypesSection = "\t.section\t.debug_pubtypes,\"\",@progbits";
70   DwarfStrSection = "\t.section\t.debug_str,\"\",@progbits";
71   DwarfLocSection = "\t.section\t.debug_loc,\"\",@progbits";
72   DwarfARangesSection = "\t.section\t.debug_aranges,\"\",@progbits";
73   DwarfRangesSection = "\t.section\t.debug_ranges,\"\",@progbits";
74   DwarfMacroInfoSection = "\t.section\t.debug_macinfo,\"\",@progbits";
75 }
76