[PATCH] D18047: [ELF] - Do not call doInitSymbols for all ELFTs

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 10 09:43:42 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL263133: [ELF] - Do not call doInitSymbols for all ELFTs (authored by grimar).

Changed prior to commit:
  http://reviews.llvm.org/D18047?vs=50283&id=50294#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D18047

Files:
  lld/trunk/ELF/Driver.cpp
  lld/trunk/ELF/Symbols.cpp
  lld/trunk/ELF/Symbols.h

Index: lld/trunk/ELF/Symbols.h
===================================================================
--- lld/trunk/ELF/Symbols.h
+++ lld/trunk/ELF/Symbols.h
@@ -41,8 +41,7 @@
 template <class ELFT> class SharedFile;
 
 // Initializes global objects defined in this file.
-// Called at the beginning of main().
-void initSymbols();
+template <class ELFT> void initSymbols();
 
 // Returns a demangled C++ symbol name. If Name is not a mangled
 // name or the system does not provide __cxa_demangle function,
Index: lld/trunk/ELF/Driver.cpp
===================================================================
--- lld/trunk/ELF/Driver.cpp
+++ lld/trunk/ELF/Driver.cpp
@@ -168,8 +168,6 @@
 }
 
 void LinkerDriver::main(ArrayRef<const char *> ArgsArr) {
-  initSymbols();
-
   opt::InputArgList Args = parseArgs(&Alloc, ArgsArr.slice(1));
   if (Args.hasArg(OPT_help)) {
     printHelp(ArgsArr[0]);
@@ -317,6 +315,7 @@
 }
 
 template <class ELFT> void LinkerDriver::link(opt::InputArgList &Args) {
+  initSymbols<ELFT>();
   // For LTO
   InitializeAllTargets();
   InitializeAllTargetMCs();
Index: lld/trunk/ELF/Symbols.cpp
===================================================================
--- lld/trunk/ELF/Symbols.cpp
+++ lld/trunk/ELF/Symbols.cpp
@@ -209,21 +209,14 @@
   return createObjectFile(MBRef, File->getName());
 }
 
-template <class ELFT> static void doInitSymbols() {
+template <class ELFT> void elf::initSymbols() {
   ElfSym<ELFT>::Etext.setBinding(STB_GLOBAL);
   ElfSym<ELFT>::Edata.setBinding(STB_GLOBAL);
   ElfSym<ELFT>::End.setBinding(STB_GLOBAL);
   ElfSym<ELFT>::Ignored.setBinding(STB_WEAK);
   ElfSym<ELFT>::Ignored.setVisibility(STV_HIDDEN);
 }
 
-void elf::initSymbols() {
-  doInitSymbols<ELF32LE>();
-  doInitSymbols<ELF32BE>();
-  doInitSymbols<ELF64LE>();
-  doInitSymbols<ELF64BE>();
-}
-
 // Returns the demangled C++ symbol name for Name.
 std::string elf::demangle(StringRef Name) {
 #if !defined(HAVE_CXXABI_H)
@@ -289,3 +282,8 @@
 template class elf::DefinedSynthetic<ELF32BE>;
 template class elf::DefinedSynthetic<ELF64LE>;
 template class elf::DefinedSynthetic<ELF64BE>;
+
+template void elf::initSymbols<ELF32LE>();
+template void elf::initSymbols<ELF32BE>();
+template void elf::initSymbols<ELF64LE>();
+template void elf::initSymbols<ELF64BE>();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18047.50294.patch
Type: text/x-patch
Size: 2286 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160310/dc97b937/attachment.bin>


More information about the llvm-commits mailing list