math: Remove slow paths from atan2 [BZ #15267]
[glibc.git] / debug / explicit_bzero_chk.c
blob3b19d84824e6d5416fbd313e7ce468036c97728b
1 /* Generic implementation of __explicit_bzero_chk.
2 Copyright (C) 1991-2021 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by Torbjorn Granlund (tege@sics.se).
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <https://www.gnu.org/licenses/>. */
20 /* This is the generic definition of __explicit_bzero_chk. The
21 __explicit_bzero_chk symbol is used as the implementation of
22 explicit_bzero throughout glibc. If this file is overriden by an
23 architecture, both __explicit_bzero_chk and
24 __explicit_bzero_chk_internal have to be defined (the latter not as
25 an IFUNC). */
27 #include <string.h>
29 void
30 __explicit_bzero_chk (void *dst, size_t len, size_t dstlen)
32 /* Inline __memset_chk to avoid a PLT reference to __memset_chk. */
33 if (__glibc_unlikely (dstlen < len))
34 __chk_fail ();
35 memset (dst, '\0', len);
36 /* Compiler barrier. */
37 asm volatile ("" ::: "memory");
40 /* libc-internal references use the hidden
41 __explicit_bzero_chk_internal symbol. This is necessary if
42 __explicit_bzero_chk is implemented as an IFUNC because some
43 targets do not support hidden references to IFUNC symbols. */
44 strong_alias (__explicit_bzero_chk, __explicit_bzero_chk_internal)