The current logic for defining ehdr_start doesn't match the GNU linkers, whereas LLD does not define ehdr_start whenever a linker script is being used, while GNU linkers defined the symbol whenever there's a loadable segment which contains ELF headers. This change modifies LLD to use the same logic as GNU linkers.
This is complicated by the fact that LLD checks undefined symbols while scanning relocations, which happens before binary layout is finalized and program headers have been created. To handle this, we define the __ehdr_start symbol unconditionally, and only check whether it should have been defined after program headers have been created; if not and there are references to this symbol, we report an error.
What is this doing?