Skip to content

all-patches/gcc: scope libsanitizer-musl-compat patch to gcc 11+#2161

Merged
widgetii merged 1 commit into
masterfrom
fix/gcc-8.4-libsanitizer-musl-compat-patch
May 29, 2026
Merged

all-patches/gcc: scope libsanitizer-musl-compat patch to gcc 11+#2161
widgetii merged 1 commit into
masterfrom
fix/gcc-8.4-libsanitizer-musl-compat-patch

Conversation

@widgetii
Copy link
Copy Markdown
Member

Summary

Move `general/package/all-patches/gcc/0001-libsanitizer-musl-compat.patch` into version-specific subdirs for gcc 11.4.0, 12.4.0, and 13.3.0 so it is no longer applied to gcc 8.4.0.

Root cause

The patch targets `libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp`, but in gcc 8.x that file is still named `sanitizer_platform_limits_posix.cc` (the `.cc` → `.cpp` rename happened upstream in gcc 11). Buildroot's `BR2_GLOBAL_PATCH_DIR` mechanism applies patches from BOTH `gcc//` AND the unversioned `gcc/` dir additively — so the patch in the unversioned dir was being applied to all gcc versions including 8.4.0, where it could not find its target file:

```

host-gcc-initial 8.4.0 Patching

Applying 0001-libsanitizer-musl-compat.patch using patch:
can't find file to patch at input line 14

| --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
| +++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp

No file to patch. Skipping patch.
8 out of 8 hunks ignored
make[1]: *** [package/pkg-generic.mk:237: …/host-gcc-initial-8.4.0/.stamp_patched] Error 1
```

Impact (latent until full-rebuild was forced)

Every platform that selects `BR2_GCC_VERSION_LEGACY=y` (gcc 8.4.0) has been silently broken since the patch landed:

  • Goke: gk7102, gk7102s, gk7202v300, gk7205v200_*, gk7205v210, gk7605v100
  • Grainmedia: gm8135, gm8136
  • Xiongmai: xm510 (and likely xm51x family)

The toolchain workflow's `wget --spider` skip-check kept reusing the pre-patch (Feb 2025) tarballs in the `toolchain` release, so the bug stayed latent. The recent full asset-wipe (intentional, to re-roll all toolchains after the libevent update) exposed it on the next dispatch — visible in run #26643453022 as failures on gk7102_lite, gk7205v200_lite, xm510_lite (and counting — more gcc 8.4 platforms still in flight at time of filing).

Fix

Move the patch from `gcc/` into version-specific subdirs `gcc/11.4.0/`, `gcc/12.4.0/`, `gcc/13.3.0/`. gcc 8.4.0 does not need it — those platforms have built libsanitizer on musl for years without this patch in place.

Test plan

  • Dispatch the toolchain workflow on this branch with the existing toolchain release assets wiped (or just for the affected platforms). Verify gk7102_lite, gk7205v200_lite, xm510_lite, gm8136_lite build host-gcc-initial-8.4.0 cleanly through `>>> host-gcc-initial 8.4.0 Patching`.
  • Verify gcc 11/12/13 platforms still apply the patch (e.g. hi3516cv500_lite uses gcc 13.x — should still see `Applying 0001-libsanitizer-musl-compat.patch` succeed).

The patch targets libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
but in gcc 8.x that file is sanitizer_platform_limits_posix.cc (the .cc -> .cpp
rename happened in gcc 11). Buildroot applies patches from
$(BR2_GLOBAL_PATCH_DIR)/gcc/<version>/ AND $(BR2_GLOBAL_PATCH_DIR)/gcc/
additively, so the patch in the unversioned gcc/ dir was applied to all
gcc versions including 8.4.0, causing host-gcc-{initial,final}-8.4.0 to
fail patching for every platform that selects BR2_GCC_VERSION_LEGACY
(gk7102/gk7102s/gk7202v300/gk7205v*/gk7605v100, gm8135/gm8136, xm510, ...).

The failure stayed latent because the toolchain workflow's wget --spider
skip-check kept reusing the pre-patch (Feb 2025) tarballs; a full
release-asset wipe exposed it on the next dispatch.

Move the patch from the unversioned dir into the three modern-gcc
subdirs (11.4.0/, 12.4.0/, 13.3.0/). gcc 8.4.0 doesn't need it — those
platforms have built libsanitizer on musl fine without it for years.
@widgetii widgetii merged commit 5d23859 into master May 29, 2026
2 of 102 checks passed
@widgetii widgetii deleted the fix/gcc-8.4-libsanitizer-musl-compat-patch branch May 29, 2026 15:39
widgetii added a commit that referenced this pull request May 30, 2026
Remove the explicit "# Legacy" three-line block (BR2_TOOLCHAIN_EXTERNAL_GCC_8=y +
BR2_GCC_VERSION_LEGACY=y) from all defconfigs that still carried it:

  Goke (11): gk7102, gk7102s, gk7202v300_{lite,ultimate},
             gk7205v200_{lite,original,ultimate}, gk7205v210_lite,
             gk7205v300_{lite,ultimate}, gk7605v100_lite
  Grainmedia (2): gm8135_lite, gm8136_lite
  Novatek (2): nt98562_lite, nt98566_lite
  Xiongmai (3): xm510_lite, xm530_lite, xm550_lite

Without an explicit pin these defconfigs fall through to
BR2_GCC_VERSION_13_X (Buildroot 2024.02.10 default per
general/package/gcc/Config.in.host), so the cross-toolchains rebuild
with gcc 13.3.0 instead of 8.4.0.

All 18 platforms are ARM (arm1176jzf_s through later Cortex-A cores)
and supported by gcc 13's musl/libsanitizer code paths — the recently
scoped libsanitizer-musl-compat patch (#2161) now applies as expected.
The legacy pin originated in #1726 ("Set legacy GCC version for Goke",
2023) but the rationale has dissolved as upstream gcc/musl/libsanitizer
caught up.
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