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.

llvm-svn: 314842
This commit is contained in:
Rui Ueyama 2017-10-03 20:45:09 +00:00
parent fa105f8deb
commit a215e7cbe8
1 changed files with 4 additions and 4 deletions

View File

@ -1031,6 +1031,10 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &Args) {
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::link(opt::InputArgList &Args) {
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>();