blob: f70b32ee29d5cc06cdad401dd94d49431fcdd034 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
|
LIBRARY()
LICENSE(
BSD-1-Clause AND
BSD-2-Clause AND
BSD-3-Clause AND
ISC
)
LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
NO_COMPILER_WARNINGS()
NO_UTIL()
NO_RUNTIME()
IF (NOT OS_WINDOWS)
SRCS(
string.c
)
ENDIF()
DISABLE(PROVIDE_GETRANDOM_GETENTROPY)
DISABLE(PROVIDE_REALLOCARRAY)
# Android libc function appearance is documented here:
# https://android.googlesource.com/platform/bionic/+/master/docs/status.md
#
# NB: nested IF's are needed due to the lack of lazy evaluation of logical statements: DEVTOOLS-7837
IF (OS_ANDROID)
SRCS(
strlcat.c
strlcpy.c
)
IF (ANDROID_API < 28)
SRCS(
glob.c
)
ENABLE(PROVIDE_GETRANDOM_GETENTROPY)
ENABLE(PROVIDE_REALLOCARRAY)
ENDIF()
IF (ANDROID_API < 24)
SRCS(
ifaddrs.c
)
ADDINCL(
GLOBAL contrib/libs/libc_compat/include/ifaddrs
)
ENDIF()
IF (ANDROID_API < 21)
SRCS(
stpcpy.c
)
ENDIF()
ENDIF()
IF (OS_WINDOWS OR OS_DARWIN OR OS_IOS)
SRCS(
memrchr.c
)
ENDIF()
IF (OS_DARWIN)
SRCS(
explicit_bzero.c
)
ENABLE(PROVIDE_REALLOCARRAY)
ENDIF()
IF (OS_WINDOWS)
ADDINCL(
GLOBAL contrib/libs/libc_compat/include/windows
)
SRCS(
explicit_bzero.c
stpcpy.c
strlcat.c
strlcpy.c
strcasestr.c
strsep.c
src/windows/sys/uio.c
)
ENABLE(PROVIDE_REALLOCARRAY)
ENDIF()
IF (OS_LINUX)
ADDINCL(
GLOBAL contrib/libs/libc_compat/include/readpassphrase
)
SRCS(
readpassphrase.c
)
ENDIF()
IF (OS_LINUX AND NOT MUSL)
IF (OS_SDK == "ubuntu-12")
ADDINCL(
# uchar.h was introduced in glibc=2.16
GLOBAL contrib/libs/libc_compat/include/uchar
)
ENDIF()
IF (OS_SDK == "ubuntu-12" OR OS_SDK == "ubuntu-14" OR OS_SDK == "ubuntu-16")
# getrandom and getentropy were added in glibc=2.25
ENABLE(PROVIDE_GETRANDOM_GETENTROPY)
SRCS(
# explicit_bzero was added in glibc=2.25
explicit_bzero.c
# memfd_create was added in glibc=2.27
memfd_create.c
)
ENDIF()
IF (OS_SDK != "ubuntu-20")
# reallocarray was added in glibc=2.29
ENABLE(PROVIDE_REALLOCARRAY)
ENDIF()
SRCS(
# glibc does not offer strlcat / strlcpy yet
strlcat.c
strlcpy.c
)
IF (SANITIZER_TYPE == "memory")
# llvm sanitized runtime is missing an interceptor for a buggy (getservbyname{_r}).
# See: https://github.com/google/sanitizers/issues/1138
ENABLE(PROVIDE_GETSERVBYNAME)
ENDIF()
ENDIF()
IF (PROVIDE_REALLOCARRAY)
SRCS(
reallocarray/reallocarray.c
)
ADDINCL(
GLOBAL contrib/libs/libc_compat/reallocarray
)
ENDIF()
IF (PROVIDE_GETRANDOM_GETENTROPY)
PEERDIR(
library/cpp/sanitizer/include
)
SRCS(
random/getrandom.c
random/getentropy.c
)
ADDINCL(
GLOBAL contrib/libs/libc_compat/random
)
ENDIF()
IF (PROVIDE_GETSERVBYNAME)
SRCS(
getservbyname/getservbyname.c
getservbyname/getservbyname_r.c
getservbyname/lookup_serv.c
)
ENDIF()
END()
|