]> Projects (at) Tadryanom (dot) Me - AdrOS.git/commit
fix: rewrite toolchain patching to use sed instead of fragile unified diffs
authorTulio A M Mendes <[email protected]>
Sat, 14 Mar 2026 02:00:57 +0000 (23:00 -0300)
committerTulio A M Mendes <[email protected]>
Sat, 14 Mar 2026 02:00:57 +0000 (23:00 -0300)
commitc2b6f42c238c3542476d90482cac09546cb00a7d
treefdcf0bdb02f8374aaa57ac5948f0d7d01f0e4935
parent9b3281522b5fc89cf6ad98551ca47143d236acbe
fix: rewrite toolchain patching to use sed instead of fragile unified diffs

The original patch files (binutils-adros.patch, gcc-adros.patch,
newlib-adros.patch) used hardcoded line numbers that didn't match the
actual source tarballs (binutils 2.42, gcc 13.2.0, newlib 4.4.0),
causing config.sub and ld/configure.tgt hunks to fail.

Replaced the entire patching approach with pattern-based sed commands
that match unique context strings instead of line numbers. This is
robust against upstream line shifts across versions.

Changes to toolchain/build.sh:
- patch_config_sub(): inserts adros case before pikeos*) and adds
  adros* to the OS validation list next to dicos*
- patch_binutils(): sed-patches bfd/config.bfd, gas/configure.tgt,
  ld/configure.tgt using pattern anchors
- patch_gcc(): sed-patches gcc/config.gcc, libgcc/config.host;
  creates adros.h, crti-adros.S, crtn-adros.S inline
- patch_newlib(): sed-patches newlib/configure.host, sys/config.h,
  libgloss/configure.ac; creates sys/adros/ and libgloss/adros/
  files inline

All idempotent (marker files + grep guards).

Verified:
- config.sub returns 'i686-pc-adros' for all 3 packages
- binutils configure --target=i686-adros succeeds
- 100/100 smoke tests pass (13 sec)
.gitignore
toolchain/build.sh