3.3 Hosted cross bootstrap: where glibc fits between GCC's make targets

Source references in this chapter are to GCC 15.2.0 (releases/gcc-15.2.0).

You want an aarch64-linux-gnu toolchain, and nobody can hand you a sysroot. Every guide gives you the same shell transcript: binutils, kernel headers, a GCC, half of glibc, more GCC, all of glibc, then GCC again. When a step fails, the transcript cannot tell you which earlier step it depended on. When its author wrote it for an older glibc, a step can quietly do nothing at all.

GCC's build cannot wait for glibc, because glibc is not one of its modules. You are the dependency edge, and the recipe is a list of the places where you stand. Most steps exist because a named file in GCC's build reads something from the sysroot at that moment. This chapter names the file for each one.

This chapter assumes Chapter 3.1, for the cycle and for where make all-gcc stops, and Chapter 3.2, for the inhibit_libc condition. It also uses the -print-file-name rule from Chapter 1.5, the start files from Chapter 1.7 and the assembled <limits.h> from Chapter 1.8.

The C library has no edge in the Makefile: maybe-all-target-newlib

The top-level Makefile orders the target libraries by declared dependencies. A comment in Makefile.def states the default: "By default target modules depend on libgcc and newlib/libgloss" (Makefile.def:647-649). In the generated Makefile.in, that dependency is a rule such as configure-target-libstdc++-v3: maybe-all-target-newlib maybe-all-target-libgloss (Makefile.in:69398). The rule names newlib and libgloss, the C-library modules that GCC's tree can build itself. Here is the target it waits on:

.PHONY: all-target-newlib maybe-all-target-newlib
maybe-all-target-newlib:
@if gcc-bootstrap
all-target-newlib: stage_current
@endif gcc-bootstrap
@if target-newlib
TARGET-target-newlib=all
maybe-all-target-newlib: all-target-newlib
all-target-newlib: configure-target-newlib

Listing 3.3-1: the C-library target (Makefile.in:49502-49510).

configure keeps the lines inside @if target-newlib only when newlib is a configured target module, and a final sed expression removes every @if block that remains (configure.ac:3400-3413). In a hosted build there is no newlib in the tree, so maybe-all-target-newlib keeps no prerequisites. The edge from "the C library" to every library that links against it is empty, and make would run from libgcc straight into those libraries. Chapter 3.6 shows the case where the edge is real.

So the recipe drives GCC's build with named targets, all-gcc (Makefile.in:12440) and all-target-libgcc (:50400), and puts glibc in the gaps between them.

The recipe: seven steps for aarch64-linux-gnu and glibc 2.42

Nobody ran this recipe end to end at GCC 15.2.0. Each reason for a step comes from the 15.2.0 sources. The glibc commands come from glibc 2.42's own files. The sequence as a whole is the conventional one, and it is not tested.

The glibc commands are glibc's interface, not GCC's. The chapter shows them because the GCC steps around them depend on what they produce. For each one, it says why GCC needs it. glibc's own INSTALL file is the authority for everything else about them.

The commands use these variables, with the four source trees side by side and one build directory for each build:

TARGET=aarch64-linux-gnu
PREFIX=/opt/cross
SYSROOT=$PREFIX/$TARGET/sysroot
PATH=$PREFIX/bin:$PATH

Step 1: binutils, with the same --prefix and --with-sysroot

../binutils/configure --target=$TARGET --prefix=$PREFIX --with-sysroot=$SYSROOT
make && make install

This step needs nothing from the target. It gives GCC an assembler and a linker. The install manual documents this step under Building a cross compiler: GCC expects the cross tools in prefix/target/bin, and binutils configured with the same --target and --prefix installs them there (install.texi:3281-3311). binutils has its own --with-sysroot, which is a different mechanism with the same name. It is outside this book.

Step 2: kernel headers, so that $SYSROOT/usr/include exists

make -C linux ARCH=arm64 INSTALL_HDR_PATH=$SYSROOT/usr headers_install

