diff --git a/configure.ac b/configure.ac index eeb3f4bbd7d..f131735460e 100644 --- a/configure.ac +++ b/configure.ac @@ -7382,7 +7382,6 @@ CFLAGS=$pre_PKG_CONFIG_CFLAGS LIBS="$LIB_PTHREAD $pre_PKG_CONFIG_LIBS" gl_ASSERT_NO_GNULIB_POSIXCHECK gl_ASSERT_NO_GNULIB_TESTS -gl_EEMALLOC gl_INIT CFLAGS=$SAVE_CFLAGS LIBS=$SAVE_LIBS diff --git a/lib/explicit_bzero.c b/lib/explicit_bzero.c deleted file mode 100644 index 59d9895abfe..00000000000 --- a/lib/explicit_bzero.c +++ /dev/null @@ -1,74 +0,0 @@ -/* Erasure of sensitive data, generic implementation. - Copyright (C) 2016-2025 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* An assembler implementation of explicit_bzero can be created as an - assembler alias of an optimized bzero implementation. - Architecture-specific implementations also need to define - __explicit_bzero_chk. */ - -#if !_LIBC -# include -#endif - -/* memset_s need this define */ -#if HAVE_MEMSET_S -# define __STDC_WANT_LIB_EXT1__ 1 -#endif - -#include - -#if defined _WIN32 && !defined __CYGWIN__ -# define WIN32_LEAN_AND_MEAN -# include -#endif - -#if _LIBC -/* glibc-internal users use __explicit_bzero_chk, and explicit_bzero - redirects to that. */ -# undef explicit_bzero -#endif - -/* Set LEN bytes of S to 0. The compiler will not delete a call to - this function, even if S is dead after the call. */ -void -explicit_bzero (void *s, size_t len) -{ -#if defined _WIN32 && !defined __CYGWIN__ - (void) SecureZeroMemory (s, len); -#elif HAVE_EXPLICIT_MEMSET - explicit_memset (s, '\0', len); -#elif HAVE_MEMSET_S - (void) memset_s (s, len, '\0', len); -#elif defined __GNUC__ && !defined __clang__ - memset (s, '\0', len); - /* Compiler barrier. */ - asm volatile ("" ::: "memory"); -#elif defined __clang__ - memset (s, '\0', len); - /* Compiler barrier. */ - /* With asm ("" ::: "memory") LLVM analyzes uses of 's' and finds that the - whole thing is dead and eliminates it. Use 'g' to work around this - problem. See . */ - __asm__ volatile ("" : : "g"(s) : "memory"); -#else - /* Invoke memset through a volatile function pointer. This defeats compiler - optimizations. */ - void * (* const volatile volatile_memset) (void *, int, size_t) = memset; - (void) volatile_memset (s, '\0', len); -#endif -} diff --git a/lib/malloc/scratch_buffer_dupfree.c b/lib/malloc/scratch_buffer_dupfree.c deleted file mode 100644 index 0d31a765d5d..00000000000 --- a/lib/malloc/scratch_buffer_dupfree.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Variable-sized buffer with on-stack default allocation. - Copyright (C) 2020-2025 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _LIBC -# include -#endif - -#include -#include - -void * -__libc_scratch_buffer_dupfree (struct scratch_buffer *buffer, size_t size) -{ - void *data = buffer->data; - if (data == buffer->__space.__c) - { - void *copy = malloc (size); - return copy != NULL ? memcpy (copy, data, size) : NULL; - } - else - { - void *copy = realloc (data, size); - return copy != NULL ? copy : data; - } -} -libc_hidden_def (__libc_scratch_buffer_dupfree) diff --git a/lib/xalloc-oversized.h b/lib/xalloc-oversized.h deleted file mode 100644 index 808e97b8cae..00000000000 --- a/lib/xalloc-oversized.h +++ /dev/null @@ -1,66 +0,0 @@ -/* xalloc-oversized.h -- memory allocation size checking - - Copyright (C) 1990-2000, 2003-2004, 2006-2025 Free Software - Foundation, Inc. - - This file is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation; either version 2.1 of the - License, or (at your option) any later version. - - This file is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . */ - -#ifndef XALLOC_OVERSIZED_H_ -#define XALLOC_OVERSIZED_H_ - -#include -#include - -/* True if N * S does not fit into both ptrdiff_t and size_t. - N and S should be nonnegative and free of side effects. - This expands to a constant expression if N and S are both constants. - By gnulib convention, SIZE_MAX represents overflow in size_t - calculations, so the conservative size_t-based dividend to use here - is SIZE_MAX - 1. */ -#define __xalloc_oversized(n, s) \ - ((s) != 0 \ - && (PTRDIFF_MAX < SIZE_MAX ? PTRDIFF_MAX : SIZE_MAX - 1) / (s) < (n)) - -/* Return 1 if and only if an array of N objects, each of size S, - cannot exist reliably because its total size in bytes would exceed - MIN (PTRDIFF_MAX, SIZE_MAX - 1). - - N and S should be nonnegative and free of side effects. - - Warning: (xalloc_oversized (N, S) ? NULL : malloc (N * S)) can - misbehave if N and S are both narrower than ptrdiff_t and size_t, - and can be rewritten as (xalloc_oversized (N, S) ? NULL - : malloc (N * (size_t) S)). - - This is a macro, not a function, so that it works even if an - argument exceeds MAX (PTRDIFF_MAX, SIZE_MAX). */ -#if 7 <= __GNUC__ && !defined __clang__ && PTRDIFF_MAX < SIZE_MAX -# define xalloc_oversized(n, s) \ - __builtin_mul_overflow_p (n, s, (ptrdiff_t) 1) -#elif 5 <= __GNUC__ && !defined __clang__ && !defined __ICC \ - && PTRDIFF_MAX < SIZE_MAX -# define xalloc_oversized(n, s) \ - (__builtin_constant_p (n) && __builtin_constant_p (s) \ - ? __xalloc_oversized (n, s) \ - : __extension__ \ - ({ ptrdiff_t __xalloc_count; \ - __builtin_mul_overflow (n, s, &__xalloc_count); })) - -/* Other compilers use integer division; this may be slower but is - more portable. */ -#else -# define xalloc_oversized(n, s) __xalloc_oversized (n, s) -#endif - -#endif /* !XALLOC_OVERSIZED_H_ */ diff --git a/m4/eealloc.m4 b/m4/eealloc.m4 deleted file mode 100644 index d26eb3060d5..00000000000 --- a/m4/eealloc.m4 +++ /dev/null @@ -1,32 +0,0 @@ -# eealloc.m4 -# serial 3 -dnl Copyright (C) 2003, 2009-2025 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -AC_DEFUN([gl_EEALLOC], -[ - AC_REQUIRE([gl_EEMALLOC]) - AC_REQUIRE([gl_EEREALLOC]) -]) - -AC_DEFUN([gl_EEMALLOC], -[ - _AC_FUNC_MALLOC_IF( - [gl_cv_func_malloc_0_nonnull=1], - [gl_cv_func_malloc_0_nonnull=0]) - AC_DEFINE_UNQUOTED([MALLOC_0_IS_NONNULL], [$gl_cv_func_malloc_0_nonnull], - [If malloc(0) is != NULL, define this to 1. Otherwise define this - to 0.]) -]) - -AC_DEFUN([gl_EEREALLOC], -[ - _AC_FUNC_REALLOC_IF( - [gl_cv_func_realloc_0_nonnull=1], - [gl_cv_func_realloc_0_nonnull=0]) - AC_DEFINE_UNQUOTED([REALLOC_0_IS_NONNULL], [$gl_cv_func_realloc_0_nonnull], - [If realloc(NULL,0) is != NULL, define this to 1. Otherwise define this - to 0.]) -]) diff --git a/m4/explicit_bzero.m4 b/m4/explicit_bzero.m4 deleted file mode 100644 index 6fa2eda9f6b..00000000000 --- a/m4/explicit_bzero.m4 +++ /dev/null @@ -1,23 +0,0 @@ -dnl Copyright 2017-2025 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -AC_DEFUN([gl_FUNC_EXPLICIT_BZERO], -[ - AC_REQUIRE([gl_STRING_H_DEFAULTS]) - - dnl Persuade glibc to declare explicit_bzero. - AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) - - AC_CHECK_FUNCS_ONCE([explicit_bzero]) - if test $ac_cv_func_explicit_bzero = no; then - HAVE_EXPLICIT_BZERO=0 - fi -]) - -AC_DEFUN([gl_PREREQ_EXPLICIT_BZERO], -[ - AC_CHECK_FUNCS([explicit_memset]) - AC_CHECK_FUNCS_ONCE([memset_s]) -]) diff --git a/m4/st_dm_mode.m4 b/m4/st_dm_mode.m4 deleted file mode 100644 index 56748c385f0..00000000000 --- a/m4/st_dm_mode.m4 +++ /dev/null @@ -1,24 +0,0 @@ -# serial 6 - -# Copyright (C) 1998-1999, 2001, 2009-2025 Free Software Foundation, -# Inc. -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# Define HAVE_ST_DM_MODE if struct stat has an st_dm_mode member. - -AC_DEFUN([AC_STRUCT_ST_DM_MODE], - [AC_CACHE_CHECK([for st_dm_mode in struct stat], [ac_cv_struct_st_dm_mode], - [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#include -#include ]], [[struct stat s; s.st_dm_mode;]])], - [ac_cv_struct_st_dm_mode=yes], - [ac_cv_struct_st_dm_mode=no])]) - - if test $ac_cv_struct_st_dm_mode = yes; then - AC_DEFINE([HAVE_ST_DM_MODE], [1], - [Define if struct stat has an st_dm_mode member.]) - fi - ] -) diff --git a/m4/year2038.m4 b/m4/year2038.m4 deleted file mode 100644 index 47693fb8f3a..00000000000 --- a/m4/year2038.m4 +++ /dev/null @@ -1,132 +0,0 @@ -# year2038.m4 serial 8 -dnl Copyright (C) 2017-2025 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl Attempt to ensure that 'time_t' can go past the year 2038 and that -dnl the functions 'time', 'stat', etc. work with post-2038 timestamps. - -m4_ifdef([AC_SYS_YEAR2038], [ - AC_DEFUN([gl_YEAR2038_EARLY]) - AC_DEFUN([gl_YEAR2038], [AC_SYS_YEAR2038]) - AC_DEFUN([gl_YEAR2038_BODY], [_AC_SYS_YEAR2038]) -], [ - -AC_DEFUN([gl_YEAR2038_EARLY], -[ - AC_REQUIRE([AC_CANONICAL_HOST]) - case "$host_os" in - mingw*) - AC_DEFINE([__MINGW_USE_VC2005_COMPAT], [1], - [For 64-bit time_t on 32-bit mingw.]) - ;; - esac -]) - -# gl_YEAR2038_TEST_INCLUDES -# ------------------------- -AC_DEFUN([gl_YEAR2038_TEST_INCLUDES], -[[ - #include - /* Check that time_t can represent 2**32 - 1 correctly. */ - #define LARGE_TIME_T \\ - ((time_t) (((time_t) 1 << 30) - 1 + 3 * ((time_t) 1 << 30))) - int verify_time_t_range[(LARGE_TIME_T / 65537 == 65535 - && LARGE_TIME_T % 65537 == 0) - ? 1 : -1]; -]]) - -# gl_YEAR2038_BODY(REQUIRE-YEAR2038-SAFE) ------------------------------------------ -AC_DEFUN([gl_YEAR2038_BODY], -[ - AC_ARG_ENABLE([year2038], - [ --disable-year2038 omit support for timestamps past the year 2038]) - AS_IF([test "$enable_year2038" != no], - [ - dnl On many systems, time_t is already a 64-bit type. - dnl On those systems where time_t is still 32-bit, it requires kernel - dnl and libc support to make it 64-bit. For glibc 2.34 and later on Linux, - dnl defining _TIME_BITS=64 and _FILE_OFFSET_BITS=64 is needed on x86 and ARM. - dnl - dnl On native Windows, the system include files define types __time32_t - dnl and __time64_t. By default, time_t is an alias of - dnl - __time32_t on 32-bit mingw, - dnl - __time64_t on 64-bit mingw and on MSVC (since MSVC 8). - dnl But when compiling with -D__MINGW_USE_VC2005_COMPAT, time_t is an - dnl alias of __time64_t. - dnl And when compiling with -D_USE_32BIT_TIME_T, time_t is an alias of - dnl __time32_t. - AC_CACHE_CHECK([for time_t past the year 2038], [gl_cv_type_time_t_y2038], - [AC_COMPILE_IFELSE( - [AC_LANG_SOURCE([gl_YEAR2038_TEST_INCLUDES])], - [gl_cv_type_time_t_y2038=yes], [gl_cv_type_time_t_y2038=no]) - ]) - if test "$gl_cv_type_time_t_y2038" = no; then - AC_CACHE_CHECK([for 64-bit time_t with _TIME_BITS=64], - [gl_cv_type_time_t_bits_macro], - [AC_COMPILE_IFELSE( - [AC_LANG_SOURCE([[#define _TIME_BITS 64 - #define _FILE_OFFSET_BITS 64 - ]gl_YEAR2038_TEST_INCLUDES])], - [gl_cv_type_time_t_bits_macro=yes], - [gl_cv_type_time_t_bits_macro=no]) - ]) - if test "$gl_cv_type_time_t_bits_macro" = yes; then - AC_DEFINE([_TIME_BITS], [64], - [Number of bits in a timestamp, on hosts where this is settable.]) - dnl AC_SYS_LARGFILE also defines this; it's OK if we do too. - AC_DEFINE([_FILE_OFFSET_BITS], [64], - [Number of bits in a file offset, on hosts where this is settable.]) - gl_cv_type_time_t_y2038=yes - fi - fi - if test $gl_cv_type_time_t_y2038 = no; then - AC_COMPILE_IFELSE( - [AC_LANG_SOURCE( - [[#ifdef _USE_32BIT_TIME_T - int ok; - #else - error fail - #endif - ]])], - [AC_MSG_FAILURE( - [The 'time_t' type stops working after January 2038. - Remove _USE_32BIT_TIME_T from the compiler flags.])], - [# If not cross-compiling and $1 says we should check, - # and 'touch' works with a large timestamp, then evidently wider time_t - # is desired and supported, so fail and ask the builder to fix the - # problem. Otherwise, just warn the builder. - m4_ifval([$1], - [if test $cross_compiling = no \ - && TZ=UTC0 touch -t 210602070628.15 conftest.time 2>/dev/null; then - case `TZ=UTC0 LC_ALL=C ls -l conftest.time 2>/dev/null` in - *'Feb 7 2106'* | *'Feb 7 17:10'*) - AC_MSG_FAILURE( - [The 'time_t' type stops working after January 2038, - and your system appears to support a wider 'time_t'. - Try configuring with 'CC="${CC} -m64"'. - To build with a 32-bit time_t anyway (not recommended), - configure with '--disable-year2038'.]);; - esac - rm -f conftest.time - fi]) - if test "$gl_warned_about_y2038" != yes; then - AC_MSG_WARN( - [The 'time_t' type stops working after January 2038, - and this package needs a wider 'time_t' type - if there is any way to access timestamps after that. - Configure with 'CC="${CC} -m64"' perhaps?]) - gl_warned_about_y2038=yes - fi - ]) - fi]) -]) - -AC_DEFUN([gl_YEAR2038], -[ - gl_YEAR2038_BODY([require-year2038-safe]) -]) - -]) # m4_ifndef AC_SYS_YEAR2038