The 'undefined symbol' is likely most common linker error, so linker typically show some location information
to make identifying problem source easier. With this patch lld will show following information about error source:
- Source file name in case STT_FILE symbol is present in object file
- Function name, if it can be retrieved.
- section name + offset
In addition to this ld/gold can show line number if debug info is present. This is the next thing I plan to do.
I think this is too smart, at least as the initial implementation. This function is run only when an error occurs, and for error cases, we don't pursue performance. Instead I'd like to keep it simple as possible. So, could you please remove this class and define a non-member function? I think it is okay to parse debug info for each error message.