Files
glibc/gen-gconv-modules.mk
T
Frédéric Bérat 9ef37798fa test: Fix and stabilize tst-wcsmbs-clone-overflow test
The test tst-wcsmbs-clone-overflow was initially added to tests-static.
However, this causes the test to be unstable because gconv modules
dynamically load libc.so. Any discrepancy between the statically linked
version and the dynamically loaded one can lead to a crash.

By removing the test from tests-static, it relies on dynamic linking,
safely bypassing the dlopen crash. Since the test is now dynamically
linked, it cannot use the internal thread-local symbol
_NL_CURRENT_DATA(LC_CTYPE) because _nl_current_LC_CTYPE is hidden in
libc.so, leading to undefined references. Thus, the test now uses
newlocale and uselocale, safely extracting the locale data from the
returned locale_t object.

Furthermore, using newlocale requires the gconv-modules configuration to
be built and available so that the ISO8859-1.so module can be
dynamically loaded. Otherwise, glibc falls back to the built-in C locale
conversions, leaving __shlib_handle as NULL and silently bypassing the
reference counter increment.
A new Makefile fragment, gen-gconv-modules.mk, is introduced to ensure
the gconv-modules are built before the test runs, and an explicit check
for __shlib_handle != NULL is added to the test.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2026-05-29 11:34:20 +02:00

7 lines
209 B
Makefile

# defines target $(gen-gconv-modules) that ensures gconv-modules are available
gen-gconv-modules := $(common-objpfx)iconvdata/gconv-modules
$(gen-gconv-modules):
$(MAKE) -C ../iconvdata subdir=iconvdata $@