Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1 | //===-- TargetAsmInfo.cpp - Asm Info ---------------------------------------==// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 081ce94 | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file defines target asm properties related what form asm statements |
| 11 | // should take. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
Anton Korobeynikov | b4f658c | 2008-06-28 13:45:57 +0000 | [diff] [blame] | 15 | #include "llvm/Constants.h" |
| 16 | #include "llvm/GlobalVariable.h" |
| 17 | #include "llvm/Function.h" |
| 18 | #include "llvm/Module.h" |
| 19 | #include "llvm/Type.h" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 20 | #include "llvm/Target/TargetAsmInfo.h" |
Anton Korobeynikov | b4f658c | 2008-06-28 13:45:57 +0000 | [diff] [blame] | 21 | #include "llvm/Target/TargetOptions.h" |
Anton Korobeynikov | 65c0d87 | 2008-02-27 23:33:50 +0000 | [diff] [blame] | 22 | #include "llvm/Support/Dwarf.h" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 23 | #include <cctype> |
| 24 | #include <cstring> |
| 25 | |
| 26 | using namespace llvm; |
| 27 | |
| 28 | TargetAsmInfo::TargetAsmInfo() : |
| 29 | TextSection("\t.text"), |
| 30 | DataSection("\t.data"), |
| 31 | BSSSection("\t.bss"), |
| 32 | TLSDataSection("\t.section .tdata,\"awT\",@progbits"), |
| 33 | TLSBSSSection("\t.section .tbss,\"awT\",@nobits"), |
| 34 | ZeroFillDirective(0), |
Dan Gohman | a65530a | 2008-05-05 00:28:39 +0000 | [diff] [blame] | 35 | NonexecutableStackDirective(0), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 36 | NeedsSet(false), |
| 37 | MaxInstLength(4), |
| 38 | PCSymbol("$"), |
| 39 | SeparatorChar(';'), |
| 40 | CommentString("#"), |
| 41 | GlobalPrefix(""), |
| 42 | PrivateGlobalPrefix("."), |
| 43 | JumpTableSpecialLabelPrefix(0), |
| 44 | GlobalVarAddrPrefix(""), |
| 45 | GlobalVarAddrSuffix(""), |
| 46 | FunctionAddrPrefix(""), |
| 47 | FunctionAddrSuffix(""), |
Bill Wendling | d1bda4f | 2007-09-11 08:27:17 +0000 | [diff] [blame] | 48 | PersonalityPrefix(""), |
| 49 | PersonalitySuffix(""), |
Bill Wendling | 2d36992 | 2007-09-11 17:20:55 +0000 | [diff] [blame] | 50 | NeedsIndirectEncoding(false), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 51 | InlineAsmStart("#APP"), |
| 52 | InlineAsmEnd("#NO_APP"), |
| 53 | AssemblerDialect(0), |
Dale Johannesen | 8f03a20 | 2008-06-03 18:09:06 +0000 | [diff] [blame] | 54 | StringConstantPrefix(".str"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 55 | ZeroDirective("\t.zero\t"), |
| 56 | ZeroDirectiveSuffix(0), |
| 57 | AsciiDirective("\t.ascii\t"), |
| 58 | AscizDirective("\t.asciz\t"), |
| 59 | Data8bitsDirective("\t.byte\t"), |
| 60 | Data16bitsDirective("\t.short\t"), |
| 61 | Data32bitsDirective("\t.long\t"), |
| 62 | Data64bitsDirective("\t.quad\t"), |
| 63 | AlignDirective("\t.align\t"), |
| 64 | AlignmentIsInBytes(true), |
Lauro Ramos Venancio | 9190bc4 | 2008-02-28 22:14:09 +0000 | [diff] [blame] | 65 | TextAlignFillValue(0), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 66 | SwitchToSectionDirective("\t.section\t"), |
| 67 | TextSectionStartSuffix(""), |
| 68 | DataSectionStartSuffix(""), |
| 69 | SectionEndDirectiveSuffix(0), |
| 70 | ConstantPoolSection("\t.section .rodata"), |
| 71 | JumpTableDataSection("\t.section .rodata"), |
| 72 | JumpTableDirective(0), |
| 73 | CStringSection(0), |
| 74 | StaticCtorsSection("\t.section .ctors,\"aw\",@progbits"), |
| 75 | StaticDtorsSection("\t.section .dtors,\"aw\",@progbits"), |
| 76 | FourByteConstantSection(0), |
| 77 | EightByteConstantSection(0), |
| 78 | SixteenByteConstantSection(0), |
| 79 | ReadOnlySection(0), |
Gordon Henriksen | e383f2a | 2007-12-23 20:58:16 +0000 | [diff] [blame] | 80 | GlobalDirective("\t.globl\t"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 81 | SetDirective(0), |
| 82 | LCOMMDirective(0), |
| 83 | COMMDirective("\t.comm\t"), |
| 84 | COMMDirectiveTakesAlignment(true), |
| 85 | HasDotTypeDotSizeDirective(true), |
| 86 | UsedDirective(0), |
| 87 | WeakRefDirective(0), |
Dale Johannesen | fb3ac73 | 2007-11-20 23:24:42 +0000 | [diff] [blame] | 88 | WeakDefDirective(0), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 89 | HiddenDirective("\t.hidden\t"), |
| 90 | ProtectedDirective("\t.protected\t"), |
| 91 | AbsoluteDebugSectionOffsets(false), |
| 92 | AbsoluteEHSectionOffsets(false), |
| 93 | HasLEB128(false), |
Dan Gohman | 307ad20 | 2007-09-24 21:09:53 +0000 | [diff] [blame] | 94 | HasDotLocAndDotFile(false), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 95 | SupportsDebugInformation(false), |
| 96 | SupportsExceptionHandling(false), |
| 97 | DwarfRequiresFrameSection(true), |
Dale Johannesen | 23b89a6 | 2007-11-21 00:45:00 +0000 | [diff] [blame] | 98 | GlobalEHDirective(0), |
Dale Johannesen | f09b599 | 2008-01-10 02:03:30 +0000 | [diff] [blame] | 99 | SupportsWeakOmittedEHFrame(true), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 100 | DwarfSectionOffsetDirective(0), |
| 101 | DwarfAbbrevSection(".debug_abbrev"), |
| 102 | DwarfInfoSection(".debug_info"), |
| 103 | DwarfLineSection(".debug_line"), |
| 104 | DwarfFrameSection(".debug_frame"), |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 105 | DwarfPubNamesSection(".debug_pubnames"), |
| 106 | DwarfPubTypesSection(".debug_pubtypes"), |
| 107 | DwarfStrSection(".debug_str"), |
| 108 | DwarfLocSection(".debug_loc"), |
| 109 | DwarfARangesSection(".debug_aranges"), |
| 110 | DwarfRangesSection(".debug_ranges"), |
| 111 | DwarfMacInfoSection(".debug_macinfo"), |
| 112 | DwarfEHFrameSection(".eh_frame"), |
| 113 | DwarfExceptionSection(".gcc_except_table"), |
| 114 | AsmTransCBE(0) { |
| 115 | } |
| 116 | |
| 117 | TargetAsmInfo::~TargetAsmInfo() { |
| 118 | } |
| 119 | |
| 120 | /// Measure the specified inline asm to determine an approximation of its |
| 121 | /// length. |
| 122 | /// Comments (which run till the next SeparatorChar or newline) do not |
| 123 | /// count as an instruction. |
| 124 | /// Any other non-whitespace text is considered an instruction, with |
| 125 | /// multiple instructions separated by SeparatorChar or newlines. |
| 126 | /// Variable-length instructions are not handled here; this function |
| 127 | /// may be overloaded in the target code to do that. |
| 128 | unsigned TargetAsmInfo::getInlineAsmLength(const char *Str) const { |
| 129 | // Count the number of instructions in the asm. |
| 130 | bool atInsnStart = true; |
| 131 | unsigned Length = 0; |
| 132 | for (; *Str; ++Str) { |
| 133 | if (*Str == '\n' || *Str == SeparatorChar) |
| 134 | atInsnStart = true; |
| 135 | if (atInsnStart && !isspace(*Str)) { |
| 136 | Length += MaxInstLength; |
| 137 | atInsnStart = false; |
| 138 | } |
| 139 | if (atInsnStart && strncmp(Str, CommentString, strlen(CommentString))==0) |
| 140 | atInsnStart = false; |
| 141 | } |
| 142 | |
| 143 | return Length; |
| 144 | } |
| 145 | |
Anton Korobeynikov | 8750d7c | 2008-02-29 22:09:08 +0000 | [diff] [blame] | 146 | unsigned TargetAsmInfo::PreferredEHDataFormat(DwarfEncoding::Target Reason, |
Anton Korobeynikov | 65c0d87 | 2008-02-27 23:33:50 +0000 | [diff] [blame] | 147 | bool Global) const { |
| 148 | return dwarf::DW_EH_PE_absptr; |
| 149 | } |
| 150 | |
Anton Korobeynikov | b4f658c | 2008-06-28 13:45:57 +0000 | [diff] [blame] | 151 | static bool isSuitableForBSS(const GlobalVariable *GV) { |
| 152 | if (!GV->hasInitializer()) |
| 153 | return true; |
| 154 | |
| 155 | // Leave constant zeros in readonly constant sections, so they can be shared |
| 156 | Constant *C = GV->getInitializer(); |
| 157 | return (C->isNullValue() && !GV->isConstant() && !NoZerosInBSS); |
| 158 | } |
| 159 | |
| 160 | SectionKind::Kind |
| 161 | TargetAsmInfo::SectionKindForGlobal(const GlobalValue *GV) const { |
| 162 | // Early exit - functions should be always in text sections. |
| 163 | if (isa<Function>(GV)) |
| 164 | return SectionKind::Text; |
| 165 | |
| 166 | const GlobalVariable* GVar = dyn_cast<GlobalVariable>(GV); |
| 167 | bool isThreadLocal = GVar->isThreadLocal(); |
| 168 | assert(GVar && "Invalid global value for section selection"); |
| 169 | |
Anton Korobeynikov | b4f658c | 2008-06-28 13:45:57 +0000 | [diff] [blame] | 170 | if (isSuitableForBSS(GVar)) { |
| 171 | // Variable can be easily put to BSS section. |
| 172 | return (isThreadLocal ? SectionKind::ThreadBSS : SectionKind::BSS); |
| 173 | } else if (GVar->isConstant() && !isThreadLocal) { |
| 174 | // Now we know, that varible has initializer and it is constant. We need to |
| 175 | // check its initializer to decide, which section to output it into. Also |
| 176 | // note, there is no thread-local r/o section. |
| 177 | Constant *C = GVar->getInitializer(); |
| 178 | if (C->ContainsRelocations()) |
Anton Korobeynikov | b81503c | 2008-07-09 13:24:38 +0000 | [diff] [blame] | 179 | return SectionKind::ROData; |
Anton Korobeynikov | b4f658c | 2008-06-28 13:45:57 +0000 | [diff] [blame] | 180 | else { |
| 181 | const ConstantArray *CVA = dyn_cast<ConstantArray>(C); |
| 182 | // Check, if initializer is a null-terminated string |
| 183 | if (CVA && CVA->isCString()) |
Anton Korobeynikov | b81503c | 2008-07-09 13:24:38 +0000 | [diff] [blame] | 184 | return SectionKind::RODataMergeStr; |
Anton Korobeynikov | b4f658c | 2008-06-28 13:45:57 +0000 | [diff] [blame] | 185 | else |
Anton Korobeynikov | b81503c | 2008-07-09 13:24:38 +0000 | [diff] [blame] | 186 | return SectionKind::RODataMergeConst; |
Anton Korobeynikov | b4f658c | 2008-06-28 13:45:57 +0000 | [diff] [blame] | 187 | } |
| 188 | } |
| 189 | |
| 190 | // Variable is not constant or thread-local - emit to generic data section. |
| 191 | return (isThreadLocal ? SectionKind::ThreadData : SectionKind::Data); |
| 192 | } |
Anton Korobeynikov | b3593bf | 2008-07-09 13:16:59 +0000 | [diff] [blame] | 193 | |
| 194 | unsigned |
| 195 | TargetAsmInfo::SectionFlagsForGlobal(const GlobalValue *GV, |
Anton Korobeynikov | 03db677 | 2008-07-09 13:25:26 +0000 | [diff] [blame^] | 196 | const char* Name) const { |
| 197 | unsigned Flags = SectionFlags::None; |
Anton Korobeynikov | b3593bf | 2008-07-09 13:16:59 +0000 | [diff] [blame] | 198 | |
| 199 | // Decode flags from global itself. |
| 200 | if (GV) { |
Anton Korobeynikov | 03db677 | 2008-07-09 13:25:26 +0000 | [diff] [blame^] | 201 | SectionKind::Kind Kind = SectionKindForGlobal(GV); |
| 202 | switch (Kind) { |
Anton Korobeynikov | b3593bf | 2008-07-09 13:16:59 +0000 | [diff] [blame] | 203 | case SectionKind::Text: |
Anton Korobeynikov | 03db677 | 2008-07-09 13:25:26 +0000 | [diff] [blame^] | 204 | Flags |= SectionFlags::Code; |
Anton Korobeynikov | b3593bf | 2008-07-09 13:16:59 +0000 | [diff] [blame] | 205 | break; |
| 206 | case SectionKind::ThreadData: |
Anton Korobeynikov | 03db677 | 2008-07-09 13:25:26 +0000 | [diff] [blame^] | 207 | Flags |= SectionFlags::TLS; |
Anton Korobeynikov | b3593bf | 2008-07-09 13:16:59 +0000 | [diff] [blame] | 208 | // FALLS THROUGH |
| 209 | case SectionKind::Data: |
Anton Korobeynikov | 03db677 | 2008-07-09 13:25:26 +0000 | [diff] [blame^] | 210 | Flags |= SectionFlags::Writeable; |
Anton Korobeynikov | b3593bf | 2008-07-09 13:16:59 +0000 | [diff] [blame] | 211 | break; |
| 212 | case SectionKind::ThreadBSS: |
Anton Korobeynikov | 03db677 | 2008-07-09 13:25:26 +0000 | [diff] [blame^] | 213 | Flags |= SectionFlags::TLS; |
Anton Korobeynikov | b3593bf | 2008-07-09 13:16:59 +0000 | [diff] [blame] | 214 | // FALLS THROUGH |
| 215 | case SectionKind::BSS: |
Anton Korobeynikov | 03db677 | 2008-07-09 13:25:26 +0000 | [diff] [blame^] | 216 | Flags |= SectionFlags::BSS; |
Anton Korobeynikov | b3593bf | 2008-07-09 13:16:59 +0000 | [diff] [blame] | 217 | break; |
| 218 | case SectionKind::ROData: |
| 219 | // No additional flags here |
| 220 | break; |
| 221 | case SectionKind::RODataMergeStr: |
Anton Korobeynikov | 03db677 | 2008-07-09 13:25:26 +0000 | [diff] [blame^] | 222 | Flags |= SectionFlags::Strings; |
Anton Korobeynikov | b3593bf | 2008-07-09 13:16:59 +0000 | [diff] [blame] | 223 | // FALLS THROUGH |
| 224 | case SectionKind::RODataMergeConst: |
Anton Korobeynikov | 03db677 | 2008-07-09 13:25:26 +0000 | [diff] [blame^] | 225 | Flags |= SectionFlags::Mergeable; |
Anton Korobeynikov | b3593bf | 2008-07-09 13:16:59 +0000 | [diff] [blame] | 226 | break; |
| 227 | default: |
| 228 | assert(0 && "Unexpected section kind!"); |
| 229 | } |
| 230 | |
| 231 | if (GV->hasLinkOnceLinkage() || |
| 232 | GV->hasWeakLinkage() || |
| 233 | GV->hasCommonLinkage()) |
Anton Korobeynikov | 03db677 | 2008-07-09 13:25:26 +0000 | [diff] [blame^] | 234 | Flags |= SectionFlags::Linkonce; |
Anton Korobeynikov | b3593bf | 2008-07-09 13:16:59 +0000 | [diff] [blame] | 235 | } |
| 236 | |
| 237 | // Add flags from sections, if any. |
Anton Korobeynikov | 03db677 | 2008-07-09 13:25:26 +0000 | [diff] [blame^] | 238 | if (Name) { |
| 239 | Flags |= SectionFlags::Named; |
| 240 | |
| 241 | // Some lame default implementation based on some magic section names. |
| 242 | if (strncmp(Name, ".gnu.linkonce.b.", 16) == 0 || |
| 243 | strncmp(Name, ".llvm.linkonce.b.", 17) == 0) |
| 244 | Flags |= SectionFlags::BSS; |
| 245 | else if (strcmp(Name, ".tdata") == 0 || |
| 246 | strncmp(Name, ".tdata.", 7) == 0 || |
| 247 | strncmp(Name, ".gnu.linkonce.td.", 17) == 0 || |
| 248 | strncmp(Name, ".llvm.linkonce.td.", 18) == 0) |
| 249 | Flags |= SectionFlags::TLS; |
| 250 | else if (strcmp(Name, ".tbss") == 0 || |
| 251 | strncmp(Name, ".tbss.", 6) == 0 || |
| 252 | strncmp(Name, ".gnu.linkonce.tb.", 17) == 0 || |
| 253 | strncmp(Name, ".llvm.linkonce.tb.", 18) == 0) |
| 254 | Flags |= SectionFlags::BSS | SectionFlags::TLS; |
Anton Korobeynikov | b3593bf | 2008-07-09 13:16:59 +0000 | [diff] [blame] | 255 | } |
| 256 | |
Anton Korobeynikov | 03db677 | 2008-07-09 13:25:26 +0000 | [diff] [blame^] | 257 | return Flags; |
Anton Korobeynikov | b3593bf | 2008-07-09 13:16:59 +0000 | [diff] [blame] | 258 | } |
Anton Korobeynikov | 562c3f2 | 2008-07-09 13:18:02 +0000 | [diff] [blame] | 259 | |
Anton Korobeynikov | 8bf5d34 | 2008-07-09 13:19:08 +0000 | [diff] [blame] | 260 | std::string |
Anton Korobeynikov | 562c3f2 | 2008-07-09 13:18:02 +0000 | [diff] [blame] | 261 | TargetAsmInfo::SectionForGlobal(const GlobalValue *GV) const { |
Anton Korobeynikov | 03db677 | 2008-07-09 13:25:26 +0000 | [diff] [blame^] | 262 | unsigned Flags = SectionFlagsForGlobal(GV, GV->getSection().c_str()); |
Anton Korobeynikov | 676a625 | 2008-07-09 13:22:46 +0000 | [diff] [blame] | 263 | |
| 264 | std::string Name; |
| 265 | |
Anton Korobeynikov | b900e2b | 2008-07-09 13:23:08 +0000 | [diff] [blame] | 266 | // FIXME: Should we use some hashing based on section name and just check |
| 267 | // flags? |
| 268 | |
Anton Korobeynikov | 676a625 | 2008-07-09 13:22:46 +0000 | [diff] [blame] | 269 | // Select section name |
| 270 | if (GV->hasSection()) { |
| 271 | // Honour section already set, if any |
| 272 | Name = GV->getSection(); |
| 273 | } else { |
| 274 | // Use default section depending on the 'type' of global |
| 275 | Name = SelectSectionForGlobal(GV); |
| 276 | } |
| 277 | |
Anton Korobeynikov | 03db677 | 2008-07-09 13:25:26 +0000 | [diff] [blame^] | 278 | // If section is named we need to switch into it via special '.section' |
| 279 | // directive and also append funky flags. Otherwise - section name is just |
| 280 | // some magic assembler directive. |
| 281 | if (Flags & SectionFlags::Named) |
| 282 | Name = SwitchToSectionDirective + Name + PrintSectionFlags(Flags); |
| 283 | |
Anton Korobeynikov | 676a625 | 2008-07-09 13:22:46 +0000 | [diff] [blame] | 284 | return Name; |
| 285 | } |
| 286 | |
| 287 | // Lame default implementation. Calculate the section name for global. |
| 288 | std::string |
| 289 | TargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const { |
Anton Korobeynikov | 03db677 | 2008-07-09 13:25:26 +0000 | [diff] [blame^] | 290 | SectionKind::Kind Kind = SectionKindForGlobal(GV); |
Anton Korobeynikov | 562c3f2 | 2008-07-09 13:18:02 +0000 | [diff] [blame] | 291 | |
Anton Korobeynikov | 676a625 | 2008-07-09 13:22:46 +0000 | [diff] [blame] | 292 | if (GV->hasLinkOnceLinkage() || |
| 293 | GV->hasWeakLinkage() || |
| 294 | GV->hasCommonLinkage()) |
Anton Korobeynikov | 03db677 | 2008-07-09 13:25:26 +0000 | [diff] [blame^] | 295 | return UniqueSectionForGlobal(GV, Kind); |
Anton Korobeynikov | 676a625 | 2008-07-09 13:22:46 +0000 | [diff] [blame] | 296 | else { |
Anton Korobeynikov | 03db677 | 2008-07-09 13:25:26 +0000 | [diff] [blame^] | 297 | if (Kind == SectionKind::Text) |
Anton Korobeynikov | 676a625 | 2008-07-09 13:22:46 +0000 | [diff] [blame] | 298 | return getTextSection(); |
Anton Korobeynikov | 03db677 | 2008-07-09 13:25:26 +0000 | [diff] [blame^] | 299 | else if (Kind == SectionKind::BSS && getBSSSection()) |
Anton Korobeynikov | 676a625 | 2008-07-09 13:22:46 +0000 | [diff] [blame] | 300 | return getBSSSection(); |
| 301 | else if (getReadOnlySection() && |
Anton Korobeynikov | 03db677 | 2008-07-09 13:25:26 +0000 | [diff] [blame^] | 302 | (Kind == SectionKind::ROData || |
| 303 | Kind == SectionKind::RODataMergeConst || |
| 304 | Kind == SectionKind::RODataMergeStr)) |
Anton Korobeynikov | 676a625 | 2008-07-09 13:22:46 +0000 | [diff] [blame] | 305 | return getReadOnlySection(); |
| 306 | } |
Anton Korobeynikov | 562c3f2 | 2008-07-09 13:18:02 +0000 | [diff] [blame] | 307 | |
| 308 | return getDataSection(); |
| 309 | } |
Anton Korobeynikov | 3819e2d | 2008-07-09 13:19:38 +0000 | [diff] [blame] | 310 | |
| 311 | std::string |
| 312 | TargetAsmInfo::UniqueSectionForGlobal(const GlobalValue* GV, |
Anton Korobeynikov | 03db677 | 2008-07-09 13:25:26 +0000 | [diff] [blame^] | 313 | SectionKind::Kind Kind) const { |
| 314 | switch (Kind) { |
Anton Korobeynikov | 3819e2d | 2008-07-09 13:19:38 +0000 | [diff] [blame] | 315 | case SectionKind::Text: |
Anton Korobeynikov | a3d07de | 2008-07-09 13:24:55 +0000 | [diff] [blame] | 316 | return ".gnu.linkonce.t." + GV->getName(); |
Anton Korobeynikov | 3819e2d | 2008-07-09 13:19:38 +0000 | [diff] [blame] | 317 | case SectionKind::Data: |
Anton Korobeynikov | a3d07de | 2008-07-09 13:24:55 +0000 | [diff] [blame] | 318 | return ".gnu.linkonce.d." + GV->getName(); |
Anton Korobeynikov | 3819e2d | 2008-07-09 13:19:38 +0000 | [diff] [blame] | 319 | case SectionKind::BSS: |
Anton Korobeynikov | a3d07de | 2008-07-09 13:24:55 +0000 | [diff] [blame] | 320 | return ".gnu.linkonce.b." + GV->getName(); |
Anton Korobeynikov | 3819e2d | 2008-07-09 13:19:38 +0000 | [diff] [blame] | 321 | case SectionKind::ROData: |
| 322 | case SectionKind::RODataMergeConst: |
| 323 | case SectionKind::RODataMergeStr: |
Anton Korobeynikov | a3d07de | 2008-07-09 13:24:55 +0000 | [diff] [blame] | 324 | return ".gnu.linkonce.r." + GV->getName(); |
Anton Korobeynikov | 3819e2d | 2008-07-09 13:19:38 +0000 | [diff] [blame] | 325 | case SectionKind::ThreadData: |
Anton Korobeynikov | a3d07de | 2008-07-09 13:24:55 +0000 | [diff] [blame] | 326 | return ".gnu.linkonce.td." + GV->getName(); |
Anton Korobeynikov | 3819e2d | 2008-07-09 13:19:38 +0000 | [diff] [blame] | 327 | case SectionKind::ThreadBSS: |
Anton Korobeynikov | a3d07de | 2008-07-09 13:24:55 +0000 | [diff] [blame] | 328 | return ".gnu.linkonce.tb." + GV->getName(); |
Anton Korobeynikov | 3819e2d | 2008-07-09 13:19:38 +0000 | [diff] [blame] | 329 | default: |
| 330 | assert(0 && "Unknown section kind"); |
| 331 | } |
| 332 | } |