http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46749

--- Comment #34 from rguenther at suse dot de <rguenther at suse dot de> 
2010-12-04 10:27:58 UTC ---
On Sat, 4 Dec 2010, mikestump at comcast dot net wrote:

> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46749
> 
> --- Comment #31 from Mike Stump <mikestump at comcast dot net> 2010-12-04 
> 00:18:07 UTC ---
> On Dec 3, 2010, at 3:20 PM, rguenther at suse dot de wrote:
> > yes, I would have expected that this happens already.  Now, I (or
> > somebody else) needs to take the time and investigate why this
> > doesn't happen.
> 
> Ah, I can explain it, collect2 does `stuff', and what it does is to remove the
> lto temporary files, early.  The below are the files that are too early, and
> will `fix' the issue.
> 
> Index: collect2.c
> ===================================================================
> --- collect2.c    (revision 167409)
> +++ collect2.c    (working copy)
> @@ -1056,7 +1056,9 @@
>        fork_execute ("ld", out_lto_ld_argv);
>        free (lto_ld_argv);
> 
> +#if 0
>        maybe_unlink_list (lto_o_files);
> +#endif
>      }
>    else if (force)
>      {
> 
> If collect2 was folded into gcc.c and all the lto stuff was flat, inside gcc.c
> and then we let record_temp_file register _all_ the temporary files, and the
> let gcc.c delete the temporary files at the end, all work work just fine.

Well - yes.  There is the complication called linker-plugin (which
is also removing the files).  You can't fold the linker plugin
(thus, the linker) into the gcc driver.

I thought a long time on what a solution to the problem could be and
only see the following:

 - The GCC driver is the place where we can detect if we need to
   execute dsymutil because we'll only have temporary object files.
   The GCC driver needs to arrange for a new -dsym option being
   passed to the linker (which might be collect2 for example)

 - The _linker_ (or collect2 for example) is responsible for
   invoking dsymutil if there is a -dsym option on the command-line.
   Only at link time we are sure all object files are still around.

If darwin only ever uses collect2 (and not the linker-plugin) then
this would be a easy and localized change.  It would of course also
offer the user to specify that he wants dsymutil to run.

Richard.

Reply via email to