(WIP) use debuginfo for undefined references #543
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an unfinished work that tries to use debuginfo to report source locations of places that cause undefined references, rather than just the object file. The reason I'm submitting this unfinished version is that debuginfo requires relocating to be usable, otherwise references between sections do not work (relocations include also offsets within the section, and without relocations those values are 0, pointing to incorrect places in the debuginfo data in the .o file).
The debuginfo relocations need to be done somewhere, and currently it's done while writing the entire output file, so for now the patch delays reporting the undefined symbols until after that, since currently molds always processes the entire file even if there are errors. But you reverted the delayed processing of undefined references, and I don't know if it's possible to process debuginfo and its relocations before non-delayed undefined references handling. This changeset reverts the revert for simplicity, but I don't want to change the code back to delayed if you'd change it back yet again, so I wanted to ask for feedback on this.