glibc documents this command for its own reasons. glibc reads the kernel interface from these headers (glibc INSTALL:620-635). GCC needs them for a smaller reason. Its stage-1 build runs fixincludes, and fixincludes stops when the system header directory is missing:

	    if ! $(inhibit_libc) && test ! -d ${BUILD_SYSTEM_HEADER_DIR}; then \
	      echo "The directory (BUILD_SYSTEM_HEADER_DIR) that should contain system headers does not exist:" >&2 ; \
	      echo "  ${BUILD_SYSTEM_HEADER_DIR}" >&2 ; \
	      case ${build_os} in \
	        darwin*) \
	          echo "(on Darwin this usually means you need to pass the --with-sysroot= flag to point to a valid MacOS SDK)" >&2; \
	          ;; \
	      esac; \
	      tooldir_sysinc=`echo "${gcc_tooldir}/sys-include" | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta`; \
	      if test "x${BUILD_SYSTEM_HEADER_DIR}" = "x$${tooldir_sysinc}"; \
	      then sleep 1; else exit 1; fi; \
	    fi; \

Listing 3.3-2: the check in the stmp-fixinc rule (gcc/Makefile.in:3616-3627).

In this recipe inhibit_libc is false, because --with-sysroot makes the first half of its condition false (Chapter 3.2). With a sysroot, BUILD_SYSTEM_HEADER_DIR is the sysroot's /usr/include (gcc/configure.ac:174 and :2544). If step 2 has not run, make all-gcc stops in stmp-fixinc with the message above. The sleep 1 branch is for the other layout, a cross compiler with no sysroot, whose headers go in tooldir/sys-include.

The test asks only that the directory exists. The kernel headers make it exist, and GCC needs nothing from glibc yet.

Step 3: stage-1 GCC, with make all-gcc and --with-glibc-version

mkdir build-gcc1 && cd build-gcc1
../gcc-15.2.0/configure --target=$TARGET --prefix=$PREFIX \
    --with-sysroot=$SYSROOT --enable-languages=c \
    --with-glibc-version=2.42
make all-gcc && make install-gcc

This step needs binutils and the header directory. It gives an installed $TARGET-gcc that compiles but cannot link a program yet. glibc's configure accepts a compiler like that on purpose. It replaces Autoconf's executable test, with the comment "These modifications are to allow for an empty cross compiler tree" (glibc aclocal.m4:96-98).

The target is all-gcc because inhibit_libc is false. If make built libgcc now, libgcc would compile the parts that include libc headers, and those headers do not exist yet. make all-gcc never gets that far, because libgcc's configure step comes after all-gcc and not the other way around (Makefile.in:67908). Chapter 3.1 shows the difference between the two targets.

Many transcripts also pass --without-headers at this step. With a sysroot it cannot make inhibit_libc true (Chapter 3.2). The only other reader of with_headers in gcc/configure.ac is a test for s390 (gcc/configure.ac:7892). For this target the flag does nothing. The recipe also needs no --disable-multilib, because aarch64 GNU/Linux builds one variant, lp64, unless --with-multilib-list asks for more (gcc/config.gcc:1249-1253).

What stage 1 reads from a sysroot with no C library: target_header_dir

This is the part that the transcripts leave out. Stage 1 reads the sysroot's /usr/include twice. configure reads it as target_header_dir, which --with-sysroot sets to that directory (gcc/configure.ac:2563). make reads it as BUILD_SYSTEM_HEADER_DIR, as in Listing 3.3-2. At step 3 the directory holds only the kernel headers. Three probes find less than they will find after step 6:

  • stdio.h, for inhibit_libc. With a sysroot, this probe does not change the result (Chapter 3.2).
  • features.h, for the glibc version (Listing 3.3-3).
  • limits.h, for LIMITS_H_TEST, when make assembles GCC's own <limits.h> (Chapter 1.8, Listing 1.8-9).

Here is the glibc version probe. It runs when --with-glibc-version is absent:

glibc_version_major=0
glibc_version_minor=0
[if test -f $target_header_dir/features.h \
  && glibc_version_major_define=`$EGREP '^[ 	]*#[ 	]*define[ 	]+__GLIBC__[ 	]+[0-9]' $target_header_dir/features.h` \
  && glibc_version_minor_define=`$EGREP '^[ 	]*#[ 	]*define[ 	]+__GLIBC_MINOR__[ 	]+[0-9]' $target_header_dir/features.h`; then
  glibc_version_major=`echo "$glibc_version_major_define" | sed -e 's/.*__GLIBC__[ 	]*//'`
  glibc_version_minor=`echo "$glibc_version_minor_define" | sed -e 's/.*__GLIBC_MINOR__[ 	]*//'`
fi]])

