llvm.org GIT mirror llvm / 00181a3
Get rid of ReadOnlySection duplicate git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56582 91177308-0d34-0410-b5e6-96231b3b80d8 Anton Korobeynikov 11 years ago
8 changed file(s) with 17 addition(s) and 29 deletion(s). Raw diff Collapse all Expand all
145145 /// ReadOnlySection - This is the directive that is emitted to switch to a
146146 /// read-only section for constant data (e.g. data declared const,
147147 /// jump tables).
148 const char *ReadOnlySection; // Defaults to NULL
149 const Section *ReadOnlySection_;
148 const Section *ReadOnlySection; // Defaults to NULL
150149
151150 /// SmallDataSection - This is the directive that is emitted to switch to a
152151 /// small data section.
596595 const Section *getBSSSection_() const {
597596 return BSSSection_;
598597 }
599 const char *getReadOnlySection() const {
598 const Section *getReadOnlySection() const {
600599 return ReadOnlySection;
601 }
602 const Section *getReadOnlySection_() const {
603 return ReadOnlySection_;
604600 }
605601 const Section *getSmallDataSection() const {
606602 return SmallDataSection;
7171 ProtectedDirective = NULL;
7272 JumpTableDataSection = ".const";
7373 CStringSection = "\t.cstring";
74 ReadOnlySection = "\t.const\n";
7574 HasDotTypeDotSizeDirective = false;
7675 NeedsIndirectEncoding = true;
7776 if (TM.getRelocationModel() == Reloc::Static) {
111110 HasLEB128 = true;
112111 AbsoluteDebugSectionOffsets = true;
113112 CStringSection = ".rodata.str";
114 ReadOnlySection = "\t.section\t.rodata\n";
115113 PrivateGlobalPrefix = ".L";
116114 WeakRefDirective = "\t.weak\t";
117115 SetDirective = "\t.set\t";
3737 // there, if needed.
3838 SixteenByteConstantSection = 0;
3939
40 ReadOnlySection_ = getUnnamedSection("\t.const\n", SectionFlags::None);
40 ReadOnlySection = getUnnamedSection("\t.const\n", SectionFlags::None);
4141
4242 TextCoalSection =
4343 getNamedSection("\t__TEXT,__textcoal_nt,coalesced,pure_instructions",
4444 SectionFlags::Code);
45 ConstDataCoalSection = getBamedSection("\t__DATA,__const_coal,coalesced",
45 ConstDataCoalSection = getNamedSection("\t__DATA,__const_coal,coalesced",
4646 SectionFlags::None);
4747 ConstDataSection = getUnnamedSection(".const_data", SectionFlags::None);
4848 DataCoalSection = getNamedSection("\t__DATA,__datacoal_nt,coalesced",
9191 return (isWeak ? DataCoalSection : DataSection);
9292 case SectionKind::ROData:
9393 return (isWeak ? ConstDataCoalSection :
94 (isNonStatic ? ConstDataSection : getReadOnlySection_()));
94 (isNonStatic ? ConstDataSection : getReadOnlySection()));
9595 case SectionKind::RODataMergeStr:
9696 return (isWeak ?
9797 ConstDataCoalSection :
121121 return getCStringSection_();
122122 }
123123
124 return getReadOnlySection_();
124 return getReadOnlySection();
125125 }
126126
127127 const Section*
143143 else if (Size == 16 && SixteenByteConstantSection)
144144 return SixteenByteConstantSection;
145145
146 return getReadOnlySection_();
146 return getReadOnlySection();
147147 }
148148
149149 const Section*
151151 const Section* S = MergeableConstSection(Ty);
152152
153153 // Handle weird special case, when compiling PIC stuff.
154 if (S == getReadOnlySection_() &&
154 if (S == getReadOnlySection() &&
155155 DTM->getRelocationModel() != Reloc::Static)
156156 return ConstDataSection;
157157
2828
2929 BSSSection_ = getUnnamedSection("\t.bss",
3030 SectionFlags::Writeable | SectionFlags::BSS);
31 ReadOnlySection_ = getNamedSection("\t.rodata", SectionFlags::None);
31 ReadOnlySection = getNamedSection("\t.rodata", SectionFlags::None);
3232 TLSDataSection = getNamedSection("\t.tdata",
3333 SectionFlags::Writeable | SectionFlags::TLS);
3434 TLSBSSSection = getNamedSection("\t.tbss",
6969 return getBSSSection_();
7070 case SectionKind::ROData:
7171 case SectionKind::SmallROData:
72 return getReadOnlySection_();
72 return getReadOnlySection();
7373 case SectionKind::RODataMergeStr:
7474 return MergeableStringSection(GVar);
7575 case SectionKind::RODataMergeConst:
115115 Size));
116116 }
117117
118 return getReadOnlySection_();
118 return getReadOnlySection();
119119 }
120120
121121 const Section*
142142 return getNamedSection(Name.c_str(), Flags);
143143 }
144144
145 return getReadOnlySection_();
145 return getReadOnlySection();
146146 }
147147
148148 std::string ELFTargetAsmInfo::printSectionFlags(unsigned flags) const {
2929 PrivateGlobalPrefix = "$";
3030 JumpTableDataSection = "\t.rdata";
3131 CommentString = "#";
32 ReadOnlySection = "\t.rdata";
3332 ZeroDirective = "\t.space\t";
3433 BSSSection = "\t.section\t.bss";
3534 CStringSection = ".rodata.str";
3736 if (!Subtarget->hasABICall()) {
3837 JumpTableDirective = "\t.word\t";
3938 SmallDataSection = getNamedSection("\t.sdata", SectionFlags::Writeable);
40 SmallBSSSection = getNamedSection("\t.sbss", SectionFlags::Writeable |
39 SmallBSSSection = getNamedSection("\t.sbss",
40 SectionFlags::Writeable |
4141 SectionFlags::BSS);
42 } else
42 } else
4343 JumpTableDirective = "\t.gpword\t";
4444
4545 }
4242 ConstantPoolSection = "\t.const\t";
4343 JumpTableDataSection = ".const";
4444 CStringSection = "\t.cstring";
45 ReadOnlySection = "\t.const\n";
4645 if (TM.getRelocationModel() == Reloc::Static) {
4746 StaticCtorsSection = ".constructor";
4847 StaticDtorsSection = ".destructor";
136135 DwarfRangesSection = "\t.section\t.debug_ranges,\"\",@progbits";
137136 DwarfMacInfoSection = "\t.section\t.debug_macinfo,\"\",@progbits";
138137
139 ReadOnlySection = "\t.section\t.rodata";
140138 PCSymbol = ".";
141139
142140 // Set up DWARF directives
3030 BSSSection("\t.bss"),
3131 BSSSection_(0),
3232 ReadOnlySection(0),
33 ReadOnlySection_(0),
3433 SmallDataSection(0),
3534 SmallBSSSection(0),
3635 SmallRODataSection(0),
292291 return getTextSection();
293292 else if (isBSS(Kind) && getBSSSection_())
294293 return getBSSSection_();
295 else if (getReadOnlySection_() && SectionKind::isReadOnly(Kind))
296 return getReadOnlySection_();
294 else if (getReadOnlySection() && SectionKind::isReadOnly(Kind))
295 return getReadOnlySection();
297296 }
298297
299298 return getDataSection();
149149 SixteenByteConstantSection = getUnnamedSection("\t.literal16\n",
150150 SectionFlags::Mergeable);
151151 }
152 ReadOnlySection = "\t.const\n";
153
154152 LCOMMDirective = "\t.lcomm\t";
155153 SwitchToSectionDirective = "\t.section ";
156154 StringConstantPrefix = "\1LC";
228226 X86ELFTargetAsmInfo::X86ELFTargetAsmInfo(const X86TargetMachine &TM):
229227 X86TargetAsmInfo(TM), ELFTargetAsmInfo(TM) {
230228
231 ReadOnlySection = ".rodata";
232229 CStringSection = ".rodata.str";
233230 PrivateGlobalPrefix = ".L";
234231 WeakRefDirective = "\t.weak\t";