This is an archive of the discontinued LLVM Phabricator instance.

[lld-link] Consistently print all /verbose output to stderr
ClosedPublic

Authored by thakis on Jan 5 2022, 8:30 AM.

Details

Summary

lld-link used to consistently print all /verbose output to stdout, and that was
an intentional decision: https://reviews.llvm.org/rG4bce7bcc88f3

https://reviews.llvm.org/rGe6e206d4b4814 added message() and log(),
and back then log() morally was just if (verbose) message(...)
and message() wrote to stdout.

So that change moved most /verbose-induced writes to outs() to
log(). Except for the one in printDiscardedMessage(), since
the check for verbose for that one is in the caller, in
Writer::createSections():

if (config->verbose)
  sc->printDiscardedMessage();

Later, https://reviews.llvm.org/D41033 changed log() to write to
stderr. That moved lld-link from writing all its /verbose output
to stdout to writing almost all of its /verbose output to stderr --
except for printDiscardedMessage() output.

This change moves printDiscardedMessage() to call log() as well,
so that all /verbose output once again consistently goes to the same
stream.

Diff Detail

Event Timeline

thakis requested review of this revision.Jan 5 2022, 8:30 AM
thakis created this revision.
hans accepted this revision.Jan 5 2022, 8:34 AM

lgtm, nice digging!

This revision is now accepted and ready to land.Jan 5 2022, 8:34 AM
This revision was landed with ongoing or failed builds.Jan 5 2022, 8:52 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJan 5 2022, 8:52 AM