diff options
author | Dan Albert <danalbert@google.com> | 2014-06-04 01:00:40 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-06-04 01:00:40 +0000 |
commit | c380189410b66dcaca5936b2fabceab4c492dd53 (patch) | |
tree | 180b7b70440622d223c5f499c840d8f93c1bf835 | |
parent | 3dbc2fe33e7a1c0e545f7762d3c7a98429c5a82b (diff) | |
parent | ce9ce28e5d760e32ab6c894dfaf7b8dad6de7ff6 (diff) | |
download | bionic-c380189410b66dcaca5936b2fabceab4c492dd53.zip bionic-c380189410b66dcaca5936b2fabceab4c492dd53.tar.gz bionic-c380189410b66dcaca5936b2fabceab4c492dd53.tar.bz2 |
Merge "Removes bcopy and bzero from bionic."
-rw-r--r-- | libc/arch-arm64/generic/bionic/bcopy.S | 30 | ||||
-rw-r--r-- | libc/arch-arm64/generic/bionic/bzero.S | 30 | ||||
-rw-r--r-- | libc/arch-arm64/generic/generic.mk | 2 | ||||
-rw-r--r-- | libc/arch-mips64/bionic/bzero.S | 41 | ||||
-rw-r--r-- | libc/arch-mips64/mips64.mk | 2 | ||||
-rw-r--r-- | libc/arch-x86_64/string/sse2-bcopy-slm.S | 33 | ||||
-rw-r--r-- | libc/arch-x86_64/string/sse2-bzero-slm.S | 33 | ||||
-rw-r--r-- | libc/arch-x86_64/x86_64.mk | 2 | ||||
-rw-r--r-- | libc/bionic/memmove.c | 20 | ||||
-rw-r--r-- | libc/include/strings.h | 12 |
10 files changed, 5 insertions, 200 deletions
diff --git a/libc/arch-arm64/generic/bionic/bcopy.S b/libc/arch-arm64/generic/bionic/bcopy.S deleted file mode 100644 index 7079e8b..0000000 --- a/libc/arch-arm64/generic/bionic/bcopy.S +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (c) 2014, Linaro Limited - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of the Linaro nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define BCOPY -#include "memmove.S" -#undef BCOPY diff --git a/libc/arch-arm64/generic/bionic/bzero.S b/libc/arch-arm64/generic/bionic/bzero.S deleted file mode 100644 index c6175d6..0000000 --- a/libc/arch-arm64/generic/bionic/bzero.S +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (c) 2014, Linaro Limited - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of the Linaro nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define BZERO -#include "memset.S" -#undef BZERO diff --git a/libc/arch-arm64/generic/generic.mk b/libc/arch-arm64/generic/generic.mk index 976431a..e10cf66 100644 --- a/libc/arch-arm64/generic/generic.mk +++ b/libc/arch-arm64/generic/generic.mk @@ -1,6 +1,4 @@ libc_bionic_src_files_arm64 += \ - arch-arm64/generic/bionic/bcopy.S \ - arch-arm64/generic/bionic/bzero.S \ arch-arm64/generic/bionic/memcmp.S \ arch-arm64/generic/bionic/memcpy.S \ arch-arm64/generic/bionic/memmove.S \ diff --git a/libc/arch-mips64/bionic/bzero.S b/libc/arch-mips64/bionic/bzero.S deleted file mode 100644 index 76c6bc2..0000000 --- a/libc/arch-mips64/bionic/bzero.S +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2008 The Android Open Source Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <private/bionic_asm.h> - -/* - * void bzero(void *s, size_t n); - */ -LEAF(bzero,0) - SETUP_GP64(t0,bzero) - move a2,a1 - move a1,zero - LA t9,memset - RESTORE_GP64 - j t9 -END(bzero) diff --git a/libc/arch-mips64/mips64.mk b/libc/arch-mips64/mips64.mk index 5759104..9a24c61 100644 --- a/libc/arch-mips64/mips64.mk +++ b/libc/arch-mips64/mips64.mk @@ -17,7 +17,6 @@ libc_common_src_files_mips64 := \ upstream-freebsd/lib/libc/string/wcsrchr.c \ upstream-freebsd/lib/libc/string/wmemcmp.c \ upstream-freebsd/lib/libc/string/wmemmove.c \ - upstream-openbsd/lib/libc/string/bcopy.c \ upstream-openbsd/lib/libc/string/stpcpy.c \ upstream-openbsd/lib/libc/string/stpncpy.c \ upstream-openbsd/lib/libc/string/strcat.c \ @@ -42,7 +41,6 @@ libc_common_src_files_mips64 += \ ### CPU specific source files libc_bionic_src_files_mips64 := \ arch-mips64/bionic/__bionic_clone.S \ - arch-mips64/bionic/bzero.S \ arch-mips64/bionic/_exit_with_stack_teardown.S \ arch-mips64/bionic/__get_sp.S \ arch-mips64/bionic/getdents.cpp \ diff --git a/libc/arch-x86_64/string/sse2-bcopy-slm.S b/libc/arch-x86_64/string/sse2-bcopy-slm.S deleted file mode 100644 index effab0e..0000000 --- a/libc/arch-x86_64/string/sse2-bcopy-slm.S +++ /dev/null @@ -1,33 +0,0 @@ -/* -Copyright (c) 2014, Intel Corporation -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - - * Neither the name of Intel Corporation nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define USE_AS_BCOPY -#define MEMMOVE bcopy -#include "sse2-memmove-slm.S" diff --git a/libc/arch-x86_64/string/sse2-bzero-slm.S b/libc/arch-x86_64/string/sse2-bzero-slm.S deleted file mode 100644 index 446ea5b..0000000 --- a/libc/arch-x86_64/string/sse2-bzero-slm.S +++ /dev/null @@ -1,33 +0,0 @@ -/* -Copyright (c) 2014, Intel Corporation -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - - * Neither the name of Intel Corporation nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#define USE_AS_BZERO_P -#define MEMSET bzero -#include "sse2-memset-slm.S" diff --git a/libc/arch-x86_64/x86_64.mk b/libc/arch-x86_64/x86_64.mk index c54cdb8..2f0cf2d 100644 --- a/libc/arch-x86_64/x86_64.mk +++ b/libc/arch-x86_64/x86_64.mk @@ -42,8 +42,6 @@ libc_bionic_src_files_x86_64 := \ bionic/__memcmp16.cpp \ libc_bionic_src_files_x86_64 += \ - arch-x86_64/string/sse2-bcopy-slm.S \ - arch-x86_64/string/sse2-bzero-slm.S \ arch-x86_64/string/sse2-memcpy-slm.S \ arch-x86_64/string/sse2-memmove-slm.S \ arch-x86_64/string/sse2-memset-slm.S \ diff --git a/libc/bionic/memmove.c b/libc/bionic/memmove.c index a9fc1b5..39c766e 100644 --- a/libc/bionic/memmove.c +++ b/libc/bionic/memmove.c @@ -25,22 +25,6 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -#undef _FORTIFY_SOURCE -#include <string.h> -#include <strings.h> -void *memmove(void *dst, const void *src, size_t n) -{ - const char *p = src; - char *q = dst; - /* We can use the optimized memcpy if the source and destination - * don't overlap. - */ - if (__builtin_expect(((q < p) && ((size_t)(p - q) >= n)) - || ((p < q) && ((size_t)(q - p) >= n)), 1)) { - return memcpy(dst, src, n); - } else { - bcopy(src, dst, n); - return dst; - } -} +#define MEMMOVE +#include "upstream-openbsd/lib/libc/string/bcopy.c" diff --git a/libc/include/strings.h b/libc/include/strings.h index e72798b..8f5fec5 100644 --- a/libc/include/strings.h +++ b/libc/include/strings.h @@ -43,20 +43,14 @@ #include <sys/cdefs.h> __BEGIN_DECLS -void bcopy(const void *, void *, size_t); -void bzero(void *, size_t); +#define bcopy(b1, b2, len) (void)(memmove((b2), (b1), (len))) +#define bzero(b, len) (void)(memset((b), '\0', (len))) + int ffs(int); char *index(const char *, int); int strcasecmp(const char *, const char *); int strncasecmp(const char *, const char *, size_t); -#if defined(__BIONIC_FORTIFY) -__BIONIC_FORTIFY_INLINE -void bzero (void *s, size_t n) { - __builtin___memset_chk(s, '\0', n, __builtin_object_size (s, 0)); -} -#endif /* defined(__BIONIC_FORTIFY) */ - __END_DECLS #endif /* !defined(_STRINGS_H_) */ |