OLD | NEW |
---|---|
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 /// \file | 10 /// \file |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
355 for (const AssemblerFixup &Fixup : Fixups) { | 355 for (const AssemblerFixup &Fixup : Fixups) { |
356 const ELFSym *Symbol; | 356 const ELFSym *Symbol; |
357 if (Fixup.isNullSymbol()) | 357 if (Fixup.isNullSymbol()) |
358 Symbol = SymTab->getNullSymbol(); | 358 Symbol = SymTab->getNullSymbol(); |
359 else | 359 else |
360 Symbol = SymTab->findSymbol(Fixup.symbol(&Ctx)); | 360 Symbol = SymTab->findSymbol(Fixup.symbol(&Ctx)); |
361 if (!Symbol) | 361 if (!Symbol) |
362 llvm::report_fatal_error("Missing symbol mentioned in reloc"); | 362 llvm::report_fatal_error("Missing symbol mentioned in reloc"); |
363 | 363 |
364 if (IsELF64) { | 364 if (IsELF64) { |
365 llvm_unreachable( | |
366 "Not tested -- check that Fixup.offset() is correct even for pc-rel"); | |
365 Elf64_Rela Rela; | 367 Elf64_Rela Rela; |
366 Rela.r_offset = Fixup.position(); | 368 Rela.r_offset = Fixup.position(); |
367 Rela.setSymbolAndType(Symbol->getNumber(), Fixup.kind()); | 369 Rela.setSymbolAndType(Symbol->getNumber(), Fixup.kind()); |
368 Rela.r_addend = Fixup.offset(); | 370 Rela.r_addend = Fixup.offset(); |
jvoung (off chromium)
2015/07/20 23:29:05
This doesn't consult the buffer's contents, so we'
| |
369 Str.writeAddrOrOffset<IsELF64>(Rela.r_offset); | 371 Str.writeAddrOrOffset<IsELF64>(Rela.r_offset); |
370 Str.writeELFXword<IsELF64>(Rela.r_info); | 372 Str.writeELFXword<IsELF64>(Rela.r_info); |
371 Str.writeELFXword<IsELF64>(Rela.r_addend); | 373 Str.writeELFXword<IsELF64>(Rela.r_addend); |
372 } else { | 374 } else { |
373 Elf32_Rel Rel; | 375 Elf32_Rel Rel; |
374 Rel.r_offset = Fixup.position(); | 376 Rel.r_offset = Fixup.position(); |
375 Rel.setSymbolAndType(Symbol->getNumber(), Fixup.kind()); | 377 Rel.setSymbolAndType(Symbol->getNumber(), Fixup.kind()); |
376 Str.writeAddrOrOffset<IsELF64>(Rel.r_offset); | 378 Str.writeAddrOrOffset<IsELF64>(Rel.r_offset); |
377 Str.writeELFWord<IsELF64>(Rel.r_info); | 379 Str.writeELFWord<IsELF64>(Rel.r_info); |
378 } | 380 } |
379 } | 381 } |
380 } | 382 } |
381 | 383 |
382 } // end of namespace Ice | 384 } // end of namespace Ice |
383 | 385 |
384 #endif // SUBZERO_SRC_ICEELFSECTION_H | 386 #endif // SUBZERO_SRC_ICEELFSECTION_H |
OLD | NEW |