[ELF] Make __ehdr_start point to ELF file headers

__ehdr_start should be pointing to ELF file headers, not program
headers.

This is a reland of D30319.

Differential Revision: https://reviews.llvm.org/D30323

llvm-svn: 296085
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 835f4d0..9102775 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -844,9 +844,9 @@
   if (ScriptConfig->HasSections)
     return;
 
-  // __ehdr_start is the location of program headers.
+  // __ehdr_start is the location of ELF file headers.
   ElfSym<ELFT>::EhdrStart =
-      addOptionalSynthetic<ELFT>("__ehdr_start", Out<ELFT>::ProgramHeaders, 0);
+      addOptionalSynthetic<ELFT>("__ehdr_start", Out<ELFT>::ElfHeader, 0);
 
   auto Define = [](StringRef S, DefinedSynthetic *&Sym1,
                    DefinedSynthetic *&Sym2) {
@@ -1138,7 +1138,7 @@
   // This is a bit of a hack. A value of 0 means undef, so we set it
   // to 1 t make __ehdr_start defined. The section number is not
   // particularly relevant.
-  Out<ELFT>::ProgramHeaders->SectionIndex = 1;
+  Out<ELFT>::ElfHeader->SectionIndex = 1;
 
   unsigned I = 1;
   for (OutputSectionBase *Sec : OutputSections) {