Previously, if a symbol function was undefined, LLD was trying to print its referenced locations, and was failing with two different errors:
- Stream Error: The specified offset is invalid for the current stream
- CodeView Error: There are no records
Nothing else was printed.
The fix covers these two cases: one is a Lines subsection without anything in it; the other is when the provided Addr param is <= Line.Offset.
The original OBJ was compiled with Clang. The provided test is simply a reduction of our case.
The source of these two bugs seems to lie in how Clang emits Lines subsections; however I wanted to ensure LLD handles these correctly first.
I think zero initializing these both is better than using Optional. The string table index 0 gives the empty string, right? It seems nicer to use that and avoid the extra conditional branches. I guess you'd still need the branch in the loop to say, if we don't have a filename so far but we have an entry, use the next entry. Although, the branchless way to write that is to pull the first filename string table index from the first line table entry if it exists.