From: Jakub Jelinek Date: Tue, 5 Dec 2023 22:32:19 +0000 (+0100) Subject: libiberty: Fix build with GCC < 7 X-Git-Tag: basepoints/gcc-15~3943 X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fgcc.git;a=commitdiff_plain;h=c73cc6fe6207b2863afa31a3be8ad87b70d3df0a libiberty: Fix build with GCC < 7 Tobias reported on IRC that the linker fails to build with GCC 4.8.5. In configure I've tried to use everything actually used in the sha1.c x86 hw implementation, but unfortunately I forgot about implicit function declarations. GCC before 7 did have header and bit_SHA define and __get_cpuid function defined inline, but it didn't define __get_cpuid_count, which compiled fine (and the configure test is intentionally compile time only) due to implicit function declaration, but then failed to link when linking the linker, because __get_cpuid_count wasn't defined anywhere. The following patch fixes that by using what autoconf uses in AC_CHECK_DECL to make sure the functions are declared. 2023-12-05 Jakub Jelinek * configure.ac (HAVE_X86_SHA1_HW_SUPPORT): Verify __get_cpuid and __get_cpuid_count are not implicitly declared. * configure: Regenerated. --- diff --git a/libiberty/configure b/libiberty/configure index 10f38511463c..5c69fee56c10 100755 --- a/libiberty/configure +++ b/libiberty/configure @@ -7667,6 +7667,8 @@ void foo (__m128i *buf, unsigned int e, __m128i msg0, __m128i msg1) int bar (void) { unsigned int eax, ebx, ecx, edx; + (void) __get_cpuid; + (void) __get_cpuid_count; if (__get_cpuid_count (7, 0, &eax, &ebx, &ecx, &edx) && (ebx & bit_SHA) != 0 && __get_cpuid (1, &eax, &ebx, &ecx, &edx) diff --git a/libiberty/configure.ac b/libiberty/configure.ac index 96a61934ffd0..0888e6388965 100644 --- a/libiberty/configure.ac +++ b/libiberty/configure.ac @@ -771,6 +771,8 @@ void foo (__m128i *buf, unsigned int e, __m128i msg0, __m128i msg1) int bar (void) { unsigned int eax, ebx, ecx, edx; + (void) __get_cpuid; + (void) __get_cpuid_count; if (__get_cpuid_count (7, 0, &eax, &ebx, &ecx, &edx) && (ebx & bit_SHA) != 0 && __get_cpuid (1, &eax, &ebx, &ecx, &edx)