Allow linker-script-defined entry symbols.

Previously, we were checking the existence of an entry symbol
too early. It was done before the linker script processor creates
symbols defined in scripts. Fixes bug 30743.

llvm-svn: 284676
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index b97ad99..d059c10 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -1278,9 +1278,12 @@
 }
 
 template <class ELFT> static typename ELFT::uint getEntryAddr() {
-  if (Symbol *S = Config->EntrySym)
-    return S->body()->getVA<ELFT>();
-  return Config->EntryAddr;
+  if (Config->Entry.empty())
+    return Config->EntryAddr;
+  if (SymbolBody *B = Symtab<ELFT>::X->find(Config->Entry))
+    return B->getVA<ELFT>();
+  warn("entry symbol " + Config->Entry + " not found, assuming 0");
+  return 0;
 }
 
 template <class ELFT> static uint8_t getELFEncoding() {