This is an archive of the discontinued LLVM Phabricator instance.

[ELF] - Better diagnostics for linker script errors
AbandonedPublic

Authored by grimar on Mar 29 2016, 4:42 AM.

Details

Reviewers
ruiu
rafael
Summary

Patch adds "line X:" to output for linker script errors.

It is sometimes difficult to understand what is going on when you
see something like ": expected, but got =".
With this patch that would be: "line XXX: : expected, but got =".

If this is reasonable I can also add the exact line of script to the output
in separate patch if this be landed (so users will not need to search
the line by number by himself).

Diff Detail

Event Timeline

grimar updated this revision to Diff 51892.Mar 29 2016, 4:42 AM
grimar retitled this revision from to [ELF] - Better diagnostics for linker script errors.
grimar updated this object.
grimar added reviewers: ruiu, rafael.
grimar added subscribers: llvm-commits, grimar.
emaste added a subscriber: emaste.Mar 29 2016, 6:19 AM

If you do display the full line and keep track of the column too then the "but got" can be removed from the message.

.keep + { *(.keep) }
      ^
test.script:3:7: error: ':' expected

Having at least the line number for now though would be a good help while testing the in-progress linker script support.

If you do display the full line and keep track of the column too then the "but got" can be removed from the message.

.keep + { *(.keep) }
      ^
test.script:3:7: error: ':' expected

Having at least the line number for now though would be a good help while testing the in-progress linker script support.

Yes, that would look better IMO. This patch can put a start for implementation of such messages.

ruiu edited edge metadata.Mar 29 2016, 10:37 AM

Please take a look at http://reviews.llvm.org/D18563 (I didn't test it but made up to describe my idea). Because we have a complete string in memory, it is easier to count the number of newlines in string after an error is raised, instead of counting it while parsing the string.

grimar abandoned this revision.Mar 30 2016, 7:07 AM

D18563 is better