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

Side by Side Diff: src/IceELFSection.cpp

Issue 889613004: Track undefined sym in the symtab. Remove hack for missing relocs against undef. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: separate asserts 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/IceELFSection.h ('k') | src/IceGlobalContext.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.cpp - Representation of ELF sections -----===// 1 //===- subzero/src/IceELFSection.cpp - Representation of ELF sections -----===//
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 how ELF sections are represented. 10 // This file defines how ELF sections are represented.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 void ELFRelocationSection::addRelocations(RelocOffsetT BaseOff, 68 void ELFRelocationSection::addRelocations(RelocOffsetT BaseOff,
69 const FixupRefList &FixupRefs) { 69 const FixupRefList &FixupRefs) {
70 for (const AssemblerFixup *FR : FixupRefs) { 70 for (const AssemblerFixup *FR : FixupRefs) {
71 Fixups.push_back(*FR); 71 Fixups.push_back(*FR);
72 AssemblerFixup &F = Fixups.back(); 72 AssemblerFixup &F = Fixups.back();
73 F.set_position(BaseOff + F.position()); 73 F.set_position(BaseOff + F.position());
74 } 74 }
75 } 75 }
76 76
77 size_t ELFRelocationSection::getSectionDataSize( 77 size_t ELFRelocationSection::getSectionDataSize() const {
78 const GlobalContext &Ctx, const ELFSymbolTableSection *SymTab) const { 78 return Fixups.size() * Header.sh_entsize;
79 size_t NumWriteableRelocs = 0;
80 for (const AssemblerFixup &Fixup : Fixups) {
81 const ELFSym *Symbol = SymTab->findSymbol(Fixup.symbol(&Ctx));
82 // TODO(jvoung): When the symbol table finally tracks everything,
83 // just use the Fixups.size() as the count, and remove the
84 // SymTab and Ctx params.
85 if (Symbol)
86 ++NumWriteableRelocs;
87 }
88 return NumWriteableRelocs * Header.sh_entsize;
89 } 79 }
90 80
91 // Symbol tables. 81 // Symbol tables.
92 82
93 void ELFSymbolTableSection::createDefinedSym(const IceString &Name, 83 void ELFSymbolTableSection::createDefinedSym(const IceString &Name,
94 uint8_t Type, uint8_t Binding, 84 uint8_t Type, uint8_t Binding,
95 ELFSection *Section, 85 ELFSection *Section,
96 RelocOffsetT Offset, SizeT Size) { 86 RelocOffsetT Offset, SizeT Size) {
97 ELFSym NewSymbol = ELFSym(); 87 ELFSym NewSymbol = ELFSym();
98 NewSymbol.Sym.setBindingAndType(Binding, Type); 88 NewSymbol.Sym.setBindingAndType(Binding, Type);
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 continue; 202 continue;
213 } 203 }
214 StringIndex.second = StringData.size(); 204 StringIndex.second = StringData.size();
215 std::copy(Cur.begin(), Cur.end(), back_inserter(StringData)); 205 std::copy(Cur.begin(), Cur.end(), back_inserter(StringData));
216 StringData.push_back(0); 206 StringData.push_back(0);
217 Prev = Cur; 207 Prev = Cur;
218 } 208 }
219 } 209 }
220 210
221 } // end of namespace Ice 211 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceELFSection.h ('k') | src/IceGlobalContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698