]> sourceware.org Git - glibc.git/blame - debug/Makefile
Link extra-libs consistently with libc and ld.so.
[glibc.git] / debug / Makefile
CommitLineData
568035b7 1# Copyright (C) 1998-2013 Free Software Foundation, Inc.
2de7874e
UD
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.
2de7874e
UD
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.
2de7874e 13
41bdb6e2 14# You should have received a copy of the GNU Lesser General Public
59ba27a6
PE
15# License along with the GNU C Library; if not, see
16# <http://www.gnu.org/licenses/>.
2de7874e
UD
17
18#
19# Sub-makefile for debug portion of the library.
20#
21subdir := debug
22
23headers := execinfo.h
24
ee586a6d
RM
25# Note that ptsname_r_chk and getlogin_r are not here, but in
26# login/Makefile instead. If that subdir is omitted from the
27# build, its _FORTIFY_SOURCE support will be too.
61062f56 28routines = backtrace backtracesyms backtracesymsfd noophooks \
b5cc329c 29 memcpy_chk memmove_chk mempcpy_chk memset_chk stpcpy_chk \
8215c9ec 30 strcat_chk strcpy_chk strncat_chk strncpy_chk stpncpy_chk \
b5cc329c
UD
31 sprintf_chk vsprintf_chk snprintf_chk vsnprintf_chk \
32 printf_chk fprintf_chk vprintf_chk vfprintf_chk \
553cc5f9
UD
33 gets_chk chk_fail readonly-area fgets_chk fgets_u_chk \
34 read_chk pread_chk pread64_chk recv_chk recvfrom_chk \
a346370d 35 readlink_chk readlinkat_chk getwd_chk getcwd_chk \
bd9ffde6 36 realpath_chk fread_chk fread_u_chk \
8215c9ec
UD
37 wctomb_chk wcscpy_chk wmemcpy_chk wmemmove_chk wmempcpy_chk \
38 wcpcpy_chk wcsncpy_chk wcscat_chk wcsncat_chk wmemset_chk \
39 wcpncpy_chk \
40 swprintf_chk vswprintf_chk wprintf_chk fwprintf_chk \
41 vwprintf_chk vfwprintf_chk fgetws_chk fgetws_u_chk \
ee586a6d 42 confstr_chk getgroups_chk ttyname_r_chk \
df6f8969 43 gethostname_chk getdomainname_chk wcrtomb_chk mbsnrtowcs_chk \
02ca3541 44 wcsnrtombs_chk mbsrtowcs_chk wcsrtombs_chk mbstowcs_chk \
dff37515
UD
45 wcstombs_chk asprintf_chk vasprintf_chk dprintf_chk \
46 vdprintf_chk obprintf_chk \
b50f8e42 47 longjmp_chk ____longjmp_chk \
d9a216c0 48 fdelt_chk poll_chk ppoll_chk \
ddfd0535 49 stack_chk_fail fortify_fail \
61062f56 50 $(static-only-routines)
35f1e827 51static-only-routines := warning-nop stack_chk_fail_local
2de7874e
UD
52
53CFLAGS-backtrace.c = -fno-omit-frame-pointer
c75ccd4c
RM
54CFLAGS-sprintf_chk.c = $(libio-mtsafe)
55CFLAGS-snprintf_chk.c = $(libio-mtsafe)
56CFLAGS-vsprintf_chk.c = $(libio-mtsafe)
57CFLAGS-vsnprintf_chk.c = $(libio-mtsafe)
58CFLAGS-asprintf_chk.c = $(libio-mtsafe)
59CFLAGS-vasprintf_chk.c = $(libio-mtsafe)
60CFLAGS-obprintf_chk.c = $(libio-mtsafe)
61CFLAGS-dprintf_chk.c = $(libio-mtsafe) $(exceptions)
62CFLAGS-vdprintf_chk.c = $(libio-mtsafe) $(exceptions)
63CFLAGS-printf_chk.c = $(libio-mtsafe) $(exceptions)
64CFLAGS-fprintf_chk.c = $(libio-mtsafe) $(exceptions)
65CFLAGS-vprintf_chk.c = $(libio-mtsafe) $(exceptions)
66CFLAGS-vfprintf_chk.c = $(libio-mtsafe) $(exceptions)
67CFLAGS-gets_chk.c = $(libio-mtsafe) $(exceptions)
68CFLAGS-fgets_chk.c = $(libio-mtsafe) $(exceptions)
69CFLAGS-fgets_u_chk.c = $(libio-mtsafe) $(exceptions)
70CFLAGS-fread_chk.c = $(libio-mtsafe) $(exceptions)
71CFLAGS-fread_u_chk.c = $(libio-mtsafe) $(exceptions)
72CFLAGS-swprintf_chk.c = $(libio-mtsafe)
73CFLAGS-vswprintf_chk.c = $(libio-mtsafe)
74CFLAGS-wprintf_chk.c = $(libio-mtsafe) $(exceptions)
75CFLAGS-fwprintf_chk.c = $(libio-mtsafe) $(exceptions)
76CFLAGS-vwprintf_chk.c = $(libio-mtsafe) $(exceptions)
77CFLAGS-vfwprintf_chk.c = $(libio-mtsafe) $(exceptions)
78CFLAGS-fgetws_chk.c = $(libio-mtsafe) $(exceptions)
79CFLAGS-fgetws_u_chk.c = $(libio-mtsafe) $(exceptions)
553cc5f9
UD
80CFLAGS-read_chk.c = -fexceptions -fasynchronous-unwind-tables
81CFLAGS-pread_chk.c = -fexceptions -fasynchronous-unwind-tables
82CFLAGS-pread64_chk.c = -fexceptions -fasynchronous-unwind-tables
83CFLAGS-recv_chk.c = -fexceptions -fasynchronous-unwind-tables
84CFLAGS-recvfrom_chk.c = -fexceptions -fasynchronous-unwind-tables
fed806c3
MF
85
86# Need to make sure the settings here override what configure might have
87# set up for us, so keep the CFLAGS/CPPFLAGS split logical as the order is:
88# <user CFLAGS> <test CFLAGS> <user CPPFLAGS> <test CPPFLAGS>
89CFLAGS-tst-longjmp_chk.c = -fexceptions -fasynchronous-unwind-tables
90CPPFLAGS-tst-longjmp_chk.c = -D_FORTIFY_SOURCE=1
91CFLAGS-tst-longjmp_chk2.c = -fexceptions -fasynchronous-unwind-tables
92CPPFLAGS-tst-longjmp_chk2.c = -D_FORTIFY_SOURCE=1
2de7874e 93
7a344d1d
UD
94# We know these tests have problems with format strings, this is what
95# we are testing. Disable that warning.
96CFLAGS-tst-chk1.c = -Wno-format
97CFLAGS-tst-chk2.c = -Wno-format
98CFLAGS-tst-chk3.c = -Wno-format
de1c3ebb
UD
99CFLAGS-tst-chk4.cc = -Wno-format
100CFLAGS-tst-chk5.cc = -Wno-format
101CFLAGS-tst-chk6.cc = -Wno-format
102CFLAGS-tst-lfschk1.c = -Wno-format
103CFLAGS-tst-lfschk2.c = -Wno-format
104CFLAGS-tst-lfschk3.c = -Wno-format
105CFLAGS-tst-lfschk4.cc = -Wno-format
106CFLAGS-tst-lfschk5.cc = -Wno-format
107CFLAGS-tst-lfschk6.cc = -Wno-format
5852d1e5
AJ
108tst-chk1-ENV = LOCPATH=$(common-objpfx)localedata
109tst-chk2-ENV = LOCPATH=$(common-objpfx)localedata
110tst-chk3-ENV = LOCPATH=$(common-objpfx)localedata
de1c3ebb
UD
111tst-chk4-ENV = LOCPATH=$(common-objpfx)localedata
112tst-chk5-ENV = LOCPATH=$(common-objpfx)localedata
113tst-chk6-ENV = LOCPATH=$(common-objpfx)localedata
5852d1e5
AJ
114tst-lfschk1-ENV = LOCPATH=$(common-objpfx)localedata
115tst-lfschk2-ENV = LOCPATH=$(common-objpfx)localedata
116tst-lfschk3-ENV = LOCPATH=$(common-objpfx)localedata
de1c3ebb
UD
117tst-lfschk4-ENV = LOCPATH=$(common-objpfx)localedata
118tst-lfschk5-ENV = LOCPATH=$(common-objpfx)localedata
119tst-lfschk6-ENV = LOCPATH=$(common-objpfx)localedata
5ca78dd0
L
120LDLIBS-tst-chk4 = -lstdc++
121LDLIBS-tst-chk5 = -lstdc++
122LDLIBS-tst-chk6 = -lstdc++
123LDLIBS-tst-lfschk4 = -lstdc++
124LDLIBS-tst-lfschk5 = -lstdc++
125LDLIBS-tst-lfschk6 = -lstdc++
5852d1e5 126
31d470ac
JM
127# backtrace_symbols only works if we link with -rdynamic. backtrace
128# requires unwind tables on most architectures.
129CFLAGS-tst-backtrace2.c += -funwind-tables
130CFLAGS-tst-backtrace3.c += -funwind-tables
131CFLAGS-tst-backtrace4.c += -funwind-tables
132CFLAGS-tst-backtrace5.c += -funwind-tables
133LDFLAGS-tst-backtrace2 = -rdynamic
134LDFLAGS-tst-backtrace3 = -rdynamic
135LDFLAGS-tst-backtrace4 = -rdynamic
136LDFLAGS-tst-backtrace5 = -rdynamic
137
b50f8e42 138tests = backtrace-tst tst-longjmp_chk tst-chk1 tst-chk2 tst-chk3 \
de1c3ebb 139 tst-lfschk1 tst-lfschk2 tst-lfschk3 test-strcpy_chk test-stpcpy_chk \
a9a04420 140 tst-chk4 tst-chk5 tst-chk6 tst-lfschk4 tst-lfschk5 tst-lfschk6 \
31d470ac
JM
141 tst-longjmp_chk2 tst-backtrace2 tst-backtrace3 tst-backtrace4 \
142 tst-backtrace5
2de7874e 143
de54b33a
L
144tests-ifunc := $(stpcpy_chk strcpy_chk:%=test-%-ifunc)
145tests += $(tests-ifunc)
146
87843f15 147extra-libs = libSegFault libpcprofile
107f8131
UD
148extra-libs-others = $(extra-libs)
149
150libSegFault-routines = segfault
151libSegFault-inhibit-o = $(filter-out .os,$(object-suffixes))
152
87843f15
UD
153libpcprofile-routines = pcprofile
154libpcprofile-inhibit-o = $(filter-out .os,$(object-suffixes))
155
08920a50 156others = pcprofiledump
6c3ebebd
UD
157install-bin = pcprofiledump
158install-bin-script = xtrace
cab30d75 159
ce85d65b
UD
160include ../Makeconfig
161
bfe1b528 162ifeq ($(build-shared),yes)
6c3ebebd 163install-bin-script += catchsegv
ce85d65b 164endif
cd33623e 165generated = catchsegv xtrace
6ce7ab19 166
2de7874e 167include ../Rules
107f8131 168
f50fa10c
UD
169sLIBdir := $(shell echo $(slibdir) | sed 's,lib\(\|64\)$$,\\\\$$LIB,')
170
6ce7ab19
UD
171$(objpfx)catchsegv: catchsegv.sh $(common-objpfx)soversions.mk \
172 $(common-objpfx)config.make
0325dd20 173 slibpfx=`echo $(slibdir)|sed 's/lib\(64\|\)$$/\\\\\\\\$$LIB/'`; \
8b748aed
JM
174 sed -e 's|@VERSION@|$(version)|' -e "s|@SLIB@|$$slibpfx|" \
175 -e 's|@PKGVERSION@|$(PKGVERSION)|' \
176 -e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|' $< > $@.new
6ce7ab19
UD
177 chmod 555 $@.new
178 mv -f $@.new $@
179
cab30d75 180$(objpfx)pcprofiledump: $(objpfx)pcprofiledump.o
cab30d75
UD
181
182$(objpfx)xtrace: xtrace.sh
183 rm -f $@.new
184 sed -e 's|@BASH@|$(BASH)|' -e 's|@VERSION@|$(version)|' \
8b748aed
JM
185 -e 's|@SLIBDIR@|$(sLIBdir)|' -e 's|@BINDIR@|$(bindir)|' \
186 -e 's|@PKGVERSION@|$(PKGVERSION)|' \
187 -e 's|@REPORT_BUGS_TO@|$(REPORT_BUGS_TO)|' $^ > $@.new \
cab30d75 188 && rm -f $@ && mv $@.new $@ && chmod +x $@
This page took 0.338247 seconds and 5 git commands to generate.