Listing 3.3-3: reading the glibc version from features.h (gcc/configure.ac:6030-6037).

With no features.h, the version stays 0.0. It goes into auto-host.h as TARGET_GLIBC_MAJOR and TARGET_GLIBC_MINOR (gcc/configure.ac:6039-6042). Every later GCC_GLIBC_VERSION_GTE_IFELSE test compares against it (gcc/acinclude.m4:548-556). Among other things, those tests decide:

  • whether the target C library provides the stack protector (gcc/configure.ac:6958-6961),
  • whether to use @gnu_unique_object (:6056),
  • on PowerPC, SPARC, s390 and Alpha, whether long double is 128 bits wide (:7051).

The last one changes the ABI that stage 1 compiles glibc with. Chapter 2.6 owns that case.

The install manual documents --with-glibc-version on its Configuration page, and it names this situation (install.texi:2620-2625). The option "may be needed when bootstrapping a cross toolchain without the header files available for building the initial bootstrap compiler". Give it the version of the glibc that you are about to build.

Step 4: glibc headers, crti.o, crtn.o and a placeholder libc.so

mkdir build-glibc && cd build-glibc
../glibc-2.42/configure --prefix=/usr --host=$TARGET \
    --build=$(../glibc-2.42/scripts/config.guess) \
    --with-headers=$SYSROOT/usr/include CC=$TARGET-gcc
make install-headers DESTDIR=$SYSROOT
make csu/subdir_lib
mkdir -p $SYSROOT/usr/lib64
cp csu/crt1.o csu/crti.o csu/crtn.o $SYSROOT/usr/lib64
$TARGET-gcc -nostdlib -nostartfiles -shared -x c /dev/null \
    -o $SYSROOT/usr/lib64/libc.so
touch $SYSROOT/usr/include/gnu/stubs.h

This step needs the stage-1 compiler and the kernel headers. The lines after configure put four things in the sysroot that step 5 reads. Step 5 builds libgcc in full, including the shared library, and GCC's sources decide what that build needs.

The first is the libc headers, because inhibit_libc is false. Chapter 3.2 lists what libgcc compiles in that case.

The second is crti.o and crtn.o. The driver links libgcc_s.so.1 with -shared, and it keeps the start files. On GNU/Linux the start-file specs put crti.o and crtn.o in every such link (gcc/config/gnu-user.h:43-44). For a shared link the same spec adds no crt1.o, because its first clause is %{shared:; ...} (gnu-user.h:51-58). The recipe copies crt1.o now only because the same glibc target builds it (glibc csu/Makefile:174-175).

The third is a libc.so, because the link line for libgcc_s.so.1 ends in -lc:

SHLIB_LC = -lc
...
SHLIB_LINK = $(CC) $(LIBGCC2_CFLAGS) -shared -nodefaultlibs \
	$(SHLIB_LDFLAGS) $(LDFLAGS) \
	-o $(SHLIB_DIR)/$(SHLIB_SONAME).tmp @multilib_flags@ \
	$(SHLIB_OBJS) $(SHLIB_LC) && \

Listing 3.3-4: how libgcc links its shared library, abridged (libgcc/config/t-slibgcc:29-37).

-nodefaultlibs removes the default libraries, and SHLIB_LC then adds -lc back by name. Every GNU/Linux target uses this fragment (libgcc/config.host:313-314). The real libc.so does not exist until step 6, so the recipe links an empty shared object under that name. It satisfies the link and nothing more.

The fourth is gnu/stubs.h. glibc's features.h includes it (glibc include/features.h:548), and glibc generates it only at the end of a full make install (glibc Makefile:452-458). An empty file is enough until then.

The files go into usr/lib64 because step 6 installs the real ones there. glibc's aarch64 port installs its libraries into lib64 (glibc sysdeps/unix/sysv/linux/aarch64/configure.ac:6). GCC's aarch64 GNU/Linux port names ../lib64 as the OS directory for lp64 (gcc/config/aarch64/t-aarch64-linux:25), and the driver adds it to /usr/lib (Chapter 1.6). Step 6 then overwrites the placeholders. To check that the driver finds them, run $TARGET-gcc -print-file-name=crti.o. If it echoes the name back, the driver did not find the file (Chapter 1.5).

