On 1/9/2022 2:26 PM, Serge Belyshev wrote:
Ping: [PATCH] Add --enable-first-stage-cross configure option
https://gcc.gnu.org/pipermail/gcc-patches/2021-July/575318.html


Add --enable-first-stage-cross configure option

Build static-only, C-only compiler that is sufficient to cross compile
glibc.  This option disables various runtime libraries that require
libc to compile, turns on --with-newlib, --without-headers,
--disable-decimal-float, --disable-shared, --disable-threads, and sets
--enable-languages=c.
Rationale: current way of building first stage compiler of a cross
toolchain requires specifying a list of target libraries that are not
going to be compiled due to their dependency on target libc.  This
list is not documented in gccinstall.texi and sometimes changes.  To
simplify the procedure, it is better to maintain that list in the GCC
itself.

Usage example as a patch to glibc's scripts/build-many-libcs.py:

diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py
index 580d25e8ee..3a6a7be76b 100755
--- a/scripts/build-many-glibcs.py
+++ b/scripts/build-many-glibcs.py
@@ -1446,17 +1446,7 @@ class Config(object):
              # required to define inhibit_libc (to stop some parts of
              # libgcc including libc headers); --without-headers is not
              # sufficient.
-            cfg_opts += ['--enable-languages=c', '--disable-shared',
-                         '--disable-threads',
-                         '--disable-libatomic',
-                         '--disable-decimal-float',
-                         '--disable-libffi',
-                         '--disable-libgomp',
-                         '--disable-libitm',
-                         '--disable-libmpx',
-                         '--disable-libquadmath',
-                         '--disable-libsanitizer',
-                         '--without-headers', '--with-newlib',
+            cfg_opts += ['--enable-first-stage-cross',
                           '--with-glibc-version=%s' % self.ctx.glibc_version
                           ]
              cfg_opts += self.first_gcc_cfg

Bootstrapped/regtested on x86_64-pc-linux-gnu, and
tested with build-many-glibcs.py with the above patch.

OK for mainline?


ChangeLog:

        * configure.ac: Add --enable-first-stage-cross.
        * configure: Regenerate.

gcc/ChangeLog:

        * doc/install.texi: Document --enable-first-stage-cross.
I'm not really sure we need a patch for this.  Isn't it sufficient to "make all-gcc && make all-target-libgcc"?  Folks have been doing that for decades.

Jeff

Reply via email to