On Wed, May 22, 2024 at 05:23:33PM +0800, YunQiang Su wrote:
> Jakub Jelinek <ja...@redhat.com> 于2024年5月22日周三 17:14写道:
> >
> > On Wed, May 22, 2024 at 05:05:30PM +0800, YunQiang Su wrote:
> > > > --- gcc/gcc.cc.jj       2024-02-09 14:54:09.141489744 +0100
> > > > +++ gcc/gcc.cc  2024-02-09 22:04:37.655678742 +0100
> > > > @@ -2410,8 +2410,7 @@ read_specs (const char *filename, bool m
> > > >               if (*p1++ != '<' || p[-2] != '>')
> > > >                 fatal_error (input_location,
> > > >                              "specs %%include syntax malformed after "
> > > > -                            "%ld characters",
> > > > -                            (long) (p1 - buffer + 1));
> > > > +                            "%td characters", p1 - buffer + 1);
> > > >
> > >
> > > Should we use %td later for gcc itself? Since we may use older
> > > compiler to build gcc.
> > > My major workstation is Debian Bookworm, which has GCC 12, and then I
> > > get some warnings:
> >
> > That is fine and expected.  During stage1 such warnings are intentionally
> > not fatal, only in stage2+ when we know it is the same version of gcc
> > we want those can be fatal.
> 
> It may have only 1 stage in some cases.
> For example we have a full binutils/libc stack, and just build a cross-gcc.
> For all libraries for target, such as libgcc etc, it is OK; while for
> host executables
> it will be a problem.

That is still ok, it is just a warning about unknown gcc format specifiers,
at runtime the code from the compiler being built will be used and that
handles those.  We have added dozens of these over years, %td/%zd certainly
aren't an exception.  Just try to build with some older gcc version, say
4.8.5, and you'll see far more such warnings.
But also as recommended, you shouldn't be building cross-gcc with old
version of gcc, you should use same version of the native compiler to
build the cross compiler.

https://gcc.gnu.org/install/build.html

"To build a cross compiler, we recommend first building and installing a native
compiler. You can then use the native GCC compiler to build the cross
compiler."

        Jakub

Reply via email to