]> git.ipfire.org Git - thirdparty/glibc.git/blame - misc/Makefile
Exclude routines from fortification
[thirdparty/glibc.git] / misc / Makefile
CommitLineData
6d7e8eda 1# Copyright (C) 1991-2023 Free Software Foundation, Inc.
28f540f4
RM
2# This file is part of the GNU C Library.
3
4# The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
5# modify it under the terms of the GNU Lesser General Public
6# License as published by the Free Software Foundation; either
7# version 2.1 of the License, or (at your option) any later version.
28f540f4
RM
8
9# The GNU C Library is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41bdb6e2 12# Lesser General Public License for more details.
28f540f4 13
41bdb6e2 14# You should have received a copy of the GNU Lesser General Public
59ba27a6 15# License along with the GNU C Library; if not, see
5a82c748 16# <https://www.gnu.org/licenses/>.
28f540f4
RM
17
18#
19# Sub-makefile for misc portion of the library.
20#
21
22subdir := misc
23
a5f891ac
JM
24include ../Makeconfig
25
20b6ae7e
CD
26headers := \
27 sys/uio.h \
28 bits/uio-ext.h \
29 bits/uio_lim.h \
30 sys/ioctl.h \
31 bits/ioctls.h \
32 bits/ioctl-types.h \
33 sys/ptrace.h \
34 sys/file.h \
35 sys/dir.h \
36 sys/cdefs.h \
37 ar.h \
38 a.out.h \
39 libgen.h \
40 stab.h \
41 bits/stab.def \
42 sgtty.h \
43 ttyent.h \
44 paths.h \
45 sys/reboot.h \
46 sys/mman.h \
47 sys/param.h \
48 bits/param.h \
49 fstab.h \
50 mntent.h \
51 search.h \
52 err.h \
53 error.h \
54 sys/queue.h \
55 sysexits.h \
56 syscall.h \
57 sys/syscall.h \
58 sys/swap.h \
59 sys/select.h \
60 sys/sysinfo.h \
61 regexp.h \
62 bits/select.h \
63 bits/mman.h \
64 sys/xattr.h \
65 syslog.h \
66 sys/syslog.h \
67 bits/syslog.h \
68 bits/syslog-ldbl.h \
69 bits/syslog-path.h \
70 bits/error.h \
71 bits/select2.h \
72 bits/hwcap.h \
73 sys/auxv.h \
74 sys/sysmacros.h \
75 bits/sysmacros.h \
76 bits/types/struct_iovec.h \
77 bits/err-ldbl.h \
78 bits/error-ldbl.h \
79 sys/single_threaded.h \
80 # headers
81
82routines := \
83 acct \
84 allocate_once \
85 atomic_wide_counter \
86 brk \
87 chflags \
88 chroot \
89 daemon \
90 dirname \
91 efgcvt \
92 efgcvt_r \
93 err \
94 error \
95 fchflags \
96 fd_to_filename \
97 fdatasync \
98 fgetxattr \
99 flistxattr \
100 fremovexattr \
101 fsetxattr \
102 fstab \
103 fsync \
104 ftruncate \
105 ftruncate64 \
106 futimes \
107 futimesat \
108 getauxval \
109 getclktck \
110 getdomain \
111 getdtsz \
112 gethostid \
113 gethostname \
114 getloadavg \
115 getpagesize \
116 getpass \
117 getsysstats \
118 getttyent \
119 getusershell \
120 getxattr \
121 gtty \
122 hsearch \
123 hsearch_r \
124 ifunc-impl-list \
125 insremque \
126 ioctl \
127 lgetxattr \
128 listxattr \
129 llistxattr \
130 lremovexattr \
131 lsearch \
132 lsetxattr \
133 lutimes \
134 madvise \
135 makedev \
136 mincore \
137 mkdtemp \
138 mkostemp \
139 mkostemp64 \
140 mkostemps \
141 mkostemps64 \
142 mkstemp \
143 mkstemp64 \
144 mkstemps \
145 mkstemps64 \
146 mktemp \
147 mlock \
148 mlockall \
149 mmap \
150 mmap64 \
151 mntent \
152 mntent_r \
153 mprotect \
154 msync \
155 munlock \
156 munlockall \
157 munmap \
158 preadv \
20b6ae7e 159 preadv2 \
21050af6 160 preadv64 \
20b6ae7e
CD
161 preadv64v2 \
162 pselect \
163 ptrace \
164 pwritev \
20b6ae7e 165 pwritev2 \
21050af6 166 pwritev64 \
20b6ae7e
CD
167 pwritev64v2 \
168 qefgcvt \
169 qefgcvt_r \
170 readv \
171 reboot \
172 regexp \
173 remap_file_pages \
174 removexattr \
175 revoke \
176 sbrk \
177 select \
178 setdomain \
179 setegid \
180 seteuid \
181 sethostid \
182 sethostname \
183 setregid \
184 setreuid \
185 setxattr \
186 single_threaded \
187 sstk \
188 stty \
189 swapoff \
190 swapon \
191 sync \
192 syncfs \
193 syscall \
194 syslog \
195 truncate \
196 truncate64 \
197 tsearch \
198 ttyslot \
199 ualarm \
200 unwind-link \
201 usleep \
202 ustat \
203 utimes \
204 vhangup \
205 writev \
206 # routines
20c894d2
FB
207
208# Exclude fortified routines from being built with _FORTIFY_SOURCE
209routines_no_fortify += \
210 getdomain \
211 gethostname \
212 syslog \
213 # routines_no_fortify
20b6ae7e
CD
214
215generated += \
216 tst-allocate_once-mem.out \
217 tst-allocate_once.mtrace \
218 tst-error1-mem.out \
219 tst-error1.mtrace \
220 # generated
10ffcd52 221
bbed653c 222aux := init-misc
029c7b25 223install-lib := libg.a
28f540f4 224
20b6ae7e
CD
225gpl2lgpl := \
226 error.c \
227 error.h \
228 # gpl2lgpl
229
230tests := \
231 bug-hsearch1 \
232 bug18240 \
233 tst-dbl-efgcvt \
234 tst-dirname \
235 tst-empty \
236 tst-error1 \
237 tst-fdset \
238 tst-hsearch \
239 tst-insremque \
240 tst-ioctl \
241 tst-ldbl-efgcvt \
242 tst-ldbl-error \
243 tst-ldbl-errorfptr \
244 tst-ldbl-warn \
245 tst-makedev \
246 tst-mntent \
247 tst-mntent-autofs \
248 tst-mntent-blank-corrupt \
249 tst-mntent-blank-passno \
250 tst-mntent-escape \
251 tst-mntent2 \
252 tst-preadvwritev \
20b6ae7e 253 tst-preadvwritev2 \
21050af6 254 tst-preadvwritev64 \
20b6ae7e
CD
255 tst-preadvwritev64v2 \
256 tst-pselect \
257 tst-select \
258 tst-syscalls \
259 tst-tsearch \
260 tst-warn-wide \
261 # tests
7c3018f9 262
088d3291 263tests-time64 := \
82c395d9 264 tst-ioctl-time64 \
20b6ae7e
CD
265 tst-pselect-time64 \
266 tst-select-time64 \
82c395d9 267 # tests-time64
088d3291 268
db9a8ad4
FW
269# Tests which need libdl.
270ifeq (yes,$(build-shared))
271tests += tst-gethostid
272endif
273
20b6ae7e
CD
274tests-internal := \
275 tst-allocate_once \
276 tst-atomic \
277 tst-atomic-long \
278 # tests-internal
2908885c
NA
279tests-static := tst-empty
280
fa185f0d
FW
281# Test for the internal, non-exported __fd_to_filename function.
282tests-internal += tst-fd_to_filename
283tests-static += tst-fd_to_filename
284
03ac099f 285ifeq ($(run-built-tests),yes)
5f7b841d
FW
286tests-special += $(objpfx)tst-error1-mem.out \
287 $(objpfx)tst-allocate_once-mem.out
10ffcd52 288endif
1474b80f 289
096c2768
AZ
290tests-container := tst-syslog
291
36975e8e
L
292CFLAGS-select.c += -fexceptions -fasynchronous-unwind-tables
293CFLAGS-tsearch.c += $(uses-callbacks)
294CFLAGS-lsearch.c += $(uses-callbacks)
295CFLAGS-pselect.c += -fexceptions
296CFLAGS-readv.c += -fexceptions -fasynchronous-unwind-tables
297CFLAGS-writev.c += -fexceptions -fasynchronous-unwind-tables
298CFLAGS-preadv.c += -fexceptions -fasynchronous-unwind-tables
299CFLAGS-preadv64.c += -fexceptions -fasynchronous-unwind-tables
300CFLAGS-pwritev.c += -fexceptions -fasynchronous-unwind-tables
301CFLAGS-pwritev64.c += -fexceptions -fasynchronous-unwind-tables
302CFLAGS-preadv2.c += -fexceptions -fasynchronous-unwind-tables
303CFLAGS-preadv64v2.c += -fexceptions -fasynchronous-unwind-tables
304CFLAGS-pwritev2.c += -fexceptions -fasynchronous-unwind-tables
305CFLAGS-pwritev64v2.c += -fexceptions -fasynchronous-unwind-tables
306CFLAGS-usleep.c += -fexceptions
307CFLAGS-syslog.c += -fexceptions
308CFLAGS-error.c += -fexceptions
309CFLAGS-getpass.c += -fexceptions
310CFLAGS-mkstemp.c += -fexceptions
311CFLAGS-mkstemp64.c += -fexceptions
312CFLAGS-getsysstats.c += -fexceptions
313CFLAGS-getusershell.c += -fexceptions
314CFLAGS-err.c += -fexceptions
315CFLAGS-tst-tsearch.c += $(stack-align-test-flags)
316CFLAGS-msync.c += -fexceptions -fasynchronous-unwind-tables
317CFLAGS-fdatasync.c += -fexceptions -fasynchronous-unwind-tables
318CFLAGS-fsync.c += -fexceptions -fasynchronous-unwind-tables
8d98c7c0
AZ
319CFLAGS-makedev.c += $(config-cflags-wno-ignored-attributes)
320CFLAGS-mmap64.c += $(config-cflags-wno-ignored-attributes)
dff14448 321
10c85e76
NA
322# Called during static library initialization, so turn stack-protection
323# off for non-shared builds.
324CFLAGS-sbrk.o = $(no-stack-protector)
325CFLAGS-sbrk.op = $(no-stack-protector)
326CFLAGS-brk.o = $(no-stack-protector)
327CFLAGS-brk.op = $(no-stack-protector)
ff3cb03f
SL
328CFLAGS-mmap.o = $(no-stack-protector)
329CFLAGS-mmap.op = $(no-stack-protector)
330CFLAGS-mmap64.o = $(no-stack-protector)
331CFLAGS-mmap64.op = $(no-stack-protector)
10c85e76 332
28f540f4
RM
333include ../Rules
334
28f540f4 335$(objpfx)libg.a: $(dep-dummy-lib); $(make-dummy-lib)
b236e99d 336
79520f4b 337$(objpfx)tst-tsearch: $(libm)
e64911d1 338
2d2d9f2b
SP
339tst-error1-ENV = MALLOC_TRACE=$(objpfx)tst-error1.mtrace \
340 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
10ffcd52 341tst-error1-ARGS = $(objpfx)tst-error1.out
0b20a9e8 342$(objpfx)tst-error1-mem.out: $(objpfx)tst-error1.out
f0881698
JM
343 $(common-objpfx)malloc/mtrace $(objpfx)tst-error1.mtrace > $@; \
344 $(evaluate-test)
5f7b841d 345
2d2d9f2b
SP
346tst-allocate_once-ENV = MALLOC_TRACE=$(objpfx)tst-allocate_once.mtrace \
347 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
5f7b841d
FW
348$(objpfx)tst-allocate_once-mem.out: $(objpfx)tst-allocate_once.out
349 $(common-objpfx)malloc/mtrace $(objpfx)tst-allocate_once.mtrace > $@; \
350 $(evaluate-test)
91cf411a 351
4c3df0eb
AZ
352$(objpfx)tst-select: $(librt)
353$(objpfx)tst-select-time64: $(librt)
91cf411a
AZ
354$(objpfx)tst-pselect: $(librt)
355$(objpfx)tst-pselect-time64: $(librt)