[lld] r300259 - Replace a clever lambda helper with a simpler one.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 13 14:23:03 PDT 2017
Author: ruiu
Date: Thu Apr 13 16:23:03 2017
New Revision: 300259
URL: http://llvm.org/viewvc/llvm-project?rev=300259&view=rev
Log:
Replace a clever lambda helper with a simpler one.
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=300259&r1=300258&r2=300259&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Thu Apr 13 16:23:03 2017
@@ -874,20 +874,17 @@ template <class ELFT> void Writer<ELFT>:
// __ehdr_start is the location of ELF file headers.
addOptionalRegular<ELFT>("__ehdr_start", Out::ElfHeader, 0, STV_HIDDEN);
- // __bss_start is the location of .bss section.
- ElfSym::Bss =
- addOptionalRegular<ELFT>("__bss_start", Out::ElfHeader, 0, STV_DEFAULT);
-
- auto Define = [](StringRef S, DefinedRegular *&Sym1, DefinedRegular *&Sym2) {
- Sym1 = addOptionalRegular<ELFT>(S, Out::ElfHeader, 0, STV_DEFAULT);
- assert(S.startswith("_"));
- S = S.substr(1);
- Sym2 = addOptionalRegular<ELFT>(S, Out::ElfHeader, 0, STV_DEFAULT);
+ auto Add = [](StringRef S) {
+ return addOptionalRegular<ELFT>(S, Out::ElfHeader, 0, STV_DEFAULT);
};
- Define("_end", ElfSym::End, ElfSym::End2);
- Define("_etext", ElfSym::Etext, ElfSym::Etext2);
- Define("_edata", ElfSym::Edata, ElfSym::Edata2);
+ ElfSym::Bss = Add("__bss_start");
+ ElfSym::End = Add("_end");
+ ElfSym::End2 = Add("end");
+ ElfSym::Etext = Add("_etext");
+ ElfSym::Etext2 = Add("etext");
+ ElfSym::Edata = Add("_edata");
+ ElfSym::Edata2 = Add("edata");
}
// Sort input sections by section name suffixes for
More information about the llvm-commits
mailing list