Using "-mllvm -debug" with "-flto" during link-time code generation

I've got an --enable-debug-runtime build of LLVM (current trunk).
Using "-mllvm -debug" works fine for compile invocations of clang. But
I can't get debug output from LLVM when doing a link with "-flto
-fuse-ld=gold", all I get are a series of "argument unused during
compilation" warnings.

What's the prescribed set of arguments to enable debug output for the
-flto codegen/link stage?

Look here for details:

Tu put it short: "-Wl,-plugin-opt=-print-after-all -Wl,-plugin-opt=-debug"