| OLD | NEW |
| 1 //===- subzero/src/IceELFObjectWriter.cpp - ELF object file writer --------===// | 1 //===- subzero/src/IceELFObjectWriter.cpp - ELF object file writer --------===// |
| 2 // | 2 // |
| 3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 /// | 9 /// |
| 10 /// \file | 10 /// \file |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 if (getFlags().matchTranslateOnly(Var->getName(), 0)) { | 294 if (getFlags().matchTranslateOnly(Var->getName(), 0)) { |
| 295 size_t Section = classifyGlobalSection(Var); | 295 size_t Section = classifyGlobalSection(Var); |
| 296 assert(Section < ELFObjectWriter::NumSectionTypes); | 296 assert(Section < ELFObjectWriter::NumSectionTypes); |
| 297 VarsBySection[Section].push_back(Var); | 297 VarsBySection[Section].push_back(Var); |
| 298 } | 298 } |
| 299 } | 299 } |
| 300 } | 300 } |
| 301 | 301 |
| 302 } // end of anonymous namespace | 302 } // end of anonymous namespace |
| 303 | 303 |
| 304 void ELFObjectWriter::writeTargetRODataSection(const std::string &Name, |
| 305 Elf64_Word ShType, |
| 306 Elf64_Xword ShFlags, |
| 307 Elf64_Xword ShAddralign, |
| 308 Elf64_Xword ShEntsize, |
| 309 const llvm::StringRef &SecData) { |
| 310 TimerMarker Timer(TimerStack::TT_writeELF, &Ctx); |
| 311 assert(!SectionNumbersAssigned); |
| 312 ELFDataSection *Section = createSection<ELFDataSection>( |
| 313 Name, ShType, ShFlags, ShAddralign, ShEntsize); |
| 314 Section->setFileOffset(alignFileOffset(ShAddralign)); |
| 315 Section->appendData(Str, llvm::StringRef(SecData.data(), SecData.size())); |
| 316 RODataSections.push_back(Section); |
| 317 } |
| 318 |
| 304 void ELFObjectWriter::writeDataSection(const VariableDeclarationList &Vars, | 319 void ELFObjectWriter::writeDataSection(const VariableDeclarationList &Vars, |
| 305 FixupKind RelocationKind, | 320 FixupKind RelocationKind, |
| 306 const std::string &SectionSuffix, | 321 const std::string &SectionSuffix, |
| 307 bool IsPIC) { | 322 bool IsPIC) { |
| 308 TimerMarker Timer(TimerStack::TT_writeELF, &Ctx); | 323 TimerMarker Timer(TimerStack::TT_writeELF, &Ctx); |
| 309 assert(!SectionNumbersAssigned); | 324 assert(!SectionNumbersAssigned); |
| 310 VariableDeclarationPartition VarsBySection[ELFObjectWriter::NumSectionTypes]; | 325 VariableDeclarationPartition VarsBySection[ELFObjectWriter::NumSectionTypes]; |
| 311 for (auto &SectionList : VarsBySection) | 326 for (auto &SectionList : VarsBySection) |
| 312 SectionList.reserve(Vars.size()); | 327 SectionList.reserve(Vars.size()); |
| 313 partitionGlobalsBySection(Vars, VarsBySection); | 328 partitionGlobalsBySection(Vars, VarsBySection); |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 if (ELF64) { | 702 if (ELF64) { |
| 688 writeELFHeaderInternal<true>(ShOffset, ShStrTab->getNumber(), | 703 writeELFHeaderInternal<true>(ShOffset, ShStrTab->getNumber(), |
| 689 AllSections.size()); | 704 AllSections.size()); |
| 690 } else { | 705 } else { |
| 691 writeELFHeaderInternal<false>(ShOffset, ShStrTab->getNumber(), | 706 writeELFHeaderInternal<false>(ShOffset, ShStrTab->getNumber(), |
| 692 AllSections.size()); | 707 AllSections.size()); |
| 693 } | 708 } |
| 694 } | 709 } |
| 695 | 710 |
| 696 } // end of namespace Ice | 711 } // end of namespace Ice |
| OLD | NEW |