OLD | NEW |
---|---|
1 //===- subzero/src/IceELFObjectWriter.cpp - ELF object file writer --------===// | 1 //===- subzero/src/IceELFObjectWriter.cpp - ELF object file writer --------===// |
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 the writer for ELF relocatable object files. | 10 // This file defines the writer for ELF relocatable object files. |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
526 template void ELFObjectWriter::writeConstantPool<ConstantFloat>(Type Ty); | 526 template void ELFObjectWriter::writeConstantPool<ConstantFloat>(Type Ty); |
527 | 527 |
528 template void ELFObjectWriter::writeConstantPool<ConstantDouble>(Type Ty); | 528 template void ELFObjectWriter::writeConstantPool<ConstantDouble>(Type Ty); |
529 | 529 |
530 void ELFObjectWriter::writeAllRelocationSections(bool IsELF64) { | 530 void ELFObjectWriter::writeAllRelocationSections(bool IsELF64) { |
531 writeRelocationSections(IsELF64, RelTextSections); | 531 writeRelocationSections(IsELF64, RelTextSections); |
532 writeRelocationSections(IsELF64, RelDataSections); | 532 writeRelocationSections(IsELF64, RelDataSections); |
533 writeRelocationSections(IsELF64, RelRODataSections); | 533 writeRelocationSections(IsELF64, RelRODataSections); |
534 } | 534 } |
535 | 535 |
536 void ELFObjectWriter::setUndefinedSyms(const ConstantList &UndefSyms) { | |
537 for (const Constant *S : UndefSyms) { | |
538 const auto Sym = llvm::cast<ConstantRelocatable>(S); | |
539 IceString Name = Sym->getName(); | |
Jim Stichnoth
2015/02/01 03:23:55
The fact that this is IceString instead of IceStri
jvoung (off chromium)
2015/02/01 17:07:56
Hmm I can check if they can be converted to return
| |
540 assert(Sym->getOffset() == 0 && Sym->getSuppressMangling()); | |
Jim Stichnoth
2015/02/01 03:23:55
I realize there are "violations" elsewhere, but I
jvoung (off chromium)
2015/02/01 17:07:56
Oops done.
| |
541 SymTab->noteUndefinedSym(Name, NullSection); | |
542 StrTab->add(Name); | |
543 } | |
544 } | |
545 | |
536 void ELFObjectWriter::writeRelocationSections(bool IsELF64, | 546 void ELFObjectWriter::writeRelocationSections(bool IsELF64, |
537 RelSectionList &RelSections) { | 547 RelSectionList &RelSections) { |
538 for (ELFRelocationSection *RelSec : RelSections) { | 548 for (ELFRelocationSection *RelSec : RelSections) { |
539 Elf64_Off Offset = alignFileOffset(RelSec->getSectionAlign()); | 549 Elf64_Off Offset = alignFileOffset(RelSec->getSectionAlign()); |
540 RelSec->setFileOffset(Offset); | 550 RelSec->setFileOffset(Offset); |
541 RelSec->setSize(RelSec->getSectionDataSize(Ctx, SymTab)); | 551 RelSec->setSize(RelSec->getSectionDataSize()); |
542 if (IsELF64) { | 552 if (IsELF64) { |
543 RelSec->writeData<true>(Ctx, Str, SymTab); | 553 RelSec->writeData<true>(Ctx, Str, SymTab); |
544 } else { | 554 } else { |
545 RelSec->writeData<false>(Ctx, Str, SymTab); | 555 RelSec->writeData<false>(Ctx, Str, SymTab); |
546 } | 556 } |
547 } | 557 } |
548 } | 558 } |
549 | 559 |
550 void ELFObjectWriter::writeNonUserSections() { | 560 void ELFObjectWriter::writeNonUserSections() { |
551 bool IsELF64 = isELF64(Ctx.getTargetArch()); | 561 bool IsELF64 = isELF64(Ctx.getTargetArch()); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
592 if (IsELF64) { | 602 if (IsELF64) { |
593 writeELFHeaderInternal<true>(ShOffset, ShStrTab->getNumber(), | 603 writeELFHeaderInternal<true>(ShOffset, ShStrTab->getNumber(), |
594 AllSections.size()); | 604 AllSections.size()); |
595 } else { | 605 } else { |
596 writeELFHeaderInternal<false>(ShOffset, ShStrTab->getNumber(), | 606 writeELFHeaderInternal<false>(ShOffset, ShStrTab->getNumber(), |
597 AllSections.size()); | 607 AllSections.size()); |
598 } | 608 } |
599 } | 609 } |
600 | 610 |
601 } // end of namespace Ice | 611 } // end of namespace Ice |
OLD | NEW |