[PATCH] D70287: [LLD][COMMON] Fix Incorrect Stream in LLD ErrorHandler

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 14 19:40:20 PST 2019


ruiu added a comment.

In D70287#1746897 <https://reviews.llvm.org/D70287#1746897>, @blackhole12 wrote:

> I am calling LLD from within another command line application, and I only want to display output from LLD if there is an actual error, or the user has enabled verbose logging, but several places in LLD use message() during the linking process even if it succeeds, which will output directly to stdout with no way for me to portably redirect it (unless I use `freopen`, which permanently redirects it to a file, forever, and cannot be restored afterwards). If there needs to be a separate stream for non-error messages, then there should be a way to pass that into the `link()` function as well, instead of bypassing everything and outputting directly to stdout.


I guess you are using lld as a library -- you call lld::elf::link from your program, right?

If so, it sounds like we probably should add a new parameter to lld::elf::link to specify stdout just like what we are doing for stderr.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70287/new/

https://reviews.llvm.org/D70287





More information about the llvm-commits mailing list