llvm.org GIT mirror llvm / 287df1b
delete a forwarding function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100815 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 10 years ago
6 changed file(s) with 111 addition(s) and 113 deletion(s). Raw diff Collapse all Expand all
5050 const MCSection *MergeableConst4Section;
5151 const MCSection *MergeableConst8Section;
5252 const MCSection *MergeableConst16Section;
53
54 protected:
55 const MCSection *getELFSection(StringRef Section, unsigned Type,
56 unsigned Flags, SectionKind Kind,
57 bool IsExplicit = false) const;
5853 public:
5954 TargetLoweringObjectFileELF() {}
6055 ~TargetLoweringObjectFileELF() {}
9595
9696 const MCSection *getELFSection(StringRef Section, unsigned Type,
9797 unsigned Flags, SectionKind Kind,
98 bool IsExplicit);
98 bool IsExplicit = false);
9999
100100 /// @}
101101
3838 // ELF
3939 //===----------------------------------------------------------------------===//
4040
41 const MCSection *TargetLoweringObjectFileELF::
42 getELFSection(StringRef Section, unsigned Type, unsigned Flags,
43 SectionKind Kind, bool IsExplicit) const {
44 return getContext().getELFSection(Section, Type, Flags, Kind, IsExplicit);
45
46 }
47
4841 void TargetLoweringObjectFileELF::Initialize(MCContext &Ctx,
4942 const TargetMachine &TM) {
5043 TargetLoweringObjectFile::Initialize(Ctx, TM);
5144
5245 BSSSection =
53 getELFSection(".bss", MCSectionELF::SHT_NOBITS,
54 MCSectionELF::SHF_WRITE | MCSectionELF::SHF_ALLOC,
55 SectionKind::getBSS());
46 getContext().getELFSection(".bss", MCSectionELF::SHT_NOBITS,
47 MCSectionELF::SHF_WRITE |MCSectionELF::SHF_ALLOC,
48 SectionKind::getBSS());
5649
5750 TextSection =
58 getELFSection(".text", MCSectionELF::SHT_PROGBITS,
59 MCSectionELF::SHF_EXECINSTR | MCSectionELF::SHF_ALLOC,
60 SectionKind::getText());
51 getContext().getELFSection(".text", MCSectionELF::SHT_PROGBITS,
52 MCSectionELF::SHF_EXECINSTR |
53 MCSectionELF::SHF_ALLOC,
54 SectionKind::getText());
6155
6256 DataSection =
63 getELFSection(".data", MCSectionELF::SHT_PROGBITS,
64 MCSectionELF::SHF_WRITE | MCSectionELF::SHF_ALLOC,
65 SectionKind::getDataRel());
57 getContext().getELFSection(".data", MCSectionELF::SHT_PROGBITS,
58 MCSectionELF::SHF_WRITE |MCSectionELF::SHF_ALLOC,
59 SectionKind::getDataRel());
6660
6761 ReadOnlySection =
68 getELFSection(".rodata", MCSectionELF::SHT_PROGBITS,
69 MCSectionELF::SHF_ALLOC,
70 SectionKind::getReadOnly());
62 getContext().getELFSection(".rodata", MCSectionELF::SHT_PROGBITS,
63 MCSectionELF::SHF_ALLOC,
64 SectionKind::getReadOnly());
7165
7266 TLSDataSection =
73 getELFSection(".tdata", MCSectionELF::SHT_PROGBITS,
74 MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_TLS |
75 MCSectionELF::SHF_WRITE, SectionKind::getThreadData());
67 getContext().getELFSection(".tdata", MCSectionELF::SHT_PROGBITS,
68 MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_TLS |
69 MCSectionELF::SHF_WRITE,
70 SectionKind::getThreadData());
7671
7772 TLSBSSSection =
78 getELFSection(".tbss", MCSectionELF::SHT_NOBITS,
79 MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_TLS |
80 MCSectionELF::SHF_WRITE, SectionKind::getThreadBSS());
73 getContext().getELFSection(".tbss", MCSectionELF::SHT_NOBITS,
74 MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_TLS |
75 MCSectionELF::SHF_WRITE,
76 SectionKind::getThreadBSS());
8177
8278 DataRelSection =
83 getELFSection(".data.rel", MCSectionELF::SHT_PROGBITS,
84 MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_WRITE,
85 SectionKind::getDataRel());
79 getContext().getELFSection(".data.rel", MCSectionELF::SHT_PROGBITS,
80 MCSectionELF::SHF_ALLOC |MCSectionELF::SHF_WRITE,
81 SectionKind::getDataRel());
8682
8783 DataRelLocalSection =
88 getELFSection(".data.rel.local", MCSectionELF::SHT_PROGBITS,
89 MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_WRITE,
90 SectionKind::getDataRelLocal());
84 getContext().getELFSection(".data.rel.local", MCSectionELF::SHT_PROGBITS,
85 MCSectionELF::SHF_ALLOC |MCSectionELF::SHF_WRITE,
86 SectionKind::getDataRelLocal());
9187
9288 DataRelROSection =
93 getELFSection(".data.rel.ro", MCSectionELF::SHT_PROGBITS,
94 MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_WRITE,
95 SectionKind::getReadOnlyWithRel());
89 getContext().getELFSection(".data.rel.ro", MCSectionELF::SHT_PROGBITS,
90 MCSectionELF::SHF_ALLOC |MCSectionELF::SHF_WRITE,
91 SectionKind::getReadOnlyWithRel());
9692
9793 DataRelROLocalSection =
98 getELFSection(".data.rel.ro.local", MCSectionELF::SHT_PROGBITS,
99 MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_WRITE,
100 SectionKind::getReadOnlyWithRelLocal());
94 getContext().getELFSection(".data.rel.ro.local", MCSectionELF::SHT_PROGBITS,
95 MCSectionELF::SHF_ALLOC |MCSectionELF::SHF_WRITE,
96 SectionKind::getReadOnlyWithRelLocal());
10197
10298 MergeableConst4Section =
103 getELFSection(".rodata.cst4", MCSectionELF::SHT_PROGBITS,
104 MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_MERGE,
105 SectionKind::getMergeableConst4());
99 getContext().getELFSection(".rodata.cst4", MCSectionELF::SHT_PROGBITS,
100 MCSectionELF::SHF_ALLOC |MCSectionELF::SHF_MERGE,
101 SectionKind::getMergeableConst4());
106102
107103 MergeableConst8Section =
108 getELFSection(".rodata.cst8", MCSectionELF::SHT_PROGBITS,
109 MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_MERGE,
110 SectionKind::getMergeableConst8());
104 getContext().getELFSection(".rodata.cst8", MCSectionELF::SHT_PROGBITS,
105 MCSectionELF::SHF_ALLOC |MCSectionELF::SHF_MERGE,
106 SectionKind::getMergeableConst8());
111107
112108 MergeableConst16Section =
113 getELFSection(".rodata.cst16", MCSectionELF::SHT_PROGBITS,
114 MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_MERGE,
115 SectionKind::getMergeableConst16());
109 getContext().getELFSection(".rodata.cst16", MCSectionELF::SHT_PROGBITS,
110 MCSectionELF::SHF_ALLOC |MCSectionELF::SHF_MERGE,
111 SectionKind::getMergeableConst16());
116112
117113 StaticCtorSection =
118 getELFSection(".ctors", MCSectionELF::SHT_PROGBITS,
119 MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_WRITE,
120 SectionKind::getDataRel());
114 getContext().getELFSection(".ctors", MCSectionELF::SHT_PROGBITS,
115 MCSectionELF::SHF_ALLOC |MCSectionELF::SHF_WRITE,
116 SectionKind::getDataRel());
121117
122118 StaticDtorSection =
123 getELFSection(".dtors", MCSectionELF::SHT_PROGBITS,
124 MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_WRITE,
125 SectionKind::getDataRel());
119 getContext().getELFSection(".dtors", MCSectionELF::SHT_PROGBITS,
120 MCSectionELF::SHF_ALLOC |MCSectionELF::SHF_WRITE,
121 SectionKind::getDataRel());
126122
127123 // Exception Handling Sections.
128124
131127 // runtime hit for C++ apps. Either the contents of the LSDA need to be
132128 // adjusted or this should be a data section.
133129 LSDASection =
134 getELFSection(".gcc_except_table", MCSectionELF::SHT_PROGBITS,
135 MCSectionELF::SHF_ALLOC, SectionKind::getReadOnly());
130 getContext().getELFSection(".gcc_except_table", MCSectionELF::SHT_PROGBITS,
131 MCSectionELF::SHF_ALLOC,
132 SectionKind::getReadOnly());
136133 EHFrameSection =
137 getELFSection(".eh_frame", MCSectionELF::SHT_PROGBITS,
138 MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_WRITE,
139 SectionKind::getDataRel());
134 getContext().getELFSection(".eh_frame", MCSectionELF::SHT_PROGBITS,
135 MCSectionELF::SHF_ALLOC |MCSectionELF::SHF_WRITE,
136 SectionKind::getDataRel());
140137
141138 // Debug Info Sections.
142139 DwarfAbbrevSection =
143 getELFSection(".debug_abbrev", MCSectionELF::SHT_PROGBITS, 0,
144 SectionKind::getMetadata());
140 getContext().getELFSection(".debug_abbrev", MCSectionELF::SHT_PROGBITS, 0,
141 SectionKind::getMetadata());
145142 DwarfInfoSection =
146 getELFSection(".debug_info", MCSectionELF::SHT_PROGBITS, 0,
147 SectionKind::getMetadata());
143 getContext().getELFSection(".debug_info", MCSectionELF::SHT_PROGBITS, 0,
144 SectionKind::getMetadata());
148145 DwarfLineSection =
149 getELFSection(".debug_line", MCSectionELF::SHT_PROGBITS, 0,
150 SectionKind::getMetadata());
146 getContext().getELFSection(".debug_line", MCSectionELF::SHT_PROGBITS, 0,
147 SectionKind::getMetadata());
151148 DwarfFrameSection =
152 getELFSection(".debug_frame", MCSectionELF::SHT_PROGBITS, 0,
153 SectionKind::getMetadata());
149 getContext().getELFSection(".debug_frame", MCSectionELF::SHT_PROGBITS, 0,
150 SectionKind::getMetadata());
154151 DwarfPubNamesSection =
155 getELFSection(".debug_pubnames", MCSectionELF::SHT_PROGBITS, 0,
156 SectionKind::getMetadata());
152 getContext().getELFSection(".debug_pubnames", MCSectionELF::SHT_PROGBITS, 0,
153 SectionKind::getMetadata());
157154 DwarfPubTypesSection =
158 getELFSection(".debug_pubtypes", MCSectionELF::SHT_PROGBITS, 0,
159 SectionKind::getMetadata());
155 getContext().getELFSection(".debug_pubtypes", MCSectionELF::SHT_PROGBITS, 0,
156 SectionKind::getMetadata());
160157 DwarfStrSection =
161 getELFSection(".debug_str", MCSectionELF::SHT_PROGBITS, 0,
162 SectionKind::getMetadata());
158 getContext().getELFSection(".debug_str", MCSectionELF::SHT_PROGBITS, 0,
159 SectionKind::getMetadata());
163160 DwarfLocSection =
164 getELFSection(".debug_loc", MCSectionELF::SHT_PROGBITS, 0,
165 SectionKind::getMetadata());
161 getContext().getELFSection(".debug_loc", MCSectionELF::SHT_PROGBITS, 0,
162 SectionKind::getMetadata());
166163 DwarfARangesSection =
167 getELFSection(".debug_aranges", MCSectionELF::SHT_PROGBITS, 0,
168 SectionKind::getMetadata());
164 getContext().getELFSection(".debug_aranges", MCSectionELF::SHT_PROGBITS, 0,
165 SectionKind::getMetadata());
169166 DwarfRangesSection =
170 getELFSection(".debug_ranges", MCSectionELF::SHT_PROGBITS, 0,
171 SectionKind::getMetadata());
167 getContext().getELFSection(".debug_ranges", MCSectionELF::SHT_PROGBITS, 0,
168 SectionKind::getMetadata());
172169 DwarfMacroInfoSection =
173 getELFSection(".debug_macinfo", MCSectionELF::SHT_PROGBITS, 0,
174 SectionKind::getMetadata());
170 getContext().getELFSection(".debug_macinfo", MCSectionELF::SHT_PROGBITS, 0,
171 SectionKind::getMetadata());
175172 }
176173
177174
260257 // Infer section flags from the section name if we can.
261258 Kind = getELFKindForNamedSection(SectionName, Kind);
262259
263 return getELFSection(SectionName,
264 getELFSectionType(SectionName, Kind),
265 getELFSectionFlags(Kind), Kind, true);
260 return getContext().getELFSection(SectionName,
261 getELFSectionType(SectionName, Kind),
262 getELFSectionFlags(Kind), Kind, true);
266263 }
267264
268265 static const char *getSectionPrefixForUniqueGlobal(SectionKind Kind) {
292289 SmallString<128> Name(Prefix, Prefix+strlen(Prefix));
293290 MCSymbol *Sym = Mang->getSymbol(GV);
294291 Name.append(Sym->getName().begin(), Sym->getName().end());
295 return getELFSection(Name.str(), getELFSectionType(Name.str(), Kind),
296 getELFSectionFlags(Kind), Kind);
292 return getContext().getELFSection(Name.str(),
293 getELFSectionType(Name.str(), Kind),
294 getELFSectionFlags(Kind), Kind);
297295 }
298296
299297 if (Kind.isText()) return TextSection;
318316
319317
320318 std::string Name = SizeSpec + utostr(Align);
321 return getELFSection(Name, MCSectionELF::SHT_PROGBITS,
322 MCSectionELF::SHF_ALLOC |
323 MCSectionELF::SHF_MERGE |
324 MCSectionELF::SHF_STRINGS,
325 Kind);
319 return getContext().getELFSection(Name, MCSectionELF::SHT_PROGBITS,
320 MCSectionELF::SHF_ALLOC |
321 MCSectionELF::SHF_MERGE |
322 MCSectionELF::SHF_STRINGS,
323 Kind);
326324 }
327325
328326 if (Kind.isMergeableConst()) {
88
99 #include "ARMTargetObjectFile.h"
1010 #include "ARMSubtarget.h"
11 #include "llvm/MC/MCContext.h"
1112 #include "llvm/MC/MCSectionELF.h"
1213 #include "llvm/Support/Dwarf.h"
1314 #include "llvm/Target/TargetMachine.h"
2425
2526 if (TM.getSubtarget().isAAPCS_ABI()) {
2627 StaticCtorSection =
27 getELFSection(".init_array", MCSectionELF::SHT_INIT_ARRAY,
28 MCSectionELF::SHF_WRITE | MCSectionELF::SHF_ALLOC,
29 SectionKind::getDataRel());
28 getContext().getELFSection(".init_array", MCSectionELF::SHT_INIT_ARRAY,
29 MCSectionELF::SHF_WRITE |
30 MCSectionELF::SHF_ALLOC,
31 SectionKind::getDataRel());
3032 StaticDtorSection =
31 getELFSection(".fini_array", MCSectionELF::SHT_FINI_ARRAY,
32 MCSectionELF::SHF_WRITE | MCSectionELF::SHF_ALLOC,
33 SectionKind::getDataRel());
33 getContext().getELFSection(".fini_array", MCSectionELF::SHT_FINI_ARRAY,
34 MCSectionELF::SHF_WRITE |
35 MCSectionELF::SHF_ALLOC,
36 SectionKind::getDataRel());
3437 }
3538 }
1010 #include "MBlazeSubtarget.h"
1111 #include "llvm/DerivedTypes.h"
1212 #include "llvm/GlobalVariable.h"
13 #include "llvm/MC/MCContext.h"
1314 #include "llvm/MC/MCSectionELF.h"
1415 #include "llvm/Target/TargetData.h"
1516 #include "llvm/Target/TargetMachine.h"
2122 TargetLoweringObjectFileELF::Initialize(Ctx, TM);
2223
2324 SmallDataSection =
24 getELFSection(".sdata", MCSectionELF::SHT_PROGBITS,
25 MCSectionELF::SHF_WRITE | MCSectionELF::SHF_ALLOC,
26 SectionKind::getDataRel());
25 getContext().getELFSection(".sdata", MCSectionELF::SHT_PROGBITS,
26 MCSectionELF::SHF_WRITE |MCSectionELF::SHF_ALLOC,
27 SectionKind::getDataRel());
2728
2829 SmallBSSSection =
29 getELFSection(".sbss", MCSectionELF::SHT_NOBITS,
30 MCSectionELF::SHF_WRITE | MCSectionELF::SHF_ALLOC,
31 SectionKind::getBSS());
30 getContext().getELFSection(".sbss", MCSectionELF::SHT_NOBITS,
31 MCSectionELF::SHF_WRITE |MCSectionELF::SHF_ALLOC,
32 SectionKind::getBSS());
3233
3334 }
3435
1010 #include "MipsSubtarget.h"
1111 #include "llvm/DerivedTypes.h"
1212 #include "llvm/GlobalVariable.h"
13 #include "llvm/MC/MCContext.h"
1314 #include "llvm/MC/MCSectionELF.h"
1415 #include "llvm/Target/TargetData.h"
1516 #include "llvm/Target/TargetMachine.h"
2526 TargetLoweringObjectFileELF::Initialize(Ctx, TM);
2627
2728 SmallDataSection =
28 getELFSection(".sdata", MCSectionELF::SHT_PROGBITS,
29 MCSectionELF::SHF_WRITE | MCSectionELF::SHF_ALLOC,
30 SectionKind::getDataRel());
29 getContext().getELFSection(".sdata", MCSectionELF::SHT_PROGBITS,
30 MCSectionELF::SHF_WRITE |MCSectionELF::SHF_ALLOC,
31 SectionKind::getDataRel());
3132
3233 SmallBSSSection =
33 getELFSection(".sbss", MCSectionELF::SHT_NOBITS,
34 MCSectionELF::SHF_WRITE | MCSectionELF::SHF_ALLOC,
35 SectionKind::getBSS());
34 getContext().getELFSection(".sbss", MCSectionELF::SHT_NOBITS,
35 MCSectionELF::SHF_WRITE |MCSectionELF::SHF_ALLOC,
36 SectionKind::getBSS());
3637
3738 }
3839