diff mbox

PR36312

Message ID CAESRpQDfSJgm3G9xriCVDgpP4XJYfdDzK1iUygm1SgAtU_S6TA@mail.gmail.com
State New
Headers show

Commit Message

Manuel López-Ibáñez Nov. 6, 2014, 12:26 a.m. UTC
On 5 November 2014 21:57, Eric Botcazou <ebotcazou@adacore.com> wrote:
>> 2014-10-25  Anthony Brandon  <anthony.brandon@gmail.com>
>>
>>     PR driver/36312
>>     * diagnostic-core.h: Add prototype for fatal_error.
>>     * diagnostic.c (fatal_error): New function fatal_error.
>>     * gcc.c (store_arg): Remove have_o_argbuf_index.
>>     (process_command): Check if input and output files are the same.
>>     * toplev.c (init_asm_output): Check if input and output files are the
>> same.
>
> This breaks the build of the shared Ada library:

It seems the driver adds as input files all the flags passed to the
linker, things such as "-lm", "-soname" and "libgnat-5.0.so". Very
intuitive, not. At least these fake files are marked with '*', so the
following on top of the patch should work:


Testing now.

Cheers,

Manuel.

Comments

Anthony Brandon Nov. 6, 2014, 8:13 p.m. UTC | #1
Sorry, I didn't realize the default didn't build all languages. I will
configure with --enable-languages=all from now on.


On Thu, Nov 6, 2014 at 1:26 AM, Manuel López-Ibáñez
<lopezibanez@gmail.com> wrote:
> On 5 November 2014 21:57, Eric Botcazou <ebotcazou@adacore.com> wrote:
>>> 2014-10-25  Anthony Brandon  <anthony.brandon@gmail.com>
>>>
>>>     PR driver/36312
>>>     * diagnostic-core.h: Add prototype for fatal_error.
>>>     * diagnostic.c (fatal_error): New function fatal_error.
>>>     * gcc.c (store_arg): Remove have_o_argbuf_index.
>>>     (process_command): Check if input and output files are the same.
>>>     * toplev.c (init_asm_output): Check if input and output files are the
>>> same.
>>
>> This breaks the build of the shared Ada library:
>
> It seems the driver adds as input files all the flags passed to the
> linker, things such as "-lm", "-soname" and "libgnat-5.0.so". Very
> intuitive, not. At least these fake files are marked with '*', so the
> following on top of the patch should work:
>
> Index: gcc.c
> ===================================================================
> --- gcc.c       (revision 217149)
> +++ gcc.c       (working copy)
> @@ -4051,11 +4051,12 @@ process_command (unsigned int decoded_op
>
>    if (output_file && strcmp (output_file, "-"))
>      {
>        int i;
>        for (i = 0; i < n_infiles; i++)
> -       if (canonical_filename_eq (infiles[i].name, output_file))
> +       if (infiles[i].language && infiles[i].language[0] != '*'
> +           && canonical_filename_eq (infiles[i].name, output_file))
>           fatal_error ("output file %s is the same as input file", output_file);
>      }
>
>    /* If -save-temps=obj and -o name, create the prefix to use for %b.
>       Otherwise just make -save-temps=obj the same as -save-temps=cwd.  */
>
> Testing now.
>
> Cheers,
>
> Manuel.
diff mbox

Patch

Index: gcc.c
===================================================================
--- gcc.c       (revision 217149)
+++ gcc.c       (working copy)
@@ -4051,11 +4051,12 @@  process_command (unsigned int decoded_op

   if (output_file && strcmp (output_file, "-"))
     {
       int i;
       for (i = 0; i < n_infiles; i++)
-       if (canonical_filename_eq (infiles[i].name, output_file))
+       if (infiles[i].language && infiles[i].language[0] != '*'
+           && canonical_filename_eq (infiles[i].name, output_file))
          fatal_error ("output file %s is the same as input file", output_file);
     }

   /* If -save-temps=obj and -o name, create the prefix to use for %b.
      Otherwise just make -save-temps=obj the same as -save-temps=cwd.  */