On Thu, Jun 27, 2024 at 10:40 AM Uros Bizjak <ubiz...@gmail.com> wrote:
>
> On Thu, Jun 27, 2024 at 9:16 AM Evgeny Karpov
> <evgeny.kar...@microsoft.com> wrote:
> >
> > Thank you for reporting the issues and discussing the root causes.
> > It helped in preparing the patch.
> >
> > This patch fixes 3 bugs reported after merging
> > the "Add DLL import/export implementation to AArch64" series.
> > https://gcc.gnu.org/pipermail/gcc-patches/2024-June/653955.html
> > The series refactors the i386 codebase to reuse it in AArch64, which
> > triggers some bugs.
> >
> > Bug 115661 - [15 Regression] wrong code at -O{2,3} on
> > x86_64-linux-gnu since r15-1599-g63512c72df09b4
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115661
> >
> > Bug 115635 - [15 regression] Bootstrap fails with failed
> > self-test with the rust fe (diagnostic-path.cc:1153:
> > test_empty_path: FAIL: ASSERT_FALSE
> > ((path.interprocedural_p ()))) since r15-1599-g63512c72df09b4
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115635
> >
> > Issue 1. In some code, i386 has been relying on the
> > legitimize_pe_coff_symbol call on all platforms and should return
> > NULL_RTX if it is not supported.
> >
> > Fix: NULL_RTX handling has been added when the target does not
> > support PECOFF.
> >
> > Issue 2. ix86_GOT_alias_set is used on all platforms and cannot be
> > extracted to mingw.
> >
> > Fix: ix86_GOT_alias_set has been returned as it was and is used on
> > all platforms for i386.
> >
> > Bug 115643 - [15 regression] aarch64-w64-mingw32 support today breaks
> > x86_64-w64-mingw32 build cannot represent relocation type
> > BFD_RELOC_64 since r15-1602-ged20feebd9ea31
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115643
> >
> > Issue 3. PE_COFF_EXTERN_DECL_SHOULD_BE_LEGITIMIZED has been added and used
> > with a negative operator for a complex expression without braces.
> >
> > Fix: Braces has been added, and
> > PE_COFF_EXTERN_DECL_SHOULD_BE_LEGITIMIZED has been renamed to
> > PE_COFF_LEGITIMIZE_EXTERN_DECL.
> >
> >
> > The patch has been attached as a text file because it contains special
> > characters that are usually removed by the mail client.
>
> > diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc
> > index 5dfa7d49f58..20adb42e17b 100644
> > --- a/gcc/config/i386/i386-expand.cc
> > +++ b/gcc/config/i386/i386-expand.cc
> > @@ -414,6 +414,10 @@ ix86_expand_move (machine_mode mode, rtx operands[])
> >   {
> >  #if TARGET_PECOFF
> >    tmp = legitimize_pe_coff_symbol (op1, addend != NULL_RTX);
> > +#else
> > +    tmp = NULL_RTX;
> > +#endif
> > +
> >    if (tmp)
> >      {
> >        op1 = tmp;
> > @@ -425,7 +429,6 @@ ix86_expand_move (machine_mode mode, rtx operands[])
> >        op1 = operands[1];
> >        break;
> >      }
> > -#endif
> >   }
> >
> >        if (addend)
>
> tmp can only be set by legitimize_pe_coff_symbol, so !TARGET_PECOFF
> will always get to the "else" part. Do this change simply by moving
> #endif, like the below:
>
> --cut here--
> iff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc
> index 5dfa7d49f58..407db6c215b 100644
> --- a/gcc/config/i386/i386-expand.cc
> +++ b/gcc/config/i386/i386-expand.cc
> @@ -421,11 +421,11 @@ ix86_expand_move (machine_mode mode, rtx operands[])
>                break;
>            }
>          else
> +#endif
>            {
>              op1 = operands[1];
>              break;
>            }
> -#endif
>        }
>
>       if (addend)
> --cut here--
>
> Side note, legitimize_pe_coff_symbol is always called from #if
> TARGET_PECOFF, so:
>
> rtx
> legitimize_pe_coff_symbol (rtx addr, bool inreg)
> {
>   if (!TARGET_PECOFF)
>     return NULL_RTX;
>
> should be removed or converted to gcc_assert.
>
> > +alias_set_type
> > +ix86_GOT_alias_set (void)
> > +{
> > +  static alias_set_type set = -1;
>
> Please add a line of vertical space here.
>
> > +  if (set == -1)
> > +    set = new_alias_set ();
> > +  return set;
>
> OK, but please allow RichartB to look at the alias_set changes.

I see that it basically reverts to the old behavior so OK from my side.

Richard.

> Thanks,
> Uros.

Reply via email to