[PATCH] D27900: [ELF] - Keep the source file/line location information separate from the object file location information.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 22 00:46:25 PST 2017
grimar added a comment.
In https://reviews.llvm.org/D27900#683209, @silvas wrote:
> 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 agree. Linker works with object files and not sources. Reporting errors in sources at first place is confusing IMO.
> 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.
I think this patch currently implements idea of such output.
(or am I missing something ?)
https://reviews.llvm.org/D27900
More information about the llvm-commits
mailing list