blob: 0925c5f6dafe25b1dbf5875fd21c086c5695d51e [file] [log] [blame]
Yun Hsiang40a82d02023-05-26 10:10:40 +08001/*
2 * Copyright (C) 2023 The Android Open Source Project
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in
12 * the documentation and/or other materials provided with the
13 * distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
18 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
29#include <private/bionic_ifuncs.h>
30#include <stddef.h>
31#include <sys/auxv.h>
32
33#if defined(__riscv_v)
34extern "C" {
35
36typedef void* memchr_func(const void*, int, size_t);
37DEFINE_IFUNC_FOR(memchr) {
38 RETURN_FUNC(memchr_func, memchr_vext);
39}
40
41typedef int memcmp_func(const void*, const void*, size_t);
42DEFINE_IFUNC_FOR(memcmp) {
43 RETURN_FUNC(memcmp_func, memcmp_vext);
44}
45
46typedef void* memcpy_func(void*, const void*, size_t);
47DEFINE_IFUNC_FOR(memcpy) {
48 RETURN_FUNC(memcpy_func, memcpy_vext);
49}
50
51typedef void* memmove_func(void*, const void*, size_t);
52DEFINE_IFUNC_FOR(memmove) {
53 RETURN_FUNC(memmove_func, memmove_vext);
54}
55
56typedef void* memset_func(void*, int, size_t);
57DEFINE_IFUNC_FOR(memset) {
58 RETURN_FUNC(memset_func, memset_vext);
59}
60
61typedef char* strcat_func(char*, const char*);
62DEFINE_IFUNC_FOR(strcat) {
63 RETURN_FUNC(strcat_func, strcat_vext);
64}
65
66typedef char* strchr_func(const char*, int);
67DEFINE_IFUNC_FOR(strchr) {
68 RETURN_FUNC(strchr_func, strchr_vext);
69}
70
71typedef int strcmp_func(const char*, const char*);
72DEFINE_IFUNC_FOR(strcmp) {
73 RETURN_FUNC(strcmp_func, strcmp_vext);
74}
75
76typedef char* strcpy_func(char*, const char*);
77DEFINE_IFUNC_FOR(strcpy) {
78 RETURN_FUNC(strcpy_func, strcpy_vext);
79}
80
81typedef size_t strlen_func(const char*);
82DEFINE_IFUNC_FOR(strlen) {
83 RETURN_FUNC(strlen_func, strlen_vext);
84}
85
86typedef char* strncat_func(char*, const char*, size_t);
87DEFINE_IFUNC_FOR(strncat) {
88 RETURN_FUNC(strncat_func, strncat_vext);
89}
90
91typedef int strncmp_func(const char*, const char*, size_t);
92DEFINE_IFUNC_FOR(strncmp) {
93 RETURN_FUNC(strncmp_func, strncmp_vext);
94}
95
96typedef char* strncpy_func(char*, const char*, size_t);
97DEFINE_IFUNC_FOR(strncpy) {
98 RETURN_FUNC(strncpy_func, strncpy_vext);
99}
100
101typedef size_t strnlen_func(const char*, size_t);
102DEFINE_IFUNC_FOR(strnlen) {
103 RETURN_FUNC(strnlen_func, strnlen_vext);
104}
105
106} // extern "C"
107#endif