DESTDIR works for install-headers too. glibc documents it for make install (glibc INSTALL:429-435). Its makefiles copy it into install_root, and every installation directory starts with install_root (glibc config.make.in:8 and Makeconfig:180).

Older transcripts also pass install-bootstrap-headers=yes here. No file in the glibc 2.42 release contains that name. make accepts the assignment, and nothing reads it.

Step 5: make all-target-libgcc, not make

cd build-gcc1
make all-target-libgcc && make install-target-libgcc

This step needs everything that step 4 put in the sysroot. It gives libgcc.a, libgcc_s.so.1 and the crtbegin and crtend objects (libgcc/config.host:315). glibc's build in step 6 needs only libgcc.a. It links its own libraries and programs with -lgcc alone (glibc Makeconfig:719 and :732). The comment above those lines gives the reason: "To avoid circular dependencies when bootstrapping, it is desirable to avoid use of libgcc_s and libgcc_eh in building glibc" (glibc Makeconfig:682-683).

A plain make would not stop after libgcc. Because the C-library edge of Listing 3.3-1 is empty, make would go on to configure the other target libraries. libgomp is one of them, because the top-level configure turns it on by default for *-linux* targets (configure.ac:529-546). libgomp's configure must link programs. Autoconf's compiler check links one (libgomp/configure.ac:114), and a later check links a call to pthread_create (:198-214). With a placeholder libc.so, the first link fails, and configure stops with "C compiler cannot create executables". Chapter 3.5 explains what that message points at.

Step 6: the full glibc

cd build-glibc
make && make install DESTDIR=$SYSROOT

This step needs libgcc.a from step 5. It gives the complete C library: the real libc.so, the shared libraries, the start files and a generated gnu/stubs.h. They replace every placeholder from step 4. Nothing new happens on GCC's side. The sysroot is now complete, and GCC's configure last read it at step 3.

Step 7: a fresh build directory, with --enable-languages=c,c++

mkdir build-gcc2 && cd build-gcc2
../gcc-15.2.0/configure --target=$TARGET --prefix=$PREFIX \
    --with-sysroot=$SYSROOT --enable-languages=c,c++
make && make install

This step needs the complete sysroot. It gives the compiler that you ship. It is a new build directory, and not another make in build-gcc1, because the stage-1 tree recorded what the sysroot held at step 3. Four things in it are wrong for the finished toolchain.

The first is the glibc version. A new configure reads features.h again (Listing 3.3-3) and finds the real version. You no longer need --with-glibc-version.

The second is <limits.h>. At step 3 the sysroot had no limits.h, so LIMITS_H_TEST failed and the build assembled GCC's <limits.h> without the #include_next that reaches glibc's (Chapter 1.8). The stamp that builds it depends only on GCC's own files (gcc/Makefile.in:3475), so no later make in build-gcc1 rebuilds it. A program that includes <limits.h> through that compiler gets none of what glibc's limits.h adds, such as the POSIX limits (glibc include/limits.h:193-196). fixincludes also ran on the kernel headers only.

The third is libgcc_s.so.1. Step 5 linked it against the placeholder libc.so. The new build links it against the real one.

The fourth is libstdc++. On a cross build, libstdc++'s configure decides its features by linking test programs against the target C library. For GNU/Linux targets it runs these checks, among others:

    GCC_CHECK_TLS
    AC_CHECK_FUNCS(__cxa_thread_atexit_impl)
    AC_CHECK_FUNCS(aligned_alloc posix_memalign memalign _aligned_malloc)
    AC_CHECK_FUNCS(timespec_get)
    AC_CHECK_FUNCS(sockatmark)
    AC_CHECK_FUNCS(uselocale)

Listing 3.3-5: libstdc++'s link tests for *-linux* (libstdc++-v3/crossconfig.m4:184-189, in the branch that starts at :177).

Each AC_CHECK_FUNCS defines a HAVE_ macro only when the test program links (Autoconf manual, Generic Function Checks). When the test does not find a function, its macro stays undefined, and libstdc++ builds without the code that needs it. For example, the check for __cxa_thread_atexit_impl decides whether thread_local destructors call glibc's function or libstdc++'s own fallback (libstdc++-v3/libsupc++/atexit_thread.cc:60-72). If no program links at all, configure stops instead, with "Link tests are not allowed after GCC_NO_EXECUTABLES" (config/no-executables.m4:44-47). libstdc++ applies that macro to every cross build except a Darwin one (libstdc++-v3/configure.ac:36-56). A C library that links but lacks functions gives you a smaller libstdc++, not an error. Configure libstdc++ only after the complete glibc is in the sysroot.

