| 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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 for (VariableDeclaration *Var : Vars) { | 323 for (VariableDeclaration *Var : Vars) { |
| 324 Elf64_Xword Align = Var->getAlignment(); | 324 Elf64_Xword Align = Var->getAlignment(); |
| 325 ShAddralign = std::max(ShAddralign, Align); | 325 ShAddralign = std::max(ShAddralign, Align); |
| 326 } | 326 } |
| 327 constexpr Elf64_Xword ShEntsize = 0; // non-uniform data element size. | 327 constexpr Elf64_Xword ShEntsize = 0; // non-uniform data element size. |
| 328 // Lift this out, so it can be re-used if we do fdata-sections? | 328 // Lift this out, so it can be re-used if we do fdata-sections? |
| 329 switch (ST) { | 329 switch (ST) { |
| 330 case ROData: { | 330 case ROData: { |
| 331 const IceString SectionName = | 331 const IceString SectionName = |
| 332 MangleSectionName(IsPIC ? ".data.rel.ro" : ".rodata", SectionSuffix); | 332 MangleSectionName(IsPIC ? ".data.rel.ro" : ".rodata", SectionSuffix); |
| 333 const Elf64_Xword ShFlags = SHF_ALLOC | (IsPIC ? SHF_WRITE : 0); | 333 const Elf64_Xword ShFlags = IsPIC ? (SHF_ALLOC | SHF_WRITE) : SHF_ALLOC; |
| 334 Section = createSection<ELFDataSection>(SectionName, SHT_PROGBITS, ShFlags, | 334 Section = createSection<ELFDataSection>(SectionName, SHT_PROGBITS, ShFlags, |
| 335 ShAddralign, ShEntsize); | 335 ShAddralign, ShEntsize); |
| 336 Section->setFileOffset(alignFileOffset(ShAddralign)); | 336 Section->setFileOffset(alignFileOffset(ShAddralign)); |
| 337 RODataSections.push_back(Section); | 337 RODataSections.push_back(Section); |
| 338 RelSection = createRelocationSection(Section); | 338 RelSection = createRelocationSection(Section); |
| 339 RelRODataSections.push_back(RelSection); | 339 RelRODataSections.push_back(RelSection); |
| 340 break; | 340 break; |
| 341 } | 341 } |
| 342 case Data: { | 342 case Data: { |
| 343 const IceString SectionName = MangleSectionName(".data", SectionSuffix); | 343 const IceString SectionName = MangleSectionName(".data", SectionSuffix); |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 if (ELF64) { | 672 if (ELF64) { |
| 673 writeELFHeaderInternal<true>(ShOffset, ShStrTab->getNumber(), | 673 writeELFHeaderInternal<true>(ShOffset, ShStrTab->getNumber(), |
| 674 AllSections.size()); | 674 AllSections.size()); |
| 675 } else { | 675 } else { |
| 676 writeELFHeaderInternal<false>(ShOffset, ShStrTab->getNumber(), | 676 writeELFHeaderInternal<false>(ShOffset, ShStrTab->getNumber(), |
| 677 AllSections.size()); | 677 AllSections.size()); |
| 678 } | 678 } |
| 679 } | 679 } |
| 680 | 680 |
| 681 } // end of namespace Ice | 681 } // end of namespace Ice |
| OLD | NEW |