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

Unified Diff: src/IceELFSection.h

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, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceELFObjectWriter.cpp ('k') | src/IceELFSection.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceELFSection.h
diff --git a/src/IceELFSection.h b/src/IceELFSection.h
index db000f4915e8f0f7affb91bc242605d5b67937c4..24ec5619d8a307e2e5d4ab305886484b3d2ba1c5 100644
--- a/src/IceELFSection.h
+++ b/src/IceELFSection.h
@@ -217,8 +217,7 @@ public:
// Track a single additional relocation.
void addRelocation(const AssemblerFixup &Fixup) { Fixups.push_back(Fixup); }
- size_t getSectionDataSize(const GlobalContext &Ctx,
- const ELFSymbolTableSection *SymTab) const;
+ size_t getSectionDataSize() const;
template <bool IsELF64>
void writeData(const GlobalContext &Ctx, ELFStreamer &Str,
@@ -333,25 +332,23 @@ void ELFRelocationSection::writeData(const GlobalContext &Ctx, ELFStreamer &Str,
const ELFSymbolTableSection *SymTab) {
for (const AssemblerFixup &Fixup : Fixups) {
const ELFSym *Symbol = SymTab->findSymbol(Fixup.symbol(&Ctx));
- // TODO(jvoung): Make sure this always succeeds.
- // We currently don't track data symbols, so they aren't even marked
- // as undefined symbols.
- if (Symbol) {
- if (IsELF64) {
- Elf64_Rela Rela;
- Rela.r_offset = Fixup.position();
- Rela.setSymbolAndType(Symbol->getNumber(), Fixup.kind());
- Rela.r_addend = Fixup.offset();
- Str.writeAddrOrOffset<IsELF64>(Rela.r_offset);
- Str.writeELFXword<IsELF64>(Rela.r_info);
- Str.writeELFXword<IsELF64>(Rela.r_addend);
- } else {
- Elf32_Rel Rel;
- Rel.r_offset = Fixup.position();
- Rel.setSymbolAndType(Symbol->getNumber(), Fixup.kind());
- Str.writeAddrOrOffset<IsELF64>(Rel.r_offset);
- Str.writeELFWord<IsELF64>(Rel.r_info);
- }
+ if (!Symbol)
+ llvm::report_fatal_error("Missing symbol mentioned in reloc");
+
+ if (IsELF64) {
+ Elf64_Rela Rela;
+ Rela.r_offset = Fixup.position();
+ Rela.setSymbolAndType(Symbol->getNumber(), Fixup.kind());
+ Rela.r_addend = Fixup.offset();
+ Str.writeAddrOrOffset<IsELF64>(Rela.r_offset);
+ Str.writeELFXword<IsELF64>(Rela.r_info);
+ Str.writeELFXword<IsELF64>(Rela.r_addend);
+ } else {
+ Elf32_Rel Rel;
+ Rel.r_offset = Fixup.position();
+ Rel.setSymbolAndType(Symbol->getNumber(), Fixup.kind());
+ Str.writeAddrOrOffset<IsELF64>(Rel.r_offset);
+ Str.writeELFWord<IsELF64>(Rel.r_info);
}
}
}
« no previous file with comments | « src/IceELFObjectWriter.cpp ('k') | src/IceELFSection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698