1 //===-- COFFTargetAsmInfo.cpp - COFF asm properties -------------*- C++ -*-===//
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 // This file defines target asm properties related what form asm statements
11 // should take in general on COFF-based targets
13 //===----------------------------------------------------------------------===//
15 #include "llvm/Target/COFFTargetAsmInfo.h"
16 #include "llvm/ADT/SmallVector.h"
19 COFFTargetAsmInfo::COFFTargetAsmInfo(const TargetMachine &TM)
22 TextSection = getOrCreateSection("_text", true, SectionKind::Text);
23 DataSection = getOrCreateSection("_data", true, SectionKind::DataRel);
26 LCOMMDirective = "\t.lcomm\t";
27 COMMDirectiveTakesAlignment = false;
28 HasDotTypeDotSizeDirective = false;
29 HasSingleParameterDotFile = false;
30 StaticCtorsSection = "\t.section .ctors,\"aw\"";
31 StaticDtorsSection = "\t.section .dtors,\"aw\"";
32 HiddenDirective = NULL;
33 PrivateGlobalPrefix = "L"; // Prefix for private global symbols
34 WeakRefDirective = "\t.weak\t";
35 SetDirective = "\t.set\t";
37 // Set up DWARF directives
38 HasLEB128 = true; // Target asm supports leb128 directives (little-endian)
39 AbsoluteDebugSectionOffsets = true;
40 AbsoluteEHSectionOffsets = false;
41 SupportsDebugInformation = true;
42 DwarfSectionOffsetDirective = "\t.secrel32\t";
43 DwarfAbbrevSection = "\t.section\t.debug_abbrev,\"dr\"";
44 DwarfInfoSection = "\t.section\t.debug_info,\"dr\"";
45 DwarfLineSection = "\t.section\t.debug_line,\"dr\"";
46 DwarfFrameSection = "\t.section\t.debug_frame,\"dr\"";
47 DwarfPubNamesSection ="\t.section\t.debug_pubnames,\"dr\"";
48 DwarfPubTypesSection ="\t.section\t.debug_pubtypes,\"dr\"";
49 DwarfStrSection = "\t.section\t.debug_str,\"dr\"";
50 DwarfLocSection = "\t.section\t.debug_loc,\"dr\"";
51 DwarfARangesSection = "\t.section\t.debug_aranges,\"dr\"";
52 DwarfRangesSection = "\t.section\t.debug_ranges,\"dr\"";
53 DwarfMacroInfoSection = "\t.section\t.debug_macinfo,\"dr\"";
56 const char *COFFTargetAsmInfo::
57 getSectionPrefixForUniqueGlobal(SectionKind Kind) const {
59 return ".text$linkonce";
60 if (Kind.isWriteable())
61 return ".data$linkonce";
62 return ".rdata$linkonce";
65 void COFFTargetAsmInfo::getSectionFlagsAsString(SectionKind Kind,
66 SmallVectorImpl<char> &Str) const {
67 // FIXME: Inefficient.
68 std::string Res = ",\"";
71 if (Kind.isWriteable())
75 Str.append(Res.begin(), Res.end());