Five steps instead of seven: build-many-glibcs.py

glibc's source tree contains a script that builds cross compilers and then glibc for many configurations, scripts/build-many-glibcs.py (glibc build-many-glibcs.py:21-29). Its order is binutils, kernel headers, a first GCC, glibc, and a final GCC (glibc build-many-glibcs.py:1410-1429). There is no minimal-libc pass. Its first GCC explains why:

            tool_build = 'gcc-first'
            # Building a static-only, C-only compiler that is
            # sufficient to build glibc.  Various libraries and
            # features that may require libc headers must be disabled.
            # When configuring with a sysroot, --with-newlib is
            # 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-gcov',
                         '--disable-libffi',
                         '--disable-libgomp',
                         '--disable-libitm',
                         '--disable-libmpx',
                         '--disable-libquadmath',
                         '--disable-libsanitizer',
                         '--without-headers', '--with-newlib',
                         '--with-glibc-version=%s' % self.ctx.glibc_version
                         ]

Listing 3.3-6: the first GCC in glibc's own script (glibc scripts/build-many-glibcs.py:1518-1539).

Two flags remove the reasons for steps 4 and 5. --with-newlib, together with --without-headers, makes inhibit_libc true even with a sysroot, as the comment says. libgcc then compiles without libc headers. Chapter 3.2 has the condition. --disable-shared removes libgcc_s.so.1, and with it the -lc link of Listing 3.3-4. The --disable-lib* flags remove the libraries that would need a C library, so the script builds this GCC with a plain make (glibc build-many-glibcs.py:1450). glibc then builds in full against libgcc.a alone, which is all it asks for. The final GCC is a new configure with --enable-languages=c,c++ and --enable-shared (:1541-1552).

The script passes --with-glibc-version to the first GCC for the reason that step 3 gives. It does not pass --with-newlib to the final GCC, and you must not either: with --with-newlib, libstdc++'s cross configure takes its newlib branch (libstdc++-v3/configure.ac:340-341).

The seven-step recipe shows what each part of libgcc needs from the C library. glibc keeps the five-step one in its own tree, and it uses fewer glibc-internal targets. Nobody ran either one for this book at GCC 15.2.0.

--with-build-sysroot: when the sysroot is not where it will live

The recipe builds into $SYSROOT, which is also the path given to --with-sysroot. If you build in a staging directory and move the result later, the build must read one path and the installed compiler must search another. --with-build-sysroot gives the first one. The install manual documents it under Cross-Compiler-Specific Options as the system root "while building target libraries" (install.texi:2733-2745).

It does more than the manual says. In gcc/configure.ac it also replaces the sysroot in the two header paths that stage 1 probes:

  if test "x$with_build_sysroot" != x; then
    BUILD_SYSTEM_HEADER_DIR=$with_build_sysroot'$${sysroot_headers_suffix}$(NATIVE_SYSTEM_HEADER_DIR)'
...
  if test "x$with_build_sysroot" != "x"; then
    target_header_dir="${with_build_sysroot}${native_system_header_dir}"

Listing 3.3-7: --with-build-sysroot moves the header probes, abridged (gcc/configure.ac:2541-2542 and :2556-2557).

So fixincludes, LIMITS_H_TEST, and the stdio.h and features.h probes all look in the build sysroot. The target libraries get --sysroot=DIR on their compiler command line. The top-level configure stores it as SYSROOT_CFLAGS_FOR_TARGET (configure.ac:2868-2875), and the Makefile adds it to the CC that configures every target library (Makefile.tpl:637 and :308). Every testsuite compile gets it too, as TEST_ALWAYS_FLAGS (gcc/Makefile.in:4520-4522). Chapter 3.7 covers the testsuite. The installed driver keeps the --with-sysroot path, which configure takes from --with-sysroot alone (gcc/configure.ac:168-171).

Checking the result: -print-file-name, -dumpspecs and -H

The first check works on any finished toolchain:

