This is an archive of the discontinued LLVM Phabricator instance.

[LLD] [MinGW] Print errors/warnings in lld-link with a "ld.lld" prefix
ClosedPublic

Authored by mstorsjo on Jun 18 2021, 5:36 AM.

Details

Summary

Pass the original argv[0] to the coff linker, as the coff linker uses
the basename of argv[0] as the log prefix.

This makes error messages to be printed with a "ld.lld:" prefix
instead of "lld-link:". The current "lld-link:" prefix can be confusing
to users, as they're invoking the MinGW linker (and might not even have
a lld-link executable).

Keep the first argument as lld-link when printing the command line, to
make it an actually reproducible standalone command.

To actually test the effect of this, we'd have to actually do linking
from the test/MinGW subdirectory (which we don't do so far) and
have that link trigger an error.

Do you think it's necessary to make a standalone failing link test
to test the effect of this, or is it good as is?

Diff Detail

Event Timeline

mstorsjo requested review of this revision.Jun 18 2021, 5:36 AM
mstorsjo created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptJun 18 2021, 5:36 AM
rnk accepted this revision.Jun 18 2021, 9:49 AM

To actually test the effect of this, we'd have to actually do linking
from the test/MinGW subdirectory (which we don't do so far) and
have that link trigger an error.

Do you think it's necessary to make a standalone failing link test
to test the effect of this, or is it good as is?

I think mingw lld can certainly have integration tests. I think it's better to focus on testing at the smallest testable boundary, which is the argument translation layer, but tactical integration testing is also valuable.

I don't think it's strictly necessary in this case, but if you'd like to add one, go for it.

This revision is now accepted and ready to land.Jun 18 2021, 9:49 AM

To actually test the effect of this, we'd have to actually do linking
from the test/MinGW subdirectory (which we don't do so far) and
have that link trigger an error.

Do you think it's necessary to make a standalone failing link test
to test the effect of this, or is it good as is?

I think mingw lld can certainly have integration tests. I think it's better to focus on testing at the smallest testable boundary, which is the argument translation layer, but tactical integration testing is also valuable.

I don't think it's strictly necessary in this case, but if you'd like to add one, go for it.

Thanks! Yes, overall it wouldn't be any big issue to have such tests (as it's all within the lld project anyway, it doesn't depend on other tools) - but I'll think I'll skip this time; if the code was written this way from the start, it's not something I think we'd think of needing a testcase for anyway.