[lld] r314842 - Move fetchIfLazy up so that the following comment makes sense.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 3 13:45:09 PDT 2017


Author: ruiu
Date: Tue Oct  3 13:45:09 2017
New Revision: 314842

URL: http://llvm.org/viewvc/llvm-project?rev=314842&view=rev
Log:
Move fetchIfLazy up so that the following comment makes sense.

We have this comment in LinkerDriver::link

  After this, no new names except a few linker-synthesized ones
  will be added to the symbol table.

but that was not true because new symbols could be added by processing
the -u option.

Modified:
    lld/trunk/ELF/Driver.cpp

Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=314842&r1=314841&r2=314842&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Tue Oct  3 13:45:09 2017
@@ -1031,6 +1031,10 @@ template <class ELFT> void LinkerDriver:
   for (StringRef Sym : Script->Opt.ReferencedSymbols)
     Symtab->addUndefined<ELFT>(Sym);
 
+  // Handle the `--undefined <sym>` options.
+  for (StringRef S : Config->Undefined)
+    Symtab->fetchIfLazy<ELFT>(S);
+
   // If an entry symbol is in a static archive, pull out that file now
   // to complete the symbol table. After this, no new names except a
   // few linker-synthesized ones will be added to the symbol table.
@@ -1040,10 +1044,6 @@ template <class ELFT> void LinkerDriver:
   if (ErrorCount)
     return;
 
-  // Handle the `--undefined <sym>` options.
-  for (StringRef S : Config->Undefined)
-    Symtab->fetchIfLazy<ELFT>(S);
-
   // Handle undefined symbols in DSOs.
   Symtab->scanShlibUndefined<ELFT>();
 




More information about the llvm-commits mailing list