$ aarch64-linux-gnu-gcc -print-sysroot
$ aarch64-linux-gnu-gcc -print-file-name=crt1.o
$ aarch64-linux-gnu-gcc -print-file-name=crtbegin.o
$ echo 'int main(void){return 0;}' | aarch64-linux-gnu-gcc -x c - -o /tmp/t && echo OK

-print-sysroot must print $SYSROOT. The two -print-file-name lines must print a path, not the name you typed (Chapter 1.5). An echoed crt1.o points at glibc and the sysroot. An echoed crtbegin.o points at GCC's own installation. The link puts the start files, libgcc and the C library on one command line.

The next three checks find a final compiler that configure set up against an incomplete sysroot. The link test does not find that:

$ aarch64-linux-gnu-gcc -dumpspecs | grep -A1 '^\*link_ssp:'
$ echo '#include <limits.h>' | aarch64-linux-gnu-gcc -H -E -x c - 2>&1 >/dev/null
$ grep -E 'TARGET_GLIBC_(MAJOR|MINOR)' build-gcc2/gcc/auto-host.h

-dumpspecs prints every spec (gcc/gcc.cc:4216-4225), and link_ssp is one of them (:1724). Its value comes from LINK_SSP_SPEC (gcc/gcc.cc:994-1002). It is an empty %{...:} when configure found stack protector support in the C library, and it adds -lssp_nonshared -lssp when it did not. A final compiler that found glibc 2.42 must show the first form. The -H line shows the include tree that Chapter 1.8 describes: GCC's limits.h, then syslimits.h, then the sysroot's limits.h. A limits.h from step 3 stops at the first. The auto-host.h line works only in a build tree. It must show the version that you installed, not 0.

Three things to carry away

glibc is not a module of GCC's build, so make cannot wait for it. The recipe stops GCC's build at all-gcc and at all-target-libgcc, and puts glibc in the gaps.

Steps 4 and 5 exist only for a shared libgcc that includes libc headers. --with-newlib, --without-headers and --disable-shared remove both reasons, and glibc's own script needs only five steps.

The first GCC reads a sysroot that has no C library in it. Its glibc version, its <limits.h> and its fixed headers stay wrong until a new build directory reads the finished sysroot.

Things that surprise people

The kernel headers are a GCC prerequisite, not only glibc's. Without $SYSROOT/usr/include, stage 1 stops in fixincludes, before any glibc command runs.

install-bootstrap-headers=yes does nothing with glibc 2.42. No file in the release reads it.

Another make in the stage-1 tree leaves <limits.h> as it was. The stamp does not depend on the sysroot, so make sees nothing to rebuild.

Documentation coverage

The install manual documents the configure flags one at a time. The cross-specific ones are under Cross-Compiler-Specific Options (gcc/doc/install.texi:2701): --with-sysroot at :2709, --with-build-sysroot at :2733, --without-headers at :2763 and --with-newlib at :2776. --with-glibc-version is on the Configuration page (:2620). Its entry is the only place where the manual mentions bootstrapping a cross toolchain (:2624-2625). Building a cross compiler (:3247) assumes that the C library exists: "you should also provide the target libraries and headers before configuring GCC" (:3313-3315). -print-file-name, -print-sysroot and -dumpspecs are in Developer Options (gcc/doc/invoke.texi:21571, :21635 and :21668).

What is not documented:

  • The order of the steps. No GCC manual describes building GCC around a C library that does not exist yet.
  • That stage-1 fixincludes stops when inhibit_libc is false and the sysroot has no /usr/include.
  • That the shared libgcc link needs crti.o, crtn.o and a libc.so.
  • That configure reads features.h and stdio.h from the sysroot, and make reads limits.h, and that the build tree keeps what they found.
  • That make cannot order a C library that is outside GCC's tree.
  • That --with-build-sysroot also moves the header probes and fixincludes for GCC itself. The manual describes it for target libraries only.
  • That libstdc++'s cross configure drops a feature, without an error, when the C library links but lacks the function.

Next: the bare-metal recipe, where there is no kernel and no sysroot, and two GCC phases replace three.


All source references in this chapter are to GCC 15.2.0 (releases/gcc-15.2.0). Line numbers in other releases will differ; the surrounding code rarely does. Where behaviour itself changed across a major version, it is flagged inline.