From: Abhay Kandpal Date: Tue, 16 Jun 2026 13:16:54 +0000 (-0500) Subject: configure.ac: Fix AC_HWCAP_CONTAINS_FLAG for glibc 2.42 on PowerPC X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=973b250ecad0f881328fd24d428b7fc3be87f9df;p=thirdparty%2Fvalgrind.git configure.ac: Fix AC_HWCAP_CONTAINS_FLAG for glibc 2.42 on PowerPC glibc 2.42 removed sysdeps/powerpc/dl-procinfo.h which contained the _dl_procinfo() hook responsible for printing human-readable capability strings in LD_SHOW_AUXV output on PowerPC. As a result, LD_SHOW_AUXV now prints raw hex values (e.g. 0xdc0065c2) instead of capability names (e.g. altivec vsx ppc64 ppc32). The AC_HWCAP_CONTAINS_FLAG macro was using LD_SHOW_AUXV text output and grep to detect hardware capabilities at configure time. This broke on glibc 2.42 causing HWCAP_HAS_ALTIVEC and other flags to be unset, resulting in testVMX.c failing to compile on PowerPC BE systems due to missing -maltivec flag. Beyond the immediate glibc-2.42 breakage, the configure-time HWCAP checks were conceptually wrong: they answer "does the build host have these capabilities right now?" when the right build-time question is "can the compiler/assembler emit these instructions?". Runtime hardware capability is a runtime concern and is already handled by coregrind/m_machine.c's signal-based probes in VG_(machine_get_hwcaps)(). Mark suggested removing the HWCAP clauses entirely and relying on the existing assembler/compiler checks alone. This patch: - Removes AC_HWCAP_CONTAINS_FLAG and all 10 of its invocations. - Drops the '-a x$HWCAP_HAS_* = xyes' clause from 8 AM_CONDITIONALs: HAS_ISA_2_07, HAS_ALTIVEC, HAS_VSX, HAS_DFP, BUILD_DFP_TESTS, SUPPORTS_HTM, HAS_ISA_3_00, HAS_ISA_3_1. - Forces HAS_ISA_2_05 unconditionally true. ISA 2.05 is POWER6 (2007); no supported PowerPC system today lacks it. The conditional can't be deleted because tests/Makefile.am still references it. - Replaces HAS_ISA_2_06's HWCAP clause with the existing VSX assembler check, since VSX was introduced in ISA 2.06 and any assembler that accepts VSX accepts ISA 2.06. The AM_CONDITIONAL is relocated to after the VSX assembler probe so the variable ac_compiler_supports_vsx is defined when it is read. - HWCAP_HAS_MMA was defined but never consumed in configure.ac, so removing the macro call is a clean removal. --- diff --git a/configure.ac b/configure.ac index 21952ec76..6a0663879 100644 --- a/configure.ac +++ b/configure.ac @@ -1780,41 +1780,10 @@ AC_CHECK_MEMBER([pthread_mutex_t.__data.__kind], [], [#include ]) -# Convenience function. Set flags based on the existing HWCAP entries. -# The AT_HWCAP entries are generated by glibc, and are based on -# functions supported by the hardware/system/libc. -# Subsequent support for whether the capability will actually be utilized -# will also be checked against the compiler capabilities. -# called as -# AC_HWCAP_CONTAINS_FLAG[hwcap_string_to_match],[VARIABLE_TO_SET] -AC_DEFUN([AC_HWCAP_CONTAINS_FLAG],[ - AUXV_CHECK_FOR=$1 - AC_MSG_CHECKING([if AT_HWCAP contains the $AUXV_CHECK_FOR indicator]) - if env LD_SHOW_AUXV=1 true | grep ^AT_HWCAP | grep -q -w ${AUXV_CHECK_FOR} - then - AC_MSG_RESULT([yes]) - AC_SUBST([$2],[yes]) - else - AC_MSG_RESULT([no]) - AC_SUBST([$2],[]) - fi -]) - -# gather hardware capabilities. (hardware/kernel/libc) -AC_HWCAP_CONTAINS_FLAG([altivec],[HWCAP_HAS_ALTIVEC]) -AC_HWCAP_CONTAINS_FLAG([vsx],[HWCAP_HAS_VSX]) -AC_HWCAP_CONTAINS_FLAG([dfp],[HWCAP_HAS_DFP]) -AC_HWCAP_CONTAINS_FLAG([arch_2_05],[HWCAP_HAS_ISA_2_05]) -AC_HWCAP_CONTAINS_FLAG([arch_2_06],[HWCAP_HAS_ISA_2_06]) -AC_HWCAP_CONTAINS_FLAG([arch_2_07],[HWCAP_HAS_ISA_2_07]) -AC_HWCAP_CONTAINS_FLAG([arch_3_00],[HWCAP_HAS_ISA_3_00]) -AC_HWCAP_CONTAINS_FLAG([arch_3_1],[HWCAP_HAS_ISA_3_1]) -AC_HWCAP_CONTAINS_FLAG([htm],[HWCAP_HAS_HTM]) -AC_HWCAP_CONTAINS_FLAG([mma],[HWCAP_HAS_MMA]) # ISA Levels -AM_CONDITIONAL(HAS_ISA_2_05, [test x$HWCAP_HAS_ISA_2_05 = xyes]) -AM_CONDITIONAL(HAS_ISA_2_06, [test x$HWCAP_HAS_ISA_2_06 = xyes]) +# ISA 2.05 (POWER6) is assumed always available on any supported PowerPC system +AM_CONDITIONAL(HAS_ISA_2_05, [true]) # compiler support for isa 2.07 level instructions AC_MSG_CHECKING([that assembler knows ISA 2.07 instructions ]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ @@ -1827,8 +1796,7 @@ AC_MSG_RESULT([yes]) ac_asm_have_isa_2_07=no AC_MSG_RESULT([no]) ]) -AM_CONDITIONAL(HAS_ISA_2_07, [test x$ac_asm_have_isa_2_07 = xyes \ - -a x$HWCAP_HAS_ISA_2_07 = xyes]) +AM_CONDITIONAL(HAS_ISA_2_07, [test x$ac_asm_have_isa_2_07 = xyes]) # altivec (vsx) support. # does this compiler support -maltivec and does it have the include file @@ -1848,8 +1816,7 @@ ac_have_altivec=no AC_MSG_RESULT([no]) ]) CFLAGS=$safe_CFLAGS -AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes \ - -a x$HWCAP_HAS_ALTIVEC = xyes]) +AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes]) # Check that both: the compiler supports -mvsx and that the assembler # understands VSX instructions. If either of those doesn't work, @@ -1885,8 +1852,10 @@ AC_MSG_RESULT([no]) ]) CFLAGS=$safe_CFLAGS AM_CONDITIONAL([HAS_VSX], [test x$ac_compiler_supports_vsx_flag = xyes \ - -a x$ac_compiler_supports_vsx = xyes \ - -a x$HWCAP_HAS_VSX = xyes ]) + -a x$ac_compiler_supports_vsx = xyes]) + +# HAS_ISA_2_06 uses the VSX assembler check since VSX support implies ISA 2.06 +AM_CONDITIONAL(HAS_ISA_2_06, [test x$ac_compiler_supports_vsx = xyes]) # DFP (Decimal Float) # The initial DFP support was added in Power 6. The dcffix instruction @@ -1931,8 +1900,7 @@ AC_MSG_RESULT([no]) ]) CFLAGS=$safe_CFLAGS AM_CONDITIONAL(HAS_DFP, test x$ac_asm_have_dfp = xyes \ - -a x$ac_compiler_have_dfp = xyes \ - -a x$HWCAP_HAS_DFP = xyes ) + -a x$ac_compiler_have_dfp = xyes) AC_MSG_CHECKING([that compiler knows DFP datatypes]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ @@ -1945,8 +1913,7 @@ AC_MSG_RESULT([yes]) ac_compiler_have_dfp_type=no AC_MSG_RESULT([no]) ]) -AM_CONDITIONAL(BUILD_DFP_TESTS, test x$ac_compiler_have_dfp_type = xyes \ - -a x$HWCAP_HAS_DFP = xyes ) +AM_CONDITIONAL(BUILD_DFP_TESTS, test x$ac_compiler_have_dfp_type = xyes) # HTM (Hardware Transactional Memory) @@ -1982,8 +1949,7 @@ ac_compiler_sees_htm_builtins=no CFLAGS=$safe_CFLAGS AM_CONDITIONAL(SUPPORTS_HTM, test x$ac_compiler_supports_htm = xyes \ - -a x$ac_compiler_sees_htm_builtins = xyes \ - -a x$HWCAP_HAS_HTM = xyes ) + -a x$ac_compiler_sees_htm_builtins = xyes) # isa 3.0 checking. (actually 3.0 or newer) AC_MSG_CHECKING([that assembler knows ISA 3.00 ]) @@ -2049,14 +2015,12 @@ AC_MSG_RESULT([no]) ]) -AM_CONDITIONAL(HAS_ISA_3_00, [test x$ac_asm_have_isa_3_00 = xyes \ - -a x$HWCAP_HAS_ISA_3_00 = xyes]) +AM_CONDITIONAL(HAS_ISA_3_00, [test x$ac_asm_have_isa_3_00 = xyes]) AM_CONDITIONAL(HAS_XSCVHPDP, [test x$ac_asm_have_xscvhpdp = xyes]) AM_CONDITIONAL(HAS_DARN, [test x$ac_asm_have_darn_inst = xyes]) -AM_CONDITIONAL(HAS_ISA_3_1, [test x$ac_asm_have_isa_3_1 = xyes \ - -a x$HWCAP_HAS_ISA_3_1 = xyes]) +AM_CONDITIONAL(HAS_ISA_3_1, [test x$ac_asm_have_isa_3_1 = xyes]) # Check for pthread_create@GLIBC2.0 AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])