forked from include-what-you-use/include-what-you-use
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gcc.libc.imp
205 lines (205 loc) · 14.1 KB
/
gcc.libc.imp
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
# Mappings for GNU libc
# ( cd /usr/include && grep '^ *# *include' {sys/,net/,}* | perl -nle 'm/^([^:]+).*<([^>]+)>/ && print qq@ { include: [ "<$2>", private, "<$1>", public ] },@' | grep bits/ | sort )
# When I saw more than one mapping for these, I typically picked
# what I thought was the "best" one.
[
{ include: [ "<bits/a.out.h>", private, "<a.out.h>", public ] },
{ include: [ "<bits/auxv.h>", private, "<sys/auxv.h>", public ] },
{ include: [ "<bits/byteswap.h>", private, "<byteswap.h>", public ] },
{ include: [ "<bits/cmathcalls.h>", private, "<complex.h>", public ] },
{ include: [ "<bits/confname.h>", private, "<unistd.h>", public ] },
{ include: [ "<bits/dirent.h>", private, "<dirent.h>", public ] },
{ include: [ "<bits/dlfcn.h>", private, "<dlfcn.h>", public ] },
{ include: [ "<bits/elfclass.h>", private, "<link.h>", public ] },
{ include: [ "<bits/endian.h>", private, "<endian.h>", public ] },
{ include: [ "<bits/environments.h>", private, "<unistd.h>", public ] },
{ include: [ "<bits/epoll.h>", private, "<sys/epoll.h>", public ] },
{ include: [ "<bits/errno.h>", private, "<errno.h>", public ] },
{ include: [ "<bits/error.h>", private, "<error.h>", public ] },
{ include: [ "<bits/eventfd.h>", private, "<sys/eventfd.h>", public ] },
{ include: [ "<bits/fcntl.h>", private, "<fcntl.h>", public ] },
{ include: [ "<bits/fcntl2.h>", private, "<fcntl.h>", public ] },
{ include: [ "<bits/fenv.h>", private, "<fenv.h>", public ] },
{ include: [ "<bits/fenvinline.h>", private, "<fenv.h>", public ] },
{ include: [ "<bits/huge_val.h>", private, "<math.h>", public ] },
{ include: [ "<bits/huge_valf.h>", private, "<math.h>", public ] },
{ include: [ "<bits/huge_vall.h>", private, "<math.h>", public ] },
{ include: [ "<bits/hwcap.h>", private, "<sys/auxv.h>", public ] },
{ include: [ "<bits/inf.h>", private, "<math.h>", public ] },
{ include: [ "<bits/inotify.h>", private, "<sys/inotify.h>", public ] },
{ include: [ "<bits/ioctl-types.h>", private, "<sys/ioctl.h>", public ] },
{ include: [ "<bits/ioctls.h>", private, "<sys/ioctl.h>", public ] },
{ include: [ "<bits/ipc.h>", private, "<sys/ipc.h>", public ] },
{ include: [ "<bits/ipctypes.h>", private, "<sys/ipc.h>", public ] },
{ include: [ "<bits/libio-ldbl.h>", private, "<libio.h>", public ] },
{ include: [ "<bits/link.h>", private, "<link.h>", public ] },
{ include: [ "<bits/locale.h>", private, "<locale.h>", public ] },
{ include: [ "<bits/math-finite.h>", private, "<math.h>", public ] },
{ include: [ "<bits/mathcalls.h>", private, "<math.h>", public ] },
{ include: [ "<bits/mathdef.h>", private, "<math.h>", public ] },
{ include: [ "<bits/mathinline.h>", private, "<math.h>", public ] },
{ include: [ "<bits/mman.h>", private, "<sys/mman.h>", public ] },
{ include: [ "<bits/monetary-ldbl.h>", private, "<monetary.h>", public ] },
{ include: [ "<bits/mqueue.h>", private, "<mqueue.h>", public ] },
{ include: [ "<bits/mqueue2.h>", private, "<mqueue.h>", public ] },
{ include: [ "<bits/msq.h>", private, "<sys/msg.h>", public ] },
{ include: [ "<bits/nan.h>", private, "<math.h>", public ] },
{ include: [ "<bits/netdb.h>", private, "<netdb.h>", public ] },
{ include: [ "<bits/param.h>", private, "<sys/param.h>", public ] },
{ include: [ "<bits/poll.h>", private, "<sys/poll.h>", private ] },
{ include: [ "<bits/poll2.h>", private, "<sys/poll.h>", private ] },
{ include: [ "<bits/posix1_lim.h>", private, "<limits.h>", public ] },
{ include: [ "<bits/posix2_lim.h>", private, "<limits.h>", public ] },
{ include: [ "<bits/posix_opt.h>", private, "<unistd.h>", public ] },
{ include: [ "<bits/printf-ldbl.h>", private, "<printf.h>", public ] },
{ include: [ "<bits/pthreadtypes.h>", private, "<pthread.h>", public ] },
{ include: [ "<bits/resource.h>", private, "<sys/resource.h>", public ] },
{ include: [ "<bits/sched.h>", private, "<sched.h>", public ] },
{ include: [ "<bits/select.h>", private, "<sys/select.h>", public ] },
{ include: [ "<bits/select2.h>", private, "<sys/select.h>", public ] },
{ include: [ "<bits/sem.h>", private, "<sys/sem.h>", public ] },
{ include: [ "<bits/semaphore.h>", private, "<semaphore.h>", public ] },
{ include: [ "<bits/setjmp.h>", private, "<setjmp.h>", public ] },
{ include: [ "<bits/setjmp2.h>", private, "<setjmp.h>", public ] },
{ include: [ "<bits/shm.h>", private, "<sys/shm.h>", public ] },
{ include: [ "<bits/sigaction.h>", private, "<signal.h>", public ] },
{ include: [ "<bits/sigcontext.h>", private, "<signal.h>", public ] },
{ include: [ "<bits/siginfo.h>", private, "<signal.h>", public ] },
{ include: [ "<bits/signum.h>", private, "<signal.h>", public ] },
{ include: [ "<bits/sigset.h>", private, "<signal.h>", public ] },
{ include: [ "<bits/sigstack.h>", private, "<signal.h>", public ] },
{ include: [ "<bits/sigthread.h>", private, "<signal.h>", public ] },
{ include: [ "<bits/sockaddr.h>", private, "<sys/un.h>", public ] },
{ include: [ "<bits/socket.h>", private, "<sys/socket.h>", public ] },
{ include: [ "<bits/socket2.h>", private, "<sys/socket.h>", public ] },
{ include: [ "<bits/socket_type.h>", private, "<sys/socket.h>", public ] },
{ include: [ "<bits/stab.def>", private, "<stab.h>", public ] },
{ include: [ "<bits/stat.h>", private, "<sys/stat.h>", public ] },
{ include: [ "<bits/statfs.h>", private, "<sys/statfs.h>", public ] },
{ include: [ "<bits/statvfs.h>", private, "<sys/statvfs.h>", public ] },
{ include: [ "<bits/stdio-ldbl.h>", private, "<stdio.h>", public ] },
{ include: [ "<bits/stdio-lock.h>", private, "<libio.h>", public ] },
{ include: [ "<bits/stdio.h>", private, "<stdio.h>", public ] },
{ include: [ "<bits/stdio2.h>", private, "<stdio.h>", public ] },
{ include: [ "<bits/stdio_lim.h>", private, "<stdio.h>", public ] },
{ include: [ "<bits/stdlib-bsearch.h>", private, "<stdlib.h>", public ] },
{ include: [ "<bits/stdlib-float.h>", private, "<stdlib.h>", public ] },
{ include: [ "<bits/stdlib-ldbl.h>", private, "<stdlib.h>", public ] },
{ include: [ "<bits/stdlib.h>", private, "<stdlib.h>", public ] },
{ include: [ "<bits/string.h>", private, "<string.h>", public ] },
{ include: [ "<bits/string2.h>", private, "<string.h>", public ] },
{ include: [ "<bits/string3.h>", private, "<string.h>", public ] },
{ include: [ "<bits/stropts.h>", private, "<stropts.h>", public ] },
{ include: [ "<bits/sys_errlist.h>", private, "<stdio.h>", public ] },
{ include: [ "<bits/syscall.h>", private, "<sys/syscall.h>", private ] },
{ include: [ "<bits/sysctl.h>", private, "<sys/sysctl.h>", public ] },
{ include: [ "<bits/syslog-ldbl.h>", private, "<sys/syslog.h>", private ] },
{ include: [ "<bits/syslog-path.h>", private, "<sys/syslog.h>", private ] },
{ include: [ "<bits/syslog.h>", private, "<sys/syslog.h>", private ] },
{ include: [ "<bits/termios.h>", private, "<termios.h>", public ] },
{ include: [ "<bits/time.h>", private, "<sys/time.h>", public ] },
{ include: [ "<bits/timerfd.h>", private, "<sys/timerfd.h>", public ] },
{ include: [ "<bits/timex.h>", private, "<sys/timex.h>", public ] },
{ include: [ "<bits/types.h>", private, "<sys/types.h>", public ] },
{ include: [ "<bits/uio.h>", private, "<sys/uio.h>", public ] },
{ include: [ "<bits/unistd.h>", private, "<unistd.h>", public ] },
{ include: [ "<bits/ustat.h>", private, "<sys/ustat.h>", private ] },
{ include: [ "<bits/utmp.h>", private, "<utmp.h>", public ] },
{ include: [ "<bits/utmpx.h>", private, "<utmpx.h>", public ] },
{ include: [ "<bits/utsname.h>", private, "<sys/utsname.h>", public ] },
{ include: [ "<bits/waitflags.h>", private, "<sys/wait.h>", public ] },
{ include: [ "<bits/waitstatus.h>", private, "<sys/wait.h>", public ] },
{ include: [ "<bits/wchar-ldbl.h>", private, "<wchar.h>", public ] },
{ include: [ "<bits/wchar.h>", private, "<wchar.h>", public ] },
{ include: [ "<bits/wchar2.h>", private, "<wchar.h>", public ] },
{ include: [ "<bits/wordsize.h>", private, "<limits.h>", public ] },
{ include: [ "<bits/xopen_lim.h>", private, "<limits.h>", public ] },
{ include: [ "<bits/xtitypes.h>", private, "<stropts.h>", public ] },
# Sometimes libc tells you what mapping to do via an '#error':
# # error "Never use <bits/dlfcn.h> directly; include <dlfcn.h> instead."
# or
# # error "Never include <bits/socket_type.h> directly; use <sys/socket.h> instead."
# ( cd /usr/include && grep -R '^ *# *error "Never use\|include' * | perl -nle 'm/<([^>]+).*directly.*<([^>]+)/ && print qq@ { include: [ "<$1>", private, "<$2>", public ] },@' | sort )
{ include: [ "<bits/a.out.h>", private, "<a.out.h>", public ] },
{ include: [ "<bits/byteswap-16.h>", private, "<byteswap.h>", public ] },
{ include: [ "<bits/byteswap.h>", private, "<byteswap.h>", public ] },
{ include: [ "<bits/cmathcalls.h>", private, "<complex.h>", public ] },
{ include: [ "<bits/confname.h>", private, "<unistd.h>", public ] },
{ include: [ "<bits/dirent.h>", private, "<dirent.h>", public ] },
{ include: [ "<bits/dlfcn.h>", private, "<dlfcn.h>", public ] },
{ include: [ "<bits/elfclass.h>", private, "<link.h>", public ] },
{ include: [ "<bits/endian.h>", private, "<endian.h>", public ] },
{ include: [ "<bits/epoll.h>", private, "<sys/epoll.h>", public ] },
{ include: [ "<bits/eventfd.h>", private, "<sys/eventfd.h>", public ] },
{ include: [ "<bits/fcntl-linux.h>", private, "<fcntl.h>", public ] },
{ include: [ "<bits/fcntl.h>", private, "<fcntl.h>", public ] },
{ include: [ "<bits/fenv.h>", private, "<fenv.h>", public ] },
{ include: [ "<bits/huge_val.h>", private, "<math.h>", public ] },
{ include: [ "<bits/huge_valf.h>", private, "<math.h>", public ] },
{ include: [ "<bits/huge_vall.h>", private, "<math.h>", public ] },
{ include: [ "<bits/in.h>", private, "<netinet/in.h>", public ] },
{ include: [ "<bits/inf.h>", private, "<math.h>", public ] },
{ include: [ "<bits/inotify.h>", private, "<sys/inotify.h>", public ] },
{ include: [ "<bits/ioctl-types.h>", private, "<sys/ioctl.h>", public ] },
{ include: [ "<bits/ioctls.h>", private, "<sys/ioctl.h>", public ] },
{ include: [ "<bits/ipc.h>", private, "<sys/ipc.h>", public ] },
{ include: [ "<bits/ipctypes.h>", private, "<sys/ipc.h>", public ] },
{ include: [ "<bits/locale.h>", private, "<locale.h>", public ] },
{ include: [ "<bits/math-finite.h>", private, "<math.h>", public ] },
{ include: [ "<bits/mathdef.h>", private, "<math.h>", public ] },
{ include: [ "<bits/mathinline.h>", private, "<math.h>", public ] },
{ include: [ "<bits/mman-linux.h>", private, "<sys/mman.h>", public ] },
{ include: [ "<bits/mman.h>", private, "<sys/mman.h>", public ] },
{ include: [ "<bits/mqueue.h>", private, "<mqueue.h>", public ] },
{ include: [ "<bits/msq.h>", private, "<sys/msg.h>", public ] },
{ include: [ "<bits/nan.h>", private, "<math.h>", public ] },
{ include: [ "<bits/param.h>", private, "<sys/param.h>", public ] },
{ include: [ "<bits/poll.h>", private, "<sys/poll.h>", private ] },
{ include: [ "<bits/predefs.h>", private, "<features.h>", public ] },
{ include: [ "<bits/resource.h>", private, "<sys/resource.h>", public ] },
{ include: [ "<bits/select.h>", private, "<sys/select.h>", public ] },
{ include: [ "<bits/semaphore.h>", private, "<semaphore.h>", public ] },
{ include: [ "<bits/sigcontext.h>", private, "<signal.h>", public ] },
{ include: [ "<bits/signalfd.h>", private, "<sys/signalfd.h>", public ] },
{ include: [ "<bits/stdlib-float.h>", private, "<stdlib.h>", public ] },
{ include: [ "<bits/string.h>", private, "<string.h>", public ] },
{ include: [ "<bits/string2.h>", private, "<string.h>", public ] },
{ include: [ "<bits/string3.h>", private, "<string.h>", public ] },
{ include: [ "<bits/syscall.h>", private, "<sys/syscall.h>", private ] },
{ include: [ "<bits/timerfd.h>", private, "<sys/timerfd.h>", public ] },
{ include: [ "<bits/typesizes.h>", private, "<sys/types.h>", public ] },
# Top-level #includes that just forward to another file:
# $ for i in /usr/include/*; do [ -f $i ] } && [ `wc -l < $i` = 1 ] } && echo $i; done
# (poll.h, syscall.h, syslog.h, ustat.h, wait.h).
# For each file, I looked at the list of canonical header files --
# http://www.opengroup.org/onlinepubs/9699919799/idx/head.html --
# to decide which of the two files is canonical. If neither is
# on the POSIX.1 1998 list, I just choose the top-level one.
{ include: [ "<sys/poll.h>", private, "<poll.h>", public ] },
{ include: [ "<sys/syscall.h>", private, "<syscall.h>", public ] },
{ include: [ "<sys/syslog.h>", private, "<syslog.h>", public ] },
{ include: [ "<sys/ustat.h>", private, "<ustat.h>", public ] },
{ include: [ "<wait.h>", private, "<sys/wait.h>", public ] },
# These are all files in bits/ that delegate to asm/ and linux/ to
# do all (or lots) of the work. Note these are private->private.
# $ for i in /usr/include/bits/*; do for dir in asm linux; do grep -H -e $dir/`basename $i` $i; done; done
{ include: [ "<linux/errno.h>", private, "<bits/errno.h>", private ] },
{ include: [ "<asm/ioctls.h>", private, "<bits/ioctls.h>", private ] },
{ include: [ "<asm/socket.h>", private, "<bits/socket.h>", private ] },
{ include: [ "<linux/socket.h>", private, "<bits/socket.h>", private ] },
# Some asm files have 32- and 64-bit variants:
# $ ls /usr/include/asm/*_{32,64}.h
{ include: [ "<asm/posix_types_32.h>", private, "<asm/posix_types.h>", public ] },
{ include: [ "<asm/posix_types_64.h>", private, "<asm/posix_types.h>", public ] },
{ include: [ "<asm/unistd_32.h>", private, "<asm/unistd.h>", private ] },
{ include: [ "<asm/unistd_64.h>", private, "<asm/unistd.h>", private ] },
# I don't know what grep would have found these. I found them
# via user report.
{ include: [ "<asm/errno.h>", private, "<errno.h>", public ] },
{ include: [ "<asm/errno-base.h>", private, "<errno.h>", public ] },
{ include: [ "<asm/ptrace-abi.h>", private, "<asm/ptrace.h>", public ] },
{ include: [ "<asm/unistd.h>", private, "<syscall.h>", public ] },
{ include: [ "<linux/limits.h>", private, "<limits.h>", public ] }, # PATH_MAX
{ include: [ "<linux/prctl.h>", private, "<sys/prctl.h>", public ] },
{ include: [ "<sys/ucontext.h>", private, "<ucontext.h>", public ] },
]