This is the mail archive of the
mailing list for the GCC project.
Re: Create a library for tools like collect2 and lto-wrapper (2/2)
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Bernd Schmidt <bernds at codesourcery dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 22 May 2014 15:56:31 +0000
- Subject: Re: Create a library for tools like collect2 and lto-wrapper (2/2)
- Authentication-results: sourceware.org; auth=none
- References: <537DE6E7 dot 7090908 at codesourcery dot com> <537DE766 dot 5040505 at codesourcery dot com>
On Thu, 22 May 2014, Bernd Schmidt wrote:
> The implementations of some functions like fork_execute are changed to those
> from collect2 and the calls in lto-wrapper adapted accordingly. There are some
> minor changes in these functions: for example I avoid calling fatal_error,
> instead using the fatal/fatal_perror functions so that the cleanup routine is
> called properly (lto-wrapper does not use atexit as collect2 does).
Avoiding fatal_error seems like the wrong direction. Using the common
diagnostics code from diagnostic.c is preferred to using custom code.
Thus, as an initial step I'd suggest instead converting lto-wrapper to use
the common functionality where possible (fatal_error with %m replacing
fatal_perror), making it use atexit in the process. Don't move code using
legacy fatal / fatal_perror functions to a common library.
Joseph S. Myers