Currently the lto plugin has a somewhat obscure incantation to get it to save 
its temp files, and at least one is not named in any sensible way for 
development examination.

This patch makes it follow the same approach as collect2. 

-save-temps causes the temp file to be named meaningfully, and for the relevant 
input files to be saved in CWD.
-v, —version causes the save actions to be output to stderr.

——

one can get this to happen by just putting -save-temps, -v on the regular link 
line or (for compatibility with the way the -debug flag works, by appending 
-plugin-opt=-save-temps, etc.

(the latter change might be a bit OTT, I was in two minds about deleting that 
part, but …)

tested on x86_64-linux-gnu.

OK for trunk?
Iain

lto-plugin/

        * lto-plugin.c (exec_lto_wrapper): Make the wrapper
        arguments filename more user-friendly.
        (file_exists, maybe_unlink): New.
        (cleanup_handler): Use maybe unlink to handle the
        case when temps should be saved.
        (process_option): Look for -v, —version, -save-temps.
        (onload): Record the linker output file name.
        Check for  -v, —version, -save-temps in GCC collect
        options environment.

Attachment: lto-plugin-save-temps.diff
Description: Binary data

Reply via email to