[lld] r304419 - Convert a few user of OutputSections NFC.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 1 09:21:33 PDT 2017
Author: rafael
Date: Thu Jun 1 11:21:33 2017
New Revision: 304419
URL: http://llvm.org/viewvc/llvm-project?rev=304419&view=rev
Log:
Convert a few user of OutputSections NFC.
This is needed to move clearOutputSections earlier.
Modified:
lld/trunk/ELF/Writer.cpp
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=304419&r1=304418&r2=304419&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Thu Jun 1 11:21:33 2017
@@ -1555,9 +1555,11 @@ static uint64_t setOffset(OutputSection
template <class ELFT> void Writer<ELFT>::assignFileOffsetsBinary() {
uint64_t Off = 0;
- for (OutputSection *Sec : OutputSections)
+ for (OutputSectionCommand *Cmd : OutputSectionCommands) {
+ OutputSection *Sec = Cmd->Sec;
if (Sec->Flags & SHF_ALLOC)
Off = setOffset(Sec, Off);
+ }
FileSize = alignTo(Off, Config->Wordsize);
}
@@ -1567,11 +1569,12 @@ template <class ELFT> void Writer<ELFT>:
Off = setOffset(Out::ElfHeader, Off);
Off = setOffset(Out::ProgramHeaders, Off);
- for (OutputSection *Sec : OutputSections)
- Off = setOffset(Sec, Off);
+ for (OutputSectionCommand *Cmd : OutputSectionCommands)
+ Off = setOffset(Cmd->Sec, Off);
SectionHeaderOff = alignTo(Off, Config->Wordsize);
- FileSize = SectionHeaderOff + (OutputSections.size() + 1) * sizeof(Elf_Shdr);
+ FileSize =
+ SectionHeaderOff + (OutputSectionCommands.size() + 1) * sizeof(Elf_Shdr);
}
// Finalize the program headers. We call this function after we assign
@@ -1697,7 +1700,8 @@ template <class ELFT> void Writer<ELFT>:
if (Config->EMachine == EM_MIPS && !ElfSym::MipsGp->Value) {
// Find GP-relative section with the lowest address
// and use this address to calculate default _gp value.
- for (const OutputSection *OS : OutputSections) {
+ for (const OutputSectionCommand *Cmd : OutputSectionCommands) {
+ OutputSection *OS = Cmd->Sec;
if (OS->Flags & SHF_MIPS_GPREL) {
ElfSym::MipsGp->Value = OS->Addr + 0x7ff0;
break;
More information about the llvm-commits
mailing list