forked from gentoo/portage
/
95time64_t
245 lines (206 loc) · 4.86 KB
/
95time64_t
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# Detect 32-bit builds that are using legacy 32-bit time interfaces.
# This is closely related to "Large File Support" (LFS) but not
# quite the same.
#
# We want to make sure everyone is using the 64-bit interfaces.
# https://bugs.gentoo.org/471102
#
# Lists gleaned from headers, roughly:
# `grep -rsin "#.*define" /usr/include/ | grep time | grep 64 | grep -v asm | grep -v syscalls | sort -u`
# TODO: check for icky legacy interfaces in pre-built binaries?
# obviously we can't fix them, but we can warn stuff will break.
# There are various surprising symbols in this list, like recvmsg.
# * Often, it's either quite hidden through indirection:
# e.g. https://github.com/bminor/glibc/commit/4b93a93e407308000ee6a1c3fec3715127c2c4c5
# * Or it's because there's a relationship with LFS (note that glibc
# requires LFS to be enabled for time64), like a symbol had to be fixed
# up for LFS, and then it had to be again.
SYMBOLS=(
# aio.h
aio_suspend
# bits/time.h
clock_adjtime
# fcntl.h
fcntl
fcntl64
# fts.h
fts_children
fts_close
fts_open
fts_read
fts_set
# ftw.h
ftw
nftw64
nftw
nftw64
# mqueue.h
mq_timedreceive
mq_timedsend
# netdb.h
gai_suspend
# pthread.h
pthread_cond_clockwait
pthread_clockjoin_np
pthread_timedjoin_np
pthread_mutex_clocklock
pthread_mutex_timedlock
pthread_rwlock_clockrdlock
pthread_rwlock_clockwrlock
pthread_rwlock_timedrdlock
pthread_rwlock_timedwrlock
pthread_cond_timedwait
# semaphore.h
sem_clockwait
sem_timedwait
# signal.h
sigtimedwait
# utime.h
utime
# sys/epoll.h
epoll_pwait2
# sys/ioctl.h
ioctl
# sys/msg.h
msgctl
# sys/poll.h
ppoll
# sys/sem.h
semtimedop
# sys/shm.h
shmctl
# sys/socket.h
recvmmsg
sendmmsg
getsockopt
recvmsg
sendmsg
setsockopt
# sys/stat.h
stat
fstat
stat64
fstat64
fstatat
fstatat64
lstat
utimensat
futimens
# sys/time.h
gettimeofday
settimeofday
adjtime
getitimer
setitimer
utimes
lutimes
futimes
futimesat
# sys/timerfd.h
timerfd_settime
timerfd_gettime
# sys/timex.h
adjtimex
ntp_adjtime
ntp_gettime
ntp_gettimex
# sys/wait.h
wait3
wait4
# threads.h
mtx_timedlock
cnd_timedwait
# time.h
time
difftime
mktime
gmtime
localtime
gmtime_r
ctime
ctime_r
timegm
nanosleep
clock_getres
clock_gettime
clock_settime
clock_nanosleep
timer_settime
timer_gettime
timespec_get
timespec_getres
# utime.h
utime
)
SYMBOLS_REGEX=$(printf '%s|' "${SYMBOLS[@]}")
# _r.* to allow reentrant variants
# The @@ part is to workaround a limitation in pax-utils w/versioned symbols.
SYMBOLS_REGEX="^[^_].*(${SYMBOLS_REGEX%|})(_r)?(@@.*)?$"
check_time() {
local dir="$@"
if [[ ! -d "${dir}" && -n "${ED}" ]] ; then
dir="${ED}"
fi
local files=$(scanelf -F '%p:%s' -qyRgs "-${SYMBOLS_REGEX}" "${dir}")
if [[ -n ${files} ]]; then
eqawarn "QA Notice: Some installed files are missing 64-bit time_t support!"
eqawarn " Please see https://wiki.gentoo.org/wiki/Project:Toolchain/time64_migration for details."
eqawarn "Affected files:"
eqatag -v time64.missing ${files[@]}
fi
}
filtered_check_time() {
if ! type -P scanelf >/dev/null || has binchecks ${RESTRICT}; then
return
fi
# Only check glibc & uClibc libraries. Others are presumed to use LFS by
# default (e.g. musl), or it's not relevant (e.g. newlib).
case ${CHOST} in
*-gnu*|*-uclibc*)
;;
*)
return
;;
esac
# Only check on 32-bit systems. Filtering by $ARCH here isn't perfect, but
# it should be good enough for our needs.
case ${ARCH} in
arm|mips|hppa|m68k|ppc|sh|x86)
;;
s390)
# s390x is 64-bit, but s390 is 32-bit.
# We use the same keyword for both.
if [[ ${CHOST} == s390-* ]] ; then
return
fi
;;
sparc)
# sparc and sparc64 share the same keyword.
if [[ ${CHOST} == sparc64* ]] ; then
return
fi
;;
*)
return
;;
esac
# Obviously filter out C libraries themselves :).
# The sandbox has to capture all symbols by design.
case ${CATEGORY}/${PN} in
*/glibc|*/uclibc|*/gcc|sys-apps/sandbox)
;;
*)
check_time "${ED}"
;;
esac
}
# Allow for people to run manually for testing/debugging.
if [[ $# -ne 0 ]]; then
eqawarn() { echo " * $*"; }
eqatag() { eqawarn "$@"; }
check_time "$@"
else
filtered_check_time
fi
: # guarantee successful exit
# vim:ft=sh