[lld] r303961 - Rearrange code for the sake of readability. NFC.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Thu May 25 19:27:19 PDT 2017
Author: ruiu
Date: Thu May 25 21:27:19 2017
New Revision: 303961
URL: http://llvm.org/viewvc/llvm-project?rev=303961&view=rev
Log:
Rearrange code for the sake of readability. NFC.
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=303961&r1=303960&r2=303961&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Thu May 25 21:27:19 2017
@@ -1622,18 +1622,6 @@ static uint16_t getELFType() {
// to each section. This function fixes some predefined
// symbol values that depend on section address and size.
template <class ELFT> void Writer<ELFT>::fixPredefinedSymbols() {
- auto Set = [](DefinedRegular *S1, DefinedRegular *S2, OutputSection *Sec,
- uint64_t Value) {
- if (S1) {
- S1->Section = Sec;
- S1->Value = Value;
- }
- if (S2) {
- S2->Section = Sec;
- S2->Value = Value;
- }
- };
-
// _etext is the first location after the last read-only loadable segment.
// _edata is the first location after the last read-write loadable segment.
// _end is the first location after the uninitialized data region.
@@ -1649,12 +1637,26 @@ template <class ELFT> void Writer<ELFT>:
else
LastRO = &P;
}
- if (Last)
- Set(ElfSym::End1, ElfSym::End2, Last->First, Last->p_memsz);
- if (LastRO)
- Set(ElfSym::Etext1, ElfSym::Etext2, LastRO->First, LastRO->p_filesz);
- if (LastRW)
- Set(ElfSym::Edata1, ElfSym::Edata2, LastRW->First, LastRW->p_filesz);
+
+ auto Set = [](DefinedRegular *S, OutputSection *Sec, uint64_t Value) {
+ if (S) {
+ S->Section = Sec;
+ S->Value = Value;
+ }
+ };
+
+ if (Last) {
+ Set(ElfSym::End1, Last->First, Last->p_memsz);
+ Set(ElfSym::End2, Last->First, Last->p_memsz);
+ }
+ if (LastRO) {
+ Set(ElfSym::Etext1, LastRO->First, LastRO->p_filesz);
+ Set(ElfSym::Etext2, LastRO->First, LastRO->p_filesz);
+ }
+ if (LastRW) {
+ Set(ElfSym::Edata1, LastRW->First, LastRW->p_filesz);
+ Set(ElfSym::Edata2, LastRW->First, LastRW->p_filesz);
+ }
if (ElfSym::Bss)
ElfSym::Bss->Section = findSection(".bss");
More information about the llvm-commits
mailing list