]> Projects (at) Tadryanom (dot) Me - AdrOS.git/commit
feat(toolchain): dual-libc support — ulibc default, Newlib optional
authorTulio A M Mendes <[email protected]>
Fri, 3 Apr 2026 19:53:38 +0000 (16:53 -0300)
committerTulio A M Mendes <[email protected]>
Fri, 3 Apr 2026 19:53:38 +0000 (16:53 -0300)
commit66918102f88ebc892dc6f6340436138e228025e4
tree58d60d7f22f56e4a24a24795b240044e1f603d94
parentd434ac978ca3605e7cca310e555aef92e46e020c
feat(toolchain): dual-libc support — ulibc default, Newlib optional

Redesign the toolchain build to safely support both ulibc (dynamic
linking) and Newlib (static linking) with a safe-by-default approach:

Architecture:
- adros.h now has Newlib-safe defaults (LIB_SPEC with -ladros, no
  dynamic-linker in LINK_SPEC) so a fresh 'git clone' + 'build.sh'
  always produces a working toolchain even without prior 'make iso'.
- Step 4b: generates specs from dumpspecs (Newlib-compatible).
- Step 4c: if ulibc build artifacts exist, re-patches specs for ulibc
  (removes -ladros, adds -dynamic-linker /lib/ld.so).
- Step 4d: creates newlib.specs + i686-adros-gcc-newlib wrapper for
  optional Newlib builds.

Bug fixes for fresh-clone reproducibility:
- Newlib build skip check changed from libc.a (overwritten by ulibc)
  to a .built marker file.
- Newlib headers/libs backed up unconditionally (before ulibc check)
  so newlib.specs always has valid include/newlib/ directory.
- Bash cross-compilation now uses newlib.specs explicitly (Bash needs
  Newlib's full POSIX libc: regex, locale, wchar).
- Wrapper script uses expanded paths instead of hardcoded GCC version.

Usage:
  i686-adros-gcc -o out in.c          # ulibc dynamic (default)
  i686-adros-gcc -static -o out in.c  # ulibc static
  i686-adros-gcc-newlib -o out in.c   # Newlib static
.gitignore
toolchain/build.sh