If the coff timestamp is set to a hash, like lld-link does if /Brepro is passed, the coff spec suggests that a IMAGE_DEBUG_TYPE_REPRO entry is in the debug directory. This lets lld-link write such a section. See bug for details.
link.exe creates a zero-length repro debug directory entry with /debug /Brepro/ Without debug, it puts a longer hash in the repro section. This here lets lld-link always write a zero-length repro debug directory entry.
If the repro entry is the only debug directory entry, it's now no longer guaranteed that DebugDirectoryStart + DataEntry->Size is within a section, so also tweak initDebugDirectoryPtr() to look like initBaseRelocPtr(). Also fix llvm-readobj to not error out when dumping the contents of a zero-length debug directory entry. Both these llvm changes are needed to get llvm-readobj working for the new lld test in this patch.
Fixes PR38429.
format?