Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/IceELFSection.h

Issue 904783002: Subzero: Convert a few getName() methods to return a const string ref. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/IceELFObjectWriter.cpp ('k') | src/IceOperand.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceELFSection.h - Model of ELF sections ------*- C++ -*-===// 1 //===- subzero/src/IceELFSection.h - Model of ELF sections ------*- C++ -*-===//
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 // Representation of ELF sections. 10 // Representation of ELF sections.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 SizeT getNumber() const { 59 SizeT getNumber() const {
60 assert(Number != NoSectionNumber); 60 assert(Number != NoSectionNumber);
61 return Number; 61 return Number;
62 } 62 }
63 63
64 void setSize(Elf64_Xword sh_size) { Header.sh_size = sh_size; } 64 void setSize(Elf64_Xword sh_size) { Header.sh_size = sh_size; }
65 SizeT getCurrentSize() const { return Header.sh_size; } 65 SizeT getCurrentSize() const { return Header.sh_size; }
66 66
67 void setNameStrIndex(Elf64_Word sh_name) { Header.sh_name = sh_name; } 67 void setNameStrIndex(Elf64_Word sh_name) { Header.sh_name = sh_name; }
68 68
69 IceString getName() const { return Name; } 69 const IceString &getName() const { return Name; }
70 70
71 void setLinkNum(Elf64_Word sh_link) { Header.sh_link = sh_link; } 71 void setLinkNum(Elf64_Word sh_link) { Header.sh_link = sh_link; }
72 72
73 void setInfoNum(Elf64_Word sh_info) { Header.sh_info = sh_info; } 73 void setInfoNum(Elf64_Word sh_info) { Header.sh_info = sh_info; }
74 74
75 void setFileOffset(Elf64_Off sh_offset) { Header.sh_offset = sh_offset; } 75 void setFileOffset(Elf64_Off sh_offset) { Header.sh_offset = sh_offset; }
76 76
77 Elf64_Xword getSectionAlign() const { return Header.sh_addralign; } 77 Elf64_Xword getSectionAlign() const { return Header.sh_addralign; }
78 78
79 // Write the section header out with the given streamer. 79 // Write the section header out with the given streamer.
80 template <bool IsELF64> void writeHeader(ELFStreamer &Str); 80 template <bool IsELF64> void writeHeader(ELFStreamer &Str);
81 81
82 protected: 82 protected:
83 ~ELFSection() {} 83 ~ELFSection() {}
84 84
85 // Name of the section in convenient string form (instead of a index 85 // Name of the section in convenient string form (instead of a index
86 // into the Section Header String Table, which is not known till later). 86 // into the Section Header String Table, which is not known till later).
87 IceString Name; 87 const IceString Name;
88 88
89 // The fields of the header. May only be partially initialized, but should 89 // The fields of the header. May only be partially initialized, but should
90 // be fully initialized before writing. 90 // be fully initialized before writing.
91 Elf64_Shdr Header; 91 Elf64_Shdr Header;
92 92
93 // The number of the section after laying out sections. 93 // The number of the section after laying out sections.
94 SizeT Number; 94 SizeT Number;
95 }; 95 };
96 96
97 // Models text/code sections. Code is written out incrementally and the 97 // Models text/code sections. Code is written out incrementally and the
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 Rel.setSymbolAndType(Symbol->getNumber(), Fixup.kind()); 349 Rel.setSymbolAndType(Symbol->getNumber(), Fixup.kind());
350 Str.writeAddrOrOffset<IsELF64>(Rel.r_offset); 350 Str.writeAddrOrOffset<IsELF64>(Rel.r_offset);
351 Str.writeELFWord<IsELF64>(Rel.r_info); 351 Str.writeELFWord<IsELF64>(Rel.r_info);
352 } 352 }
353 } 353 }
354 } 354 }
355 355
356 } // end of namespace Ice 356 } // end of namespace Ice
357 357
358 #endif // SUBZERO_SRC_ICEELFSECTION_H 358 #endif // SUBZERO_SRC_ICEELFSECTION_H
OLDNEW
« no previous file with comments | « src/IceELFObjectWriter.cpp ('k') | src/IceOperand.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698