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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 Str.writeLE16(SymInfo.st_shndx); | 345 Str.writeLE16(SymInfo.st_shndx); |
346 } | 346 } |
347 } | 347 } |
348 } | 348 } |
349 | 349 |
350 template <bool IsELF64> | 350 template <bool IsELF64> |
351 void ELFRelocationSection::writeData(const GlobalContext &Ctx, ELFStreamer &Str, | 351 void ELFRelocationSection::writeData(const GlobalContext &Ctx, ELFStreamer &Str, |
352 const ELFSymbolTableSection *SymTab) { | 352 const ELFSymbolTableSection *SymTab) { |
353 for (const AssemblerFixup &Fixup : Fixups) { | 353 for (const AssemblerFixup &Fixup : Fixups) { |
354 const ELFSym *Symbol; | 354 const ELFSym *Symbol; |
355 if (Fixup.isNullSymbol()) | 355 if (Fixup.isNullSymbol()) { |
356 Symbol = SymTab->getNullSymbol(); | 356 Symbol = SymTab->getNullSymbol(); |
357 else | 357 } else { |
358 Symbol = SymTab->findSymbol(Fixup.symbol(&Ctx)); | 358 constexpr Assembler *Asm = nullptr; |
| 359 Symbol = SymTab->findSymbol(Fixup.symbol(&Ctx, Asm)); |
| 360 } |
359 if (!Symbol) | 361 if (!Symbol) |
360 llvm::report_fatal_error("Missing symbol mentioned in reloc"); | 362 llvm::report_fatal_error("Missing symbol mentioned in reloc"); |
361 | 363 |
362 if (IsELF64) { | 364 if (IsELF64) { |
363 // TODO(jpp): check that Fixup.offset() is correct even for pc-rel. | 365 // TODO(jpp): check that Fixup.offset() is correct even for pc-rel. |
364 Elf64_Rela Rela; | 366 Elf64_Rela Rela; |
365 Rela.r_offset = Fixup.position(); | 367 Rela.r_offset = Fixup.position(); |
366 Rela.setSymbolAndType(Symbol->getNumber(), Fixup.kind()); | 368 Rela.setSymbolAndType(Symbol->getNumber(), Fixup.kind()); |
367 Rela.r_addend = Fixup.offset(); | 369 Rela.r_addend = Fixup.offset(); |
368 Str.writeAddrOrOffset<IsELF64>(Rela.r_offset); | 370 Str.writeAddrOrOffset<IsELF64>(Rela.r_offset); |
369 Str.writeELFXword<IsELF64>(Rela.r_info); | 371 Str.writeELFXword<IsELF64>(Rela.r_info); |
370 Str.writeELFXword<IsELF64>(Rela.r_addend); | 372 Str.writeELFXword<IsELF64>(Rela.r_addend); |
371 } else { | 373 } else { |
372 Elf32_Rel Rel; | 374 Elf32_Rel Rel; |
373 Rel.r_offset = Fixup.position(); | 375 Rel.r_offset = Fixup.position(); |
374 Rel.setSymbolAndType(Symbol->getNumber(), Fixup.kind()); | 376 Rel.setSymbolAndType(Symbol->getNumber(), Fixup.kind()); |
375 Str.writeAddrOrOffset<IsELF64>(Rel.r_offset); | 377 Str.writeAddrOrOffset<IsELF64>(Rel.r_offset); |
376 Str.writeELFWord<IsELF64>(Rel.r_info); | 378 Str.writeELFWord<IsELF64>(Rel.r_info); |
377 } | 379 } |
378 } | 380 } |
379 } | 381 } |
380 | 382 |
381 } // end of namespace Ice | 383 } // end of namespace Ice |
382 | 384 |
383 #endif // SUBZERO_SRC_ICEELFSECTION_H | 385 #endif // SUBZERO_SRC_ICEELFSECTION_H |
OLD | NEW |