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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 uint32_t getELFFlags(TargetArch Arch) { | 57 uint32_t getELFFlags(TargetArch Arch) { |
58 if (Arch < TargetArch_NUM) | 58 if (Arch < TargetArch_NUM) |
59 return ELFTargetInfo[Arch].ELFFlags; | 59 return ELFTargetInfo[Arch].ELFFlags; |
60 llvm_unreachable("Invalid target arch for getELFFlags"); | 60 llvm_unreachable("Invalid target arch for getELFFlags"); |
61 return 0; | 61 return 0; |
62 } | 62 } |
63 | 63 |
64 } // end of anonymous namespace | 64 } // end of anonymous namespace |
65 | 65 |
66 ELFObjectWriter::ELFObjectWriter(GlobalContext &Ctx, ELFStreamer &Out) | 66 ELFObjectWriter::ELFObjectWriter(GlobalContext &Ctx, ELFStreamer &Out) |
67 : Ctx(Ctx), Str(Out), SectionNumbersAssigned(false), | 67 : Ctx(Ctx), Str(Out), ELF64(isELF64(Ctx.getFlags().getTargetArch())) { |
68 ELF64(isELF64(Ctx.getFlags().getTargetArch())) { | |
69 // Create the special bookkeeping sections now. | 68 // Create the special bookkeeping sections now. |
70 const IceString NullSectionName(""); | 69 const IceString NullSectionName(""); |
71 NullSection = new (Ctx.allocate<ELFSection>()) | 70 NullSection = new (Ctx.allocate<ELFSection>()) |
72 ELFSection(NullSectionName, SHT_NULL, 0, 0, 0); | 71 ELFSection(NullSectionName, SHT_NULL, 0, 0, 0); |
73 | 72 |
74 const IceString ShStrTabName(".shstrtab"); | 73 const IceString ShStrTabName(".shstrtab"); |
75 ShStrTab = new (Ctx.allocate<ELFStringTableSection>()) | 74 ShStrTab = new (Ctx.allocate<ELFStringTableSection>()) |
76 ELFStringTableSection(ShStrTabName, SHT_STRTAB, 0, 1, 0); | 75 ELFStringTableSection(ShStrTabName, SHT_STRTAB, 0, 1, 0); |
77 ShStrTab->add(ShStrTabName); | 76 ShStrTab->add(ShStrTabName); |
78 | 77 |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 if (ELF64) { | 617 if (ELF64) { |
619 writeELFHeaderInternal<true>(ShOffset, ShStrTab->getNumber(), | 618 writeELFHeaderInternal<true>(ShOffset, ShStrTab->getNumber(), |
620 AllSections.size()); | 619 AllSections.size()); |
621 } else { | 620 } else { |
622 writeELFHeaderInternal<false>(ShOffset, ShStrTab->getNumber(), | 621 writeELFHeaderInternal<false>(ShOffset, ShStrTab->getNumber(), |
623 AllSections.size()); | 622 AllSections.size()); |
624 } | 623 } |
625 } | 624 } |
626 | 625 |
627 } // end of namespace Ice | 626 } // end of namespace Ice |
OLD | NEW |