mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-25 12:11:10 +00:00
09a596cc2c
These machine-dependent inline string functions have never been on by default, and even if they were a good idea at the time they were introduced, they haven't really been touched in ten to fifteen years and probably aren't a good idea on current-gen processors. Current thinking is that this class of optimization is best left to the compiler. * bits/string.h, string/bits/string.h * sysdeps/aarch64/bits/string.h * sysdeps/m68k/m680x0/m68020/bits/string.h * sysdeps/s390/bits/string.h, sysdeps/sparc/bits/string.h * sysdeps/x86/bits/string.h: Delete file. * string/string.h: Don't include bits/string.h. * string/bits/string3.h: Rename to bits/string_fortified.h. No need to undef various symbols that the removed headers might have defined as macros. * string/Makefile (headers): Remove bits/string.h, change bits/string3.h to bits/string_fortified.h. * string/string-inlines.c: Update commentary. Remove definitions of various macros that nothing looks at anymore. Don't directly include bits/string.h. Set _STRING_INLINE_unaligned here, based on compiler-predefined macros. * string/strncat.c: If STRNCAT is not defined, or STRNCAT_PRIMARY _is_ defined, provide internal hidden alias __strncat. * include/string.h: Declare internal hidden alias __strncat. Only forward __stpcpy to __builtin_stpcpy if __NO_STRING_INLINES is not defined. * include/bits/string3.h: Rename to bits/string_fortified.h, update to match above. * sysdeps/i386/string-inlines.c: Define compat symbols for everything formerly defined by sysdeps/x86/bits/string.h. Make existing definitions into compat symbols as well. Remove some no-longer-necessary messing around with macros. * sysdeps/powerpc/powerpc32/power4/multiarch/mempcpy.c * sysdeps/powerpc/powerpc64/multiarch/mempcpy.c * sysdeps/powerpc/powerpc64/multiarch/stpcpy.c * sysdeps/s390/multiarch/mempcpy.c No need to define _HAVE_STRING_ARCH_mempcpy. Do define __NO_STRING_INLINES and NO_MEMPCPY_STPCPY_REDIRECT. * sysdeps/i386/i686/multiarch/strncat-c.c * sysdeps/s390/multiarch/strncat-c.c * sysdeps/x86_64/multiarch/strncat-c.c Define STRNCAT_PRIMARY. Don't change definition of libc_hidden_def.
209 lines
6.6 KiB
C
209 lines
6.6 KiB
C
/* Copyright (C) 1999-2017 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
|
|
<http://www.gnu.org/licenses/>. */
|
|
|
|
#include <string/string-inlines.c>
|
|
|
|
#if SHLIB_COMPAT (libc, GLIBC_2_1_1, GLIBC_2_26)
|
|
/* Additional compatibility shims for the former
|
|
sysdeps/x86/bits/string.h. */
|
|
void *
|
|
__old_memcpy_c (void *d, const void *s, size_t n)
|
|
{
|
|
return memcpy (d, s, n);
|
|
}
|
|
strong_alias (__old_memcpy_c, __old_memcpy_g);
|
|
strong_alias (__old_memcpy_c, __old_memcpy_by4);
|
|
strong_alias (__old_memcpy_c, __old_memcpy_by2);
|
|
compat_symbol (libc, __old_memcpy_c, __memcpy_c, GLIBC_2_1_1);
|
|
compat_symbol (libc, __old_memcpy_g, __memcpy_g, GLIBC_2_1_1);
|
|
compat_symbol (libc, __old_memcpy_by4, __memcpy_by4, GLIBC_2_1_1);
|
|
compat_symbol (libc, __old_memcpy_by2, __memcpy_by2, GLIBC_2_1_1);
|
|
|
|
void *
|
|
__old_memset_cc (void *s, unsigned long int pattern, size_t n)
|
|
{
|
|
return memset (s, pattern & 0xff, n);
|
|
}
|
|
strong_alias (__old_memset_cc, __old_memset_cg);
|
|
strong_alias (__old_memset_cc, __old_memset_ccn_by2);
|
|
strong_alias (__old_memset_cc, __old_memset_ccn_by4);
|
|
compat_symbol (libc, __old_memset_cc, __memset_cc, GLIBC_2_1_1);
|
|
compat_symbol (libc, __old_memset_cg, __memset_cg, GLIBC_2_1_1);
|
|
compat_symbol (libc, __old_memset_ccn_by4, __memset_ccn_by4, GLIBC_2_1_1);
|
|
compat_symbol (libc, __old_memset_ccn_by2, __memset_ccn_by2, GLIBC_2_1_1);
|
|
|
|
void *
|
|
__old_memset_gg (void *s, char c, size_t n)
|
|
{
|
|
return memset (s, c, n);
|
|
}
|
|
strong_alias (__old_memset_gg, __old_memset_gcn_by4);
|
|
strong_alias (__old_memset_gg, __old_memset_gcn_by2);
|
|
compat_symbol (libc, __old_memset_gg, __memset_gg, GLIBC_2_1_1);
|
|
compat_symbol (libc, __old_memset_gcn_by4, __memset_gcn_by4, GLIBC_2_1_1);
|
|
compat_symbol (libc, __old_memset_gcn_by2, __memset_gcn_by2, GLIBC_2_1_1);
|
|
|
|
size_t
|
|
__old_strlen_g (const char *str)
|
|
{
|
|
return strlen (str);
|
|
}
|
|
compat_symbol (libc, __old_strlen_g, __strlen_g, GLIBC_2_1_1);
|
|
|
|
char *
|
|
__old_strcpy_g (char *dest, const char *src)
|
|
{
|
|
return strcpy (dest, src);
|
|
}
|
|
compat_symbol (libc, __old_strcpy_g, __strcpy_g, GLIBC_2_1_1);
|
|
|
|
void *
|
|
__old_mempcpy_byn (void *dest, const void *src, size_t len)
|
|
{
|
|
return __mempcpy (dest, src, len);
|
|
}
|
|
strong_alias (__old_mempcpy_byn, __old_mempcpy_by4);
|
|
strong_alias (__old_mempcpy_byn, __old_mempcpy_by2);
|
|
compat_symbol (libc, __old_mempcpy_byn, __mempcpy_byn, GLIBC_2_1_1);
|
|
compat_symbol (libc, __old_mempcpy_by4, __mempcpy_by4, GLIBC_2_1_1);
|
|
compat_symbol (libc, __old_mempcpy_by2, __mempcpy_by2, GLIBC_2_1_1);
|
|
|
|
char *
|
|
__old_stpcpy_g (char *dest, const char *src)
|
|
{
|
|
return __stpcpy (dest, src);
|
|
}
|
|
compat_symbol (libc, __old_stpcpy_g, __stpcpy_g, GLIBC_2_1_1);
|
|
|
|
char *
|
|
__old_strncpy_byn (char *dest, const char *src, size_t srclen, size_t n)
|
|
{
|
|
return strncpy (dest, src, n);
|
|
}
|
|
strong_alias (__old_strncpy_byn, __old_strncpy_by4);
|
|
strong_alias (__old_strncpy_byn, __old_strncpy_by2);
|
|
compat_symbol (libc, __old_strncpy_byn, __strncpy_byn, GLIBC_2_1_1);
|
|
compat_symbol (libc, __old_strncpy_by4, __strncpy_by4, GLIBC_2_1_1);
|
|
compat_symbol (libc, __old_strncpy_by2, __strncpy_by2, GLIBC_2_1_1);
|
|
|
|
char *
|
|
__old_strncpy_gg (char *dest, const char *src, size_t n)
|
|
{
|
|
return strncpy (dest, src, n);
|
|
}
|
|
compat_symbol (libc, __old_strncpy_gg, __strncpy_gg, GLIBC_2_1_1);
|
|
|
|
/* __strcat_c took a third argument, which we ignore. */
|
|
char *
|
|
__old_strcat_g (char *dest, const char *src)
|
|
{
|
|
return strcat (dest, src);
|
|
}
|
|
strong_alias (__old_strcat_g, __old_strcat_c);
|
|
compat_symbol (libc, __old_strcat_g, __strcat_g, GLIBC_2_1_1);
|
|
compat_symbol (libc, __old_strcat_c, __strcat_c, GLIBC_2_1_1);
|
|
|
|
char *
|
|
__old_strncat_g (char *dest, const char *src, size_t n)
|
|
{
|
|
return __strncat (dest, src, n);
|
|
}
|
|
compat_symbol (libc, __old_strncat_g, __strncat_g, GLIBC_2_1_1);
|
|
|
|
int
|
|
__old_strcmp_gg (const char *s1, const char *s2)
|
|
{
|
|
return strcmp (s1, s2);
|
|
}
|
|
compat_symbol (libc, __old_strcmp_gg, __strcmp_gg, GLIBC_2_1_1);
|
|
|
|
int
|
|
__old_strncmp_g (const char *s1, const char *s2, size_t n)
|
|
{
|
|
return strncmp (s1, s2, n);
|
|
}
|
|
compat_symbol (libc, __old_strncmp_g, __strncmp_g, GLIBC_2_1_1);
|
|
|
|
char *
|
|
__old_strchr_g (const char *s, int c)
|
|
{
|
|
return strchr (s, c);
|
|
}
|
|
strong_alias (__old_strchr_g, __old_strchr_c);
|
|
compat_symbol (libc, __old_strchr_g, __strchr_g, GLIBC_2_1_1);
|
|
compat_symbol (libc, __old_strchr_c, __strchr_c, GLIBC_2_1_1);
|
|
|
|
char *
|
|
__old_strchrnul_g (const char *s, int c)
|
|
{
|
|
return __strchrnul (s, c);
|
|
}
|
|
strong_alias (__old_strchrnul_g, __old_strchrnul_c);
|
|
compat_symbol (libc, __old_strchrnul_g, __strchrnul_g, GLIBC_2_1_1);
|
|
compat_symbol (libc, __old_strchrnul_c, __strchrnul_c, GLIBC_2_1_1);
|
|
|
|
char *
|
|
__old_strrchr_g (const char *s, int c)
|
|
{
|
|
return strrchr (s, c);
|
|
}
|
|
strong_alias (__old_strrchr_g, __old_strrchr_c);
|
|
compat_symbol (libc, __old_strrchr_g, __strrchr_g, GLIBC_2_1_1);
|
|
compat_symbol (libc, __old_strrchr_c, __strrchr_c, GLIBC_2_1_1);
|
|
|
|
/* __strcspn_cg took a third argument, which we ignore. */
|
|
size_t
|
|
__old_strcspn_g (const char *s, const char *reject)
|
|
{
|
|
return strcspn (s, reject);
|
|
}
|
|
strong_alias (__old_strcspn_g, __old_strcspn_cg);
|
|
compat_symbol (libc, __old_strcspn_g, __strcspn_g, GLIBC_2_1_1);
|
|
compat_symbol (libc, __old_strcspn_cg, __strcspn_cg, GLIBC_2_1_1);
|
|
|
|
/* __strspn_cg took a third argument, which we ignore. */
|
|
size_t
|
|
__old_strspn_g (const char *s, const char *accept)
|
|
{
|
|
return strspn (s, accept);
|
|
}
|
|
strong_alias (__old_strspn_g, __old_strspn_cg);
|
|
compat_symbol (libc, __old_strspn_g, __strspn_g, GLIBC_2_1_1);
|
|
compat_symbol (libc, __old_strspn_cg, __strspn_cg, GLIBC_2_1_1);
|
|
|
|
/* __strpbrk_cg took a third argument, which we ignore. */
|
|
const char *
|
|
__old_strpbrk_g (const char *s, const char *accept)
|
|
{
|
|
return strpbrk (s, accept);
|
|
}
|
|
strong_alias (__old_strpbrk_g, __old_strpbrk_cg);
|
|
compat_symbol (libc, __old_strpbrk_g, __strpbrk_g, GLIBC_2_1_1);
|
|
compat_symbol (libc, __old_strpbrk_cg, __strpbrk_cg, GLIBC_2_1_1);
|
|
|
|
/* __strstr_cg took a third argument, which we ignore. */
|
|
const char *
|
|
__old_strstr_g (const char *s, const char *accept)
|
|
{
|
|
return strstr (s, accept);
|
|
}
|
|
strong_alias (__old_strstr_g, __old_strstr_cg);
|
|
compat_symbol (libc, __old_strstr_g, __strstr_g, GLIBC_2_1_1);
|
|
compat_symbol (libc, __old_strstr_cg, __strstr_cg, GLIBC_2_1_1);
|
|
|
|
#endif
|