| 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 // This file defines the writer for ELF relocatable object files. | 10 // This file defines the writer for ELF relocatable object files. |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 assert(!SectionNumbersAssigned); | 218 assert(!SectionNumbersAssigned); |
| 219 ELFTextSection *Section = nullptr; | 219 ELFTextSection *Section = nullptr; |
| 220 ELFRelocationSection *RelSection = nullptr; | 220 ELFRelocationSection *RelSection = nullptr; |
| 221 const bool FunctionSections = Ctx.getFlags().getFunctionSections(); | 221 const bool FunctionSections = Ctx.getFlags().getFunctionSections(); |
| 222 if (TextSections.empty() || FunctionSections) { | 222 if (TextSections.empty() || FunctionSections) { |
| 223 IceString SectionName = ".text"; | 223 IceString SectionName = ".text"; |
| 224 if (FunctionSections) | 224 if (FunctionSections) |
| 225 SectionName += "." + FuncName; | 225 SectionName += "." + FuncName; |
| 226 bool IsELF64 = isELF64(Ctx.getTargetArch()); | 226 bool IsELF64 = isELF64(Ctx.getTargetArch()); |
| 227 const Elf64_Xword ShFlags = SHF_ALLOC | SHF_EXECINSTR; | 227 const Elf64_Xword ShFlags = SHF_ALLOC | SHF_EXECINSTR; |
| 228 // TODO(jvoung): Should be bundle size. Grab it from that target? | 228 const Elf64_Xword ShAlign = 1 << Asm->getBundleAlignLog2Bytes(); |
| 229 const Elf64_Xword ShAlign = 32; | |
| 230 Section = createSection<ELFTextSection>(SectionName, SHT_PROGBITS, ShFlags, | 229 Section = createSection<ELFTextSection>(SectionName, SHT_PROGBITS, ShFlags, |
| 231 ShAlign, 0); | 230 ShAlign, 0); |
| 232 Elf64_Off OffsetInFile = alignFileOffset(Section->getSectionAlign()); | 231 Elf64_Off OffsetInFile = alignFileOffset(Section->getSectionAlign()); |
| 233 Section->setFileOffset(OffsetInFile); | 232 Section->setFileOffset(OffsetInFile); |
| 234 TextSections.push_back(Section); | 233 TextSections.push_back(Section); |
| 235 RelSection = createRelocationSection(IsELF64, Section); | 234 RelSection = createRelocationSection(IsELF64, Section); |
| 236 RelTextSections.push_back(RelSection); | 235 RelTextSections.push_back(RelSection); |
| 237 } else { | 236 } else { |
| 238 Section = TextSections[0]; | 237 Section = TextSections[0]; |
| 239 RelSection = RelTextSections[0]; | 238 RelSection = RelTextSections[0]; |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 if (IsELF64) { | 609 if (IsELF64) { |
| 611 writeELFHeaderInternal<true>(ShOffset, ShStrTab->getNumber(), | 610 writeELFHeaderInternal<true>(ShOffset, ShStrTab->getNumber(), |
| 612 AllSections.size()); | 611 AllSections.size()); |
| 613 } else { | 612 } else { |
| 614 writeELFHeaderInternal<false>(ShOffset, ShStrTab->getNumber(), | 613 writeELFHeaderInternal<false>(ShOffset, ShStrTab->getNumber(), |
| 615 AllSections.size()); | 614 AllSections.size()); |
| 616 } | 615 } |
| 617 } | 616 } |
| 618 | 617 |
| 619 } // end of namespace Ice | 618 } // end of namespace Ice |
| OLD | NEW |