Fix -save-temp leaking lto files in /tmp
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Sun, 13 Dec 2020 07:24:57 +0000 (08:24 +0100)
committerBernd Edlinger <bernd.edlinger@hotmail.de>
Mon, 4 Jan 2021 09:03:19 +0000 (10:03 +0100)
commite9f8a554efe497dd46b8953e580d65e5c023e50c
tree88aae5b2daa92d3a6ceaff7addbd960b656992eb
parentc48514bea610d9eaae783fec9d513a690723b0f0
Fix -save-temp leaking lto files in /tmp

When linking with -flto and -save-temps, various
temporary files are created in /tmp.
The same happens when invoking the driver with @file
parameter, and using -L or -I options.

gcc:
2021-01-04  Bernd Edlinger  <bernd.edlinger@hotmail.de>

* collect-utils.c (collect_execute): Check dumppfx.
* collect2.c (maybe_run_lto_and_relink, do_link): Pass atsuffix
to collect_execute.
(do_link): Add new parameter atsuffix.
(main): Handle -dumpdir option.  Skip one argument for
-o, -isystem and -B options.
* gcc.c (make_at_file): New helper function.
(close_at_file): Use it.

gcc/testsuite:
2021-01-04  Bernd Edlinger  <bernd.edlinger@hotmail.de>

* gcc.misc-tests/outputs.exp: Adjust testcase.
gcc/collect-utils.c
gcc/collect2.c
gcc/gcc.c
gcc/testsuite/gcc.misc-tests/outputs.exp