Skip to content

Select the default libc, guard unsupported combos, and tidy up - #1885

Open
cmuellner wants to merge 4 commits into
riscv-collab:masterfrom
cmuellner:picolibc-prep
Open

Select the default libc, guard unsupported combos, and tidy up#1885
cmuellner wants to merge 4 commits into
riscv-collab:masterfrom
cmuellner:picolibc-prep

Conversation

@cmuellner

Copy link
Copy Markdown
Collaborator

Preparatory cleanup for picolibc.
It makes every bundled libc a first-class default make target,
rejects feature/libc combinations that cannot work, and tidies
the Makefile and README. No functional change for the existing
default (newlib) or Linux builds.

Commits

  1. Allow selecting the default libc with --enable-{newlib,musl,uclibc}
    The default make target could previously only be switched to Linux/glibc
    (--enable-linux); newlib was the hard-coded fallback and musl/uClibc could
    only be built through their explicit make musl / make uclibc targets.
    Add --enable-newlib, --enable-musl and --enable-uclibc so any bundled
    libc can be the default and built with a plain make. Also teach the
    build-libc staged target to build musl/uClibc instead of falling through
    to newlib.

  2. README: streamline the installation instructions
    Fold the near-identical per-libc install sections into a single table (and
    document uClibc, which had no section). Correct the intro, state that Newlib
    is the default target, trim the multilib section, and document that multilib
    and the check/report targets are only available for the Newlib and
    Linux/glibc toolchains.

  3. Makefile: order the per-libc variables consistently
    *_TUPLE and *_TARGET_FLAGS used a different order than *_SRC_GIT and
    the build targets. Put them all in the same order.

  4. configure: reject unsupported multilib and LLVM default targets
    The musl and uClibc toolchains build GCC with --disable-multilib and wire
    no per-variant runtime, so --enable-multilib was silently ignored — the
    user asked for a multilib toolchain and quietly got a single-variant one.
    Likewise --enable-llvm has no build rule for the uClibc toolchain, so it
    configured cleanly and then failed at make time. Reject both up front.

Testing

Configure-level smoke tests only (no behavioural change to builds):

  • ./configure --enable-{newlib,linux,musl,uclibc} each selects the matching
    default target (all: <libc>); no flag defaults to newlib.
  • --enable-{musl,uclibc} --enable-multilib and --enable-uclibc --enable-llvm
    now error; --enable-multilib (newlib default), --enable-linux --enable-multilib, and --enable-musl --enable-llvm still pass.
  • make build-libc builds the selected libc for musl/uClibc.

The default make target could only be switched to the Linux/glibc
toolchain, via --enable-linux.  newlib was the hard-coded fallback, and
musl or uclibc could only be built through their explicit "make musl" /
"make uclibc" targets.

Add --enable-newlib, --enable-musl and --enable-uclibc so any bundled C
library can be made the default target and built with a plain "make",
just like --enable-linux already allows.  Teach the "build-libc" staged
target to build the selected libc for musl and uclibc as well, instead
of falling through to newlib.

Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
The per-libc installation sections were near-identical boilerplate that
differed only in the configure flag and the make target.  Fold newlib
and the Linux glibc/musl/uClibc toolchains into a single section with a
small table, so the shared steps are described once and uClibc, which
had no section at all, is covered too.

While here, tidy the surrounding docs: correct the intro (it described
only newlib and glibc), state explicitly that Newlib is the default make
target, trim the multilib section, and document the toolchains'
limitations -- multilib and the check/report test targets are only
available for the Newlib and Linux/glibc toolchains.

Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
The per-libc variable groups had settled into different orders: *_TUPLE
led with linux and *_TARGET_FLAGS with glibc, while *_SRC_GIT and the
build targets used newlib, linux, musl, uclibc.  Reorder *_TUPLE and
*_TARGET_FLAGS to the latter so every group follows the same order and
the file is easier to scan.

Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
The musl and uClibc toolchains build GCC with --disable-multilib and
wire no per-variant runtime, so --enable-multilib was silently ignored:
the user asked for a multilib toolchain and quietly got a single-variant
one.  Likewise --enable-llvm has no build rule for the uClibc toolchain,
so it configured cleanly and then failed at make time.

Reject both combinations up front when the default target does not
support the requested feature.

Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
@cmuellner
cmuellner requested a review from kito-cheng July 29, 2026 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant