On Thu, 9 Jul 2020, Alex Coplan wrote: > 2020-07-09 Alex Coplan <alex.cop...@arm.com> > > * gcc.c (set_static_spec): New. > (set_static_spec_owned): New. > (set_static_spec_shared): New. > (driver::maybe_putenv_COLLECT_LTO_WRAPPER): Use > set_static_spec_owned() to take ownership of lto_wrapper_file > such that it gets freed in driver::finalize. > (driver::maybe_run_linker): Use set_static_spec_shared() to > ensure that we don't try and free() the static string "ld", > also ensuring that any previously-allocated string in > linker_name_spec is freed. Likewise with argv0. > (driver::finalize): Use set_static_spec_shared() when resetting > specs that previously had allocated strings; remove if(0) > around call to free().
OK with a comment added to set_static_spec, documenting the semantics of the function and its arguments. -- Joseph S. Myers jos...@codesourcery.com