[PATCH] D27900: [ELF] - Keep the source file/line location information separate from the object file location information.
Sean Silva via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 21 23:57:40 PST 2017
silvas added a comment.
In https://reviews.llvm.org/D27900#647823, @ruiu wrote:
> Did you actually find that the current error message format is useless in some case? In my experience, the current format works pretty well. It prints out enough information to fix an error and not too verbose. If you still want to pursue this change, please split it, so that we can discuss each change instead of as a whole.
Yes, we can see the current behavior isn't ideal from recent bug reports:
http://bugs.llvm.org/show_bug.cgi?id=32008
http://bugs.llvm.org/show_bug.cgi?id=31901
I think we should treat .s/.c file source locations as "enhancements". At the end of the day we always need to provide completely unambiguous information about the error (object file / archive) IMO.
For example, this is useless (taken from http://bugs.llvm.org/show_bug.cgi?id=32008):
/usr/local/bin/ld.lld: error: /usr/src/lib/libutil/logout.c:46: duplicate symbol 'logout'
/usr/local/bin/ld.lld: error: /usr/src/lib/libutil/logout.c:46: previous definition was here
Even when they aren't the same path, not knowing which actual input file to the linker is still annoying:
/usr/local/bin/ld.lld: error: /usr/src/lib/libc/quad/fixunssfdi.c:52: duplicate symbol '__fixunssfdi'
/usr/local/bin/ld.lld: error: /usr/obj/ports/gcc-4.9.4/gcc-4.9.4/libgcc/libgcc2.c:1434: previous definition was here
I think the example I gave of how Clang handles diagnostics for macros is the one we want to be consistent with (from my example in https://reviews.llvm.org/D27676#622869)
foo.c:4:1: error: redefinition of 'foo'
DEFINITION_OF_FOO
^
foo.c:1:32: note: expanded from macro 'DEFINITION_OF_FOO'
#define DEFINITION_OF_FOO void foo() {}
^
foo.c:3:1: note: previous definition is here
DEFINITION_OF_FOO
^
foo.c:1:32: note: expanded from macro 'DEFINITION_OF_FOO'
#define DEFINITION_OF_FOO void foo() {}
^
1 error generated.
What LLD currently does is more like:
foo.c:1:32: error: redefinition of 'foo'
#define DEFINITION_OF_FOO void foo() {}
^
foo.c:1:32: note: previous definition is here
#define DEFINITION_OF_FOO void foo() {}
^
1 error generated.
https://reviews.llvm.org/D27900
More information about the llvm-commits
mailing list