llvm.org GIT mirror llvm / c85dca6
Remove duplicated code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124054 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 9 years ago
12 changed file(s) with 91 addition(s) and 153 deletion(s). Raw diff Collapse all Expand all
5757 /// indicated on the ELF object file by a symbol with SHN_COMMON section
5858 /// header index.
5959 bool HasCommonSymbols() const;
60
61 /// These are the section type and flags fields. An ELF section can have
62 /// only one Type, but can have more than one of the flags specified.
63 ///
64 /// Valid section types.
65 enum {
66 // This value marks the section header as inactive.
67 SHT_NULL = 0x00U,
68
69 // Holds information defined by the program, with custom format and meaning.
70 SHT_PROGBITS = 0x01U,
71
72 // This section holds a symbol table.
73 SHT_SYMTAB = 0x02U,
74
75 // The section holds a string table.
76 SHT_STRTAB = 0x03U,
77
78 // The section holds relocation entries with explicit addends.
79 SHT_RELA = 0x04U,
80
81 // The section holds a symbol hash table.
82 SHT_HASH = 0x05U,
83
84 // Information for dynamic linking.
85 SHT_DYNAMIC = 0x06U,
86
87 // The section holds information that marks the file in some way.
88 SHT_NOTE = 0x07U,
89
90 // A section of this type occupies no space in the file.
91 SHT_NOBITS = 0x08U,
92
93 // The section holds relocation entries without explicit addends.
94 SHT_REL = 0x09U,
95
96 // This section type is reserved but has unspecified semantics.
97 SHT_SHLIB = 0x0AU,
98
99 // This section holds a symbol table.
100 SHT_DYNSYM = 0x0BU,
101
102 // This section contains an array of pointers to initialization functions.
103 SHT_INIT_ARRAY = 0x0EU,
104
105 // This section contains an array of pointers to termination functions.
106 SHT_FINI_ARRAY = 0x0FU,
107
108 // This section contains an array of pointers to functions that are invoked
109 // before all other initialization functions.
110 SHT_PREINIT_ARRAY = 0x10U,
111
112 // A section group is a set of sections that are related and that must be
113 // treated specially by the linker.
114 SHT_GROUP = 0x11U,
115
116 // This section is associated with a section of type SHT_SYMTAB, when the
117 // referenced symbol table contain the escape value SHN_XINDEX
118 SHT_SYMTAB_SHNDX = 0x12U,
119
120 // Start of target-specific flags.
121
122 // Exception Index table
123 SHT_ARM_EXIDX = 0x70000001U,
124 // BPABI DLL dynamic linking pre-emption map
125 SHT_ARM_PREEMPTMAP = 0x70000002U,
126 // Object file compatibility attributes
127 SHT_ARM_ATTRIBUTES = 0x70000003U,
128 SHT_ARM_DEBUGOVERLAY = 0x70000004U,
129 SHT_ARM_OVERLAYSECTION = 0x70000005U,
130
131 LAST_KNOWN_SECTION_TYPE = SHT_ARM_OVERLAYSECTION
132 };
13360
13461 /// Valid section flags.
13562 enum {
2828 #include "llvm/Target/TargetMachine.h"
2929 #include "llvm/Target/TargetOptions.h"
3030 #include "llvm/Support/Dwarf.h"
31 #include "llvm/Support/ELF.h"
3132 #include "llvm/Support/ErrorHandling.h"
3233 #include "llvm/Support/raw_ostream.h"
3334 #include "llvm/ADT/SmallString.h"
4546 TargetLoweringObjectFile::Initialize(Ctx, TM);
4647
4748 BSSSection =
48 getContext().getELFSection(".bss", MCSectionELF::SHT_NOBITS,
49 getContext().getELFSection(".bss", ELF::SHT_NOBITS,
4950 MCSectionELF::SHF_WRITE |MCSectionELF::SHF_ALLOC,
5051 SectionKind::getBSS());
5152
5253 TextSection =
53 getContext().getELFSection(".text", MCSectionELF::SHT_PROGBITS,
54 getContext().getELFSection(".text", ELF::SHT_PROGBITS,
5455 MCSectionELF::SHF_EXECINSTR |
5556 MCSectionELF::SHF_ALLOC,
5657 SectionKind::getText());
5758
5859 DataSection =
59 getContext().getELFSection(".data", MCSectionELF::SHT_PROGBITS,
60 getContext().getELFSection(".data", ELF::SHT_PROGBITS,
6061 MCSectionELF::SHF_WRITE |MCSectionELF::SHF_ALLOC,
6162 SectionKind::getDataRel());
6263
6364 ReadOnlySection =
64 getContext().getELFSection(".rodata", MCSectionELF::SHT_PROGBITS,
65 getContext().getELFSection(".rodata", ELF::SHT_PROGBITS,
6566 MCSectionELF::SHF_ALLOC,
6667 SectionKind::getReadOnly());
6768
6869 TLSDataSection =
69 getContext().getELFSection(".tdata", MCSectionELF::SHT_PROGBITS,
70 getContext().getELFSection(".tdata", ELF::SHT_PROGBITS,
7071 MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_TLS |
7172 MCSectionELF::SHF_WRITE,
7273 SectionKind::getThreadData());
7374
7475 TLSBSSSection =
75 getContext().getELFSection(".tbss", MCSectionELF::SHT_NOBITS,
76 getContext().getELFSection(".tbss", ELF::SHT_NOBITS,
7677 MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_TLS |
7778 MCSectionELF::SHF_WRITE,
7879 SectionKind::getThreadBSS());
7980
8081 DataRelSection =
81 getContext().getELFSection(".data.rel", MCSectionELF::SHT_PROGBITS,
82 getContext().getELFSection(".data.rel", ELF::SHT_PROGBITS,
8283 MCSectionELF::SHF_ALLOC |MCSectionELF::SHF_WRITE,
8384 SectionKind::getDataRel());
8485
8586 DataRelLocalSection =
86 getContext().getELFSection(".data.rel.local", MCSectionELF::SHT_PROGBITS,
87 getContext().getELFSection(".data.rel.local", ELF::SHT_PROGBITS,
8788 MCSectionELF::SHF_ALLOC |MCSectionELF::SHF_WRITE,
8889 SectionKind::getDataRelLocal());
8990
9091 DataRelROSection =
91 getContext().getELFSection(".data.rel.ro", MCSectionELF::SHT_PROGBITS,
92 getContext().getELFSection(".data.rel.ro", ELF::SHT_PROGBITS,
9293 MCSectionELF::SHF_ALLOC |MCSectionELF::SHF_WRITE,
9394 SectionKind::getReadOnlyWithRel());
9495
9596 DataRelROLocalSection =
96 getContext().getELFSection(".data.rel.ro.local", MCSectionELF::SHT_PROGBITS,
97 getContext().getELFSection(".data.rel.ro.local", ELF::SHT_PROGBITS,
9798 MCSectionELF::SHF_ALLOC |MCSectionELF::SHF_WRITE,
9899 SectionKind::getReadOnlyWithRelLocal());
99100
100101 MergeableConst4Section =
101 getContext().getELFSection(".rodata.cst4", MCSectionELF::SHT_PROGBITS,
102 getContext().getELFSection(".rodata.cst4", ELF::SHT_PROGBITS,
102103 MCSectionELF::SHF_ALLOC |MCSectionELF::SHF_MERGE,
103104 SectionKind::getMergeableConst4());
104105
105106 MergeableConst8Section =
106 getContext().getELFSection(".rodata.cst8", MCSectionELF::SHT_PROGBITS,
107 getContext().getELFSection(".rodata.cst8", ELF::SHT_PROGBITS,
107108 MCSectionELF::SHF_ALLOC |MCSectionELF::SHF_MERGE,
108109 SectionKind::getMergeableConst8());
109110
110111 MergeableConst16Section =
111 getContext().getELFSection(".rodata.cst16", MCSectionELF::SHT_PROGBITS,
112 getContext().getELFSection(".rodata.cst16", ELF::SHT_PROGBITS,
112113 MCSectionELF::SHF_ALLOC |MCSectionELF::SHF_MERGE,
113114 SectionKind::getMergeableConst16());
114115
115116 StaticCtorSection =
116 getContext().getELFSection(".ctors", MCSectionELF::SHT_PROGBITS,
117 getContext().getELFSection(".ctors", ELF::SHT_PROGBITS,
117118 MCSectionELF::SHF_ALLOC |MCSectionELF::SHF_WRITE,
118119 SectionKind::getDataRel());
119120
120121 StaticDtorSection =
121 getContext().getELFSection(".dtors", MCSectionELF::SHT_PROGBITS,
122 getContext().getELFSection(".dtors", ELF::SHT_PROGBITS,
122123 MCSectionELF::SHF_ALLOC |MCSectionELF::SHF_WRITE,
123124 SectionKind::getDataRel());
124125
129130 // runtime hit for C++ apps. Either the contents of the LSDA need to be
130131 // adjusted or this should be a data section.
131132 LSDASection =
132 getContext().getELFSection(".gcc_except_table", MCSectionELF::SHT_PROGBITS,
133 getContext().getELFSection(".gcc_except_table", ELF::SHT_PROGBITS,
133134 MCSectionELF::SHF_ALLOC,
134135 SectionKind::getReadOnly());
135136 EHFrameSection =
136 getContext().getELFSection(".eh_frame", MCSectionELF::SHT_PROGBITS,
137 getContext().getELFSection(".eh_frame", ELF::SHT_PROGBITS,
137138 MCSectionELF::SHF_ALLOC,
138139 SectionKind::getDataRel());
139140
140141 // Debug Info Sections.
141142 DwarfAbbrevSection =
142 getContext().getELFSection(".debug_abbrev", MCSectionELF::SHT_PROGBITS, 0,
143 getContext().getELFSection(".debug_abbrev", ELF::SHT_PROGBITS, 0,
143144 SectionKind::getMetadata());
144145 DwarfInfoSection =
145 getContext().getELFSection(".debug_info", MCSectionELF::SHT_PROGBITS, 0,
146 getContext().getELFSection(".debug_info", ELF::SHT_PROGBITS, 0,
146147 SectionKind::getMetadata());
147148 DwarfLineSection =
148 getContext().getELFSection(".debug_line", MCSectionELF::SHT_PROGBITS, 0,
149 getContext().getELFSection(".debug_line", ELF::SHT_PROGBITS, 0,
149150 SectionKind::getMetadata());
150151 DwarfFrameSection =
151 getContext().getELFSection(".debug_frame", MCSectionELF::SHT_PROGBITS, 0,
152 getContext().getELFSection(".debug_frame", ELF::SHT_PROGBITS, 0,
152153 SectionKind::getMetadata());
153154 DwarfPubNamesSection =
154 getContext().getELFSection(".debug_pubnames", MCSectionELF::SHT_PROGBITS, 0,
155 getContext().getELFSection(".debug_pubnames", ELF::SHT_PROGBITS, 0,
155156 SectionKind::getMetadata());
156157 DwarfPubTypesSection =
157 getContext().getELFSection(".debug_pubtypes", MCSectionELF::SHT_PROGBITS, 0,
158 getContext().getELFSection(".debug_pubtypes", ELF::SHT_PROGBITS, 0,
158159 SectionKind::getMetadata());
159160 DwarfStrSection =
160 getContext().getELFSection(".debug_str", MCSectionELF::SHT_PROGBITS, 0,
161 getContext().getELFSection(".debug_str", ELF::SHT_PROGBITS, 0,
161162 SectionKind::getMetadata());
162163 DwarfLocSection =
163 getContext().getELFSection(".debug_loc", MCSectionELF::SHT_PROGBITS, 0,
164 getContext().getELFSection(".debug_loc", ELF::SHT_PROGBITS, 0,
164165 SectionKind::getMetadata());
165166 DwarfARangesSection =
166 getContext().getELFSection(".debug_aranges", MCSectionELF::SHT_PROGBITS, 0,
167 getContext().getELFSection(".debug_aranges", ELF::SHT_PROGBITS, 0,
167168 SectionKind::getMetadata());
168169 DwarfRangesSection =
169 getContext().getELFSection(".debug_ranges", MCSectionELF::SHT_PROGBITS, 0,
170 getContext().getELFSection(".debug_ranges", ELF::SHT_PROGBITS, 0,
170171 SectionKind::getMetadata());
171172 DwarfMacroInfoSection =
172 getContext().getELFSection(".debug_macinfo", MCSectionELF::SHT_PROGBITS, 0,
173 getContext().getELFSection(".debug_macinfo", ELF::SHT_PROGBITS, 0,
173174 SectionKind::getMetadata());
174175 }
175176
208209 static unsigned getELFSectionType(StringRef Name, SectionKind K) {
209210
210211 if (Name == ".init_array")
211 return MCSectionELF::SHT_INIT_ARRAY;
212 return ELF::SHT_INIT_ARRAY;
212213
213214 if (Name == ".fini_array")
214 return MCSectionELF::SHT_FINI_ARRAY;
215 return ELF::SHT_FINI_ARRAY;
215216
216217 if (Name == ".preinit_array")
217 return MCSectionELF::SHT_PREINIT_ARRAY;
218 return ELF::SHT_PREINIT_ARRAY;
218219
219220 if (K.isBSS() || K.isThreadBSS())
220 return MCSectionELF::SHT_NOBITS;
221
222 return MCSectionELF::SHT_PROGBITS;
221 return ELF::SHT_NOBITS;
222
223 return ELF::SHT_PROGBITS;
223224 }
224225
225226
352353
353354
354355 std::string Name = SizeSpec + utostr(Align);
355 return getContext().getELFSection(Name, MCSectionELF::SHT_PROGBITS,
356 return getContext().getELFSection(Name, ELF::SHT_PROGBITS,
356357 MCSectionELF::SHF_ALLOC |
357358 MCSectionELF::SHF_MERGE |
358359 MCSectionELF::SHF_STRINGS,
1717 #include "llvm/Target/TargetAsmInfo.h"
1818 #include "llvm/ADT/SmallString.h"
1919 #include "llvm/ADT/Twine.h"
20 #include "llvm/Support/ELF.h"
2021 using namespace llvm;
2122
2223 typedef StringMap MachOUniqueMapTy;
210211
211212 const MCSectionELF *MCContext::CreateELFGroupSection() {
212213 MCSectionELF *Result =
213 new (*this) MCSectionELF(".group", MCSectionELF::SHT_GROUP, 0,
214 new (*this) MCSectionELF(".group", ELF::SHT_GROUP, 0,
214215 SectionKind::getReadOnly(), 4, NULL);
215216 return Result;
216217 }
154154 }
155155
156156 void SetSectionData() {
157 SetSection(".data", MCSectionELF::SHT_PROGBITS,
157 SetSection(".data", ELF::SHT_PROGBITS,
158158 MCSectionELF::SHF_WRITE |MCSectionELF::SHF_ALLOC,
159159 SectionKind::getDataRel());
160160 EmitCodeAlignment(4, 0);
161161 }
162162 void SetSectionText() {
163 SetSection(".text", MCSectionELF::SHT_PROGBITS,
163 SetSection(".text", ELF::SHT_PROGBITS,
164164 MCSectionELF::SHF_EXECINSTR |
165165 MCSectionELF::SHF_ALLOC, SectionKind::getText());
166166 EmitCodeAlignment(4, 0);
167167 }
168168 void SetSectionBss() {
169 SetSection(".bss", MCSectionELF::SHT_NOBITS,
169 SetSection(".bss", ELF::SHT_NOBITS,
170170 MCSectionELF::SHF_WRITE |
171171 MCSectionELF::SHF_ALLOC, SectionKind::getBSS());
172172 EmitCodeAlignment(4, 0);
345345
346346 if (GetBinding(SD) == ELF_STB_Local) {
347347 const MCSection *Section = getAssembler().getContext().getELFSection(".bss",
348 MCSectionELF::SHT_NOBITS,
348 ELF::SHT_NOBITS,
349349 MCSectionELF::SHF_WRITE |
350350 MCSectionELF::SHF_ALLOC,
351351 SectionKind::getBSS());
1515 #include "llvm/MC/MCParser/MCAsmLexer.h"
1616 #include "llvm/MC/MCSectionELF.h"
1717 #include "llvm/MC/MCStreamer.h"
18 #include "llvm/Support/ELF.h"
1819 using namespace llvm;
1920
2021 namespace {
5859 // FIXME: Part of this logic is duplicated in the MCELFStreamer. What is
5960 // the best way for us to get access to it?
6061 bool ParseSectionDirectiveData(StringRef, SMLoc) {
61 return ParseSectionSwitch(".data", MCSectionELF::SHT_PROGBITS,
62 return ParseSectionSwitch(".data", ELF::SHT_PROGBITS,
6263 MCSectionELF::SHF_WRITE |MCSectionELF::SHF_ALLOC,
6364 SectionKind::getDataRel());
6465 }
6566 bool ParseSectionDirectiveText(StringRef, SMLoc) {
66 return ParseSectionSwitch(".text", MCSectionELF::SHT_PROGBITS,
67 return ParseSectionSwitch(".text", ELF::SHT_PROGBITS,
6768 MCSectionELF::SHF_EXECINSTR |
6869 MCSectionELF::SHF_ALLOC, SectionKind::getText());
6970 }
7071 bool ParseSectionDirectiveBSS(StringRef, SMLoc) {
71 return ParseSectionSwitch(".bss", MCSectionELF::SHT_NOBITS,
72 return ParseSectionSwitch(".bss", ELF::SHT_NOBITS,
7273 MCSectionELF::SHF_WRITE |
7374 MCSectionELF::SHF_ALLOC, SectionKind::getBSS());
7475 }
7576 bool ParseSectionDirectiveRoData(StringRef, SMLoc) {
76 return ParseSectionSwitch(".rodata", MCSectionELF::SHT_PROGBITS,
77 return ParseSectionSwitch(".rodata", ELF::SHT_PROGBITS,
7778 MCSectionELF::SHF_ALLOC,
7879 SectionKind::getReadOnly());
7980 }
8081 bool ParseSectionDirectiveTData(StringRef, SMLoc) {
81 return ParseSectionSwitch(".tdata", MCSectionELF::SHT_PROGBITS,
82 return ParseSectionSwitch(".tdata", ELF::SHT_PROGBITS,
8283 MCSectionELF::SHF_ALLOC |
8384 MCSectionELF::SHF_TLS | MCSectionELF::SHF_WRITE,
8485 SectionKind::getThreadData());
8586 }
8687 bool ParseSectionDirectiveTBSS(StringRef, SMLoc) {
87 return ParseSectionSwitch(".tbss", MCSectionELF::SHT_NOBITS,
88 return ParseSectionSwitch(".tbss", ELF::SHT_NOBITS,
8889 MCSectionELF::SHF_ALLOC |
8990 MCSectionELF::SHF_TLS | MCSectionELF::SHF_WRITE,
9091 SectionKind::getThreadBSS());
9192 }
9293 bool ParseSectionDirectiveDataRel(StringRef, SMLoc) {
93 return ParseSectionSwitch(".data.rel", MCSectionELF::SHT_PROGBITS,
94 return ParseSectionSwitch(".data.rel", ELF::SHT_PROGBITS,
9495 MCSectionELF::SHF_ALLOC |
9596 MCSectionELF::SHF_WRITE,
9697 SectionKind::getDataRel());
9798 }
9899 bool ParseSectionDirectiveDataRelRo(StringRef, SMLoc) {
99 return ParseSectionSwitch(".data.rel.ro", MCSectionELF::SHT_PROGBITS,
100 return ParseSectionSwitch(".data.rel.ro", ELF::SHT_PROGBITS,
100101 MCSectionELF::SHF_ALLOC |
101102 MCSectionELF::SHF_WRITE,
102103 SectionKind::getReadOnlyWithRel());
103104 }
104105 bool ParseSectionDirectiveDataRelRoLocal(StringRef, SMLoc) {
105 return ParseSectionSwitch(".data.rel.ro.local", MCSectionELF::SHT_PROGBITS,
106 return ParseSectionSwitch(".data.rel.ro.local", ELF::SHT_PROGBITS,
106107 MCSectionELF::SHF_ALLOC |
107108 MCSectionELF::SHF_WRITE,
108109 SectionKind::getReadOnlyWithRelLocal());
109110 }
110111 bool ParseSectionDirectiveEhFrame(StringRef, SMLoc) {
111 return ParseSectionSwitch(".eh_frame", MCSectionELF::SHT_PROGBITS,
112 return ParseSectionSwitch(".eh_frame", ELF::SHT_PROGBITS,
112113 MCSectionELF::SHF_ALLOC |
113114 MCSectionELF::SHF_WRITE,
114115 SectionKind::getDataRel());
321322 if (getLexer().isNot(AsmToken::EndOfStatement))
322323 return TokError("unexpected token in directive");
323324
324 unsigned Type = MCSectionELF::SHT_PROGBITS;
325 unsigned Type = ELF::SHT_PROGBITS;
325326
326327 if (!TypeName.empty()) {
327328 if (TypeName == "init_array")
328 Type = MCSectionELF::SHT_INIT_ARRAY;
329 Type = ELF::SHT_INIT_ARRAY;
329330 else if (TypeName == "fini_array")
330 Type = MCSectionELF::SHT_FINI_ARRAY;
331 Type = ELF::SHT_FINI_ARRAY;
331332 else if (TypeName == "preinit_array")
332 Type = MCSectionELF::SHT_PREINIT_ARRAY;
333 Type = ELF::SHT_PREINIT_ARRAY;
333334 else if (TypeName == "nobits")
334 Type = MCSectionELF::SHT_NOBITS;
335 Type = ELF::SHT_NOBITS;
335336 else if (TypeName == "progbits")
336 Type = MCSectionELF::SHT_PROGBITS;
337 Type = ELF::SHT_PROGBITS;
337338 else if (TypeName == "note")
338 Type = MCSectionELF::SHT_NOTE;
339 Type = ELF::SHT_NOTE;
339340 else
340341 return TokError("unknown section type");
341342 }
414415
415416 const MCSection *OldSection = getStreamer().getCurrentSection();
416417 const MCSection *Comment =
417 getContext().getELFSection(".comment", MCSectionELF::SHT_PROGBITS,
418 getContext().getELFSection(".comment", ELF::SHT_PROGBITS,
418419 MCSectionELF::SHF_MERGE |
419420 MCSectionELF::SHF_STRINGS,
420421 SectionKind::getReadOnly(),
1010 #include "llvm/MC/MCAsmInfo.h"
1111 #include "llvm/MC/MCContext.h"
1212 #include "llvm/MC/MCSymbol.h"
13 #include "llvm/Support/ELF.h"
1314 #include "llvm/Support/raw_ostream.h"
15
1416 using namespace llvm;
1517
1618 MCSectionELF::~MCSectionELF() {} // anchor.
8385 else
8486 OS << '@';
8587
86 if (Type == MCSectionELF::SHT_INIT_ARRAY)
88 if (Type == ELF::SHT_INIT_ARRAY)
8789 OS << "init_array";
88 else if (Type == MCSectionELF::SHT_FINI_ARRAY)
90 else if (Type == ELF::SHT_FINI_ARRAY)
8991 OS << "fini_array";
90 else if (Type == MCSectionELF::SHT_PREINIT_ARRAY)
92 else if (Type == ELF::SHT_PREINIT_ARRAY)
9193 OS << "preinit_array";
92 else if (Type == MCSectionELF::SHT_NOBITS)
94 else if (Type == ELF::SHT_NOBITS)
9395 OS << "nobits";
94 else if (Type == MCSectionELF::SHT_NOTE)
96 else if (Type == ELF::SHT_NOTE)
9597 OS << "note";
96 else if (Type == MCSectionELF::SHT_PROGBITS)
98 else if (Type == ELF::SHT_PROGBITS)
9799 OS << "progbits";
98100
99101 if (EntrySize) {
109111 }
110112
111113 bool MCSectionELF::isVirtualSection() const {
112 return getType() == MCSectionELF::SHT_NOBITS;
114 return getType() == ELF::SHT_NOBITS;
113115 }
114116
115117 // HasCommonSymbols - True if this section holds common symbols, this is
1111 #include "llvm/MC/MCContext.h"
1212 #include "llvm/MC/MCSectionELF.h"
1313 #include "llvm/Support/Dwarf.h"
14 #include "llvm/Support/ELF.h"
1415 #include "llvm/Target/TargetMachine.h"
1516 using namespace llvm;
1617 using namespace dwarf;
2526
2627 if (TM.getSubtarget().isAAPCS_ABI()) {
2728 StaticCtorSection =
28 getContext().getELFSection(".init_array", MCSectionELF::SHT_INIT_ARRAY,
29 getContext().getELFSection(".init_array", ELF::SHT_INIT_ARRAY,
2930 MCSectionELF::SHF_WRITE |
3031 MCSectionELF::SHF_ALLOC,
3132 SectionKind::getDataRel());
3233 StaticDtorSection =
33 getContext().getELFSection(".fini_array", MCSectionELF::SHT_FINI_ARRAY,
34 getContext().getELFSection(".fini_array", ELF::SHT_FINI_ARRAY,
3435 MCSectionELF::SHF_WRITE |
3536 MCSectionELF::SHF_ALLOC,
3637 SectionKind::getDataRel());
3839
3940 AttributesSection =
4041 getContext().getELFSection(".ARM.attributes",
41 MCSectionELF::SHT_ARM_ATTRIBUTES,
42 ELF::SHT_ARM_ATTRIBUTES,
4243 0,
4344 SectionKind::getMetadata());
4445 }
1515 #include "llvm/Target/TargetData.h"
1616 #include "llvm/Target/TargetMachine.h"
1717 #include "llvm/Support/CommandLine.h"
18 #include "llvm/Support/ELF.h"
1819 using namespace llvm;
1920
2021 void MBlazeTargetObjectFile::
2223 TargetLoweringObjectFileELF::Initialize(Ctx, TM);
2324
2425 SmallDataSection =
25 getContext().getELFSection(".sdata", MCSectionELF::SHT_PROGBITS,
26 getContext().getELFSection(".sdata", ELF::SHT_PROGBITS,
2627 MCSectionELF::SHF_WRITE |MCSectionELF::SHF_ALLOC,
2728 SectionKind::getDataRel());
2829
2930 SmallBSSSection =
30 getContext().getELFSection(".sbss", MCSectionELF::SHT_NOBITS,
31 getContext().getELFSection(".sbss", ELF::SHT_NOBITS,
3132 MCSectionELF::SHF_WRITE |MCSectionELF::SHF_ALLOC,
3233 SectionKind::getBSS());
3334
1515 #include "llvm/Target/TargetData.h"
1616 #include "llvm/Target/TargetMachine.h"
1717 #include "llvm/Support/CommandLine.h"
18 #include "llvm/Support/ELF.h"
1819 using namespace llvm;
1920
2021 static cl::opt
2627 TargetLoweringObjectFileELF::Initialize(Ctx, TM);
2728
2829 SmallDataSection =
29 getContext().getELFSection(".sdata", MCSectionELF::SHT_PROGBITS,
30 getContext().getELFSection(".sdata", ELF::SHT_PROGBITS,
3031 MCSectionELF::SHF_WRITE |MCSectionELF::SHF_ALLOC,
3132 SectionKind::getDataRel());
3233
3334 SmallBSSSection =
34 getContext().getELFSection(".sbss", MCSectionELF::SHT_NOBITS,
35 getContext().getELFSection(".sbss", ELF::SHT_NOBITS,
3536 MCSectionELF::SHF_WRITE |MCSectionELF::SHF_ALLOC,
3637 SectionKind::getBSS());
3738
1313 #include "SystemZMCAsmInfo.h"
1414 #include "llvm/MC/MCContext.h"
1515 #include "llvm/MC/MCSectionELF.h"
16 #include "llvm/Support/ELF.h"
1617 using namespace llvm;
1718
1819 SystemZMCAsmInfo::SystemZMCAsmInfo(const Target &T, StringRef TT) {
2324
2425 const MCSection *SystemZMCAsmInfo::
2526 getNonexecutableStackSection(MCContext &Ctx) const{
26 return Ctx.getELFSection(".note.GNU-stack", MCSectionELF::SHT_PROGBITS,
27 return Ctx.getELFSection(".note.GNU-stack", ELF::SHT_PROGBITS,
2728 0, SectionKind::getMetadata());
2829 }
1616 #include "llvm/MC/MCContext.h"
1717 #include "llvm/MC/MCSectionELF.h"
1818 #include "llvm/Support/CommandLine.h"
19 #include "llvm/Support/ELF.h"
1920 using namespace llvm;
2021
2122 enum AsmWriterFlavorTy {
9798
9899 const MCSection *X86ELFMCAsmInfo::
99100 getNonexecutableStackSection(MCContext &Ctx) const {
100 return Ctx.getELFSection(".note.GNU-stack", MCSectionELF::SHT_PROGBITS,
101 return Ctx.getELFSection(".note.GNU-stack", ELF::SHT_PROGBITS,
101102 0, SectionKind::getMetadata());
102103 }
103104
1111 #include "llvm/MC/MCContext.h"
1212 #include "llvm/MC/MCSectionELF.h"
1313 #include "llvm/Target/TargetMachine.h"
14 #include "llvm/Support/ELF.h"
1415 using namespace llvm;
1516
1617
1819 TargetLoweringObjectFileELF::Initialize(Ctx, TM);
1920
2021 DataSection =
21 Ctx.getELFSection(".dp.data", MCSectionELF::SHT_PROGBITS,
22 Ctx.getELFSection(".dp.data", ELF::SHT_PROGBITS,
2223 MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_WRITE |
2324 MCSectionELF::XCORE_SHF_DP_SECTION,
2425 SectionKind::getDataRel());
2526 BSSSection =
26 Ctx.getELFSection(".dp.bss", MCSectionELF::SHT_NOBITS,
27 Ctx.getELFSection(".dp.bss", ELF::SHT_NOBITS,
2728 MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_WRITE |
2829 MCSectionELF::XCORE_SHF_DP_SECTION,
2930 SectionKind::getBSS());
3031
3132 MergeableConst4Section =
32 Ctx.getELFSection(".cp.rodata.cst4", MCSectionELF::SHT_PROGBITS,
33 Ctx.getELFSection(".cp.rodata.cst4", ELF::SHT_PROGBITS,
3334 MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_MERGE |
3435 MCSectionELF::XCORE_SHF_CP_SECTION,
3536 SectionKind::getMergeableConst4());
3637 MergeableConst8Section =
37 Ctx.getELFSection(".cp.rodata.cst8", MCSectionELF::SHT_PROGBITS,
38 Ctx.getELFSection(".cp.rodata.cst8", ELF::SHT_PROGBITS,
3839 MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_MERGE |
3940 MCSectionELF::XCORE_SHF_CP_SECTION,
4041 SectionKind::getMergeableConst8());
4142 MergeableConst16Section =
42 Ctx.getELFSection(".cp.rodata.cst16", MCSectionELF::SHT_PROGBITS,
43 Ctx.getELFSection(".cp.rodata.cst16", ELF::SHT_PROGBITS,
4344 MCSectionELF::SHF_ALLOC | MCSectionELF::SHF_MERGE |
4445 MCSectionELF::XCORE_SHF_CP_SECTION,
4546 SectionKind::getMergeableConst16());
5152 TLSBSSSection = BSSSection;
5253
5354 ReadOnlySection =
54 Ctx.getELFSection(".cp.rodata", MCSectionELF::SHT_PROGBITS,
55 Ctx.getELFSection(".cp.rodata", ELF::SHT_PROGBITS,
5556 MCSectionELF::SHF_ALLOC |
5657 MCSectionELF::XCORE_SHF_CP_SECTION,
5758 SectionKind::getReadOnlyWithRel());