| 1 | # Copyright (C) 1998,1999,2000,2001,2004,2005 Free Software Foundation, Inc.
 | 
|---|
| 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
 | 
|---|
| 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.
 | 
|---|
| 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
 | 
|---|
| 12 | # Lesser General Public License for more details.
 | 
|---|
| 13 | 
 | 
|---|
| 14 | # You should have received a copy of the GNU Lesser General Public
 | 
|---|
| 15 | # License along with the GNU C Library; if not, write to the Free
 | 
|---|
| 16 | # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 | 
|---|
| 17 | # 02111-1307 USA.
 | 
|---|
| 18 | 
 | 
|---|
| 19 | #
 | 
|---|
| 20 | #       Sub-makefile for debug portion of the library.
 | 
|---|
| 21 | #
 | 
|---|
| 22 | subdir  := debug
 | 
|---|
| 23 | 
 | 
|---|
| 24 | headers := execinfo.h
 | 
|---|
| 25 | distribute = sigcontextinfo.h register-dump.h frame.h
 | 
|---|
| 26 | 
 | 
|---|
| 27 | routines  = backtrace backtracesyms backtracesymsfd noophooks \
 | 
|---|
| 28 |             memcpy_chk memmove_chk mempcpy_chk memset_chk stpcpy_chk \
 | 
|---|
| 29 |             strcat_chk strcpy_chk strncat_chk strncpy_chk \
 | 
|---|
| 30 |             sprintf_chk vsprintf_chk snprintf_chk vsnprintf_chk \
 | 
|---|
| 31 |             printf_chk fprintf_chk vprintf_chk vfprintf_chk \
 | 
|---|
| 32 |             gets_chk chk_fail readonly-area fgets_chk fgets_u_chk \
 | 
|---|
| 33 |             read_chk pread_chk pread64_chk recv_chk recvfrom_chk \
 | 
|---|
| 34 |             readlink_chk getwd_chk getcwd_chk \
 | 
|---|
| 35 |             $(static-only-routines)
 | 
|---|
| 36 | static-only-routines := warning-nop
 | 
|---|
| 37 | 
 | 
|---|
| 38 | CFLAGS-backtrace.c = -fno-omit-frame-pointer
 | 
|---|
| 39 | CFLAGS-sprintf_chk.c = -D_IO_MTSAFE_IO
 | 
|---|
| 40 | CFLAGS-snprintf_chk.c = -D_IO_MTSAFE_IO
 | 
|---|
| 41 | CFLAGS-vsprintf_chk.c = -D_IO_MTSAFE_IO
 | 
|---|
| 42 | CFLAGS-vsnprintf_chk.c = -D_IO_MTSAFE_IO
 | 
|---|
| 43 | CFLAGS-printf_chk.c = -D_IO_MTSAFE_IO $(exceptions)
 | 
|---|
| 44 | CFLAGS-fprintf_chk.c = -D_IO_MTSAFE_IO $(exceptions)
 | 
|---|
| 45 | CFLAGS-vprintf_chk.c = -D_IO_MTSAFE_IO $(exceptions)
 | 
|---|
| 46 | CFLAGS-vfprintf_chk.c = -D_IO_MTSAFE_IO $(exceptions)
 | 
|---|
| 47 | CFLAGS-gets_chk.c = -D_IO_MTSAFE_IO $(exceptions)
 | 
|---|
| 48 | CFLAGS-fgets_chk.c = -D_IO_MTSAFE_IO $(exceptions)
 | 
|---|
| 49 | CFLAGS-fgets_u_chk.c = -D_IO_MTSAFE_IO $(exceptions)
 | 
|---|
| 50 | CFLAGS-read_chk.c = -fexceptions -fasynchronous-unwind-tables
 | 
|---|
| 51 | CFLAGS-pread_chk.c = -fexceptions -fasynchronous-unwind-tables
 | 
|---|
| 52 | CFLAGS-pread64_chk.c = -fexceptions -fasynchronous-unwind-tables
 | 
|---|
| 53 | CFLAGS-recv_chk.c = -fexceptions -fasynchronous-unwind-tables
 | 
|---|
| 54 | CFLAGS-recvfrom_chk.c = -fexceptions -fasynchronous-unwind-tables
 | 
|---|
| 55 | 
 | 
|---|
| 56 | tests = backtrace-tst tst-chk1 tst-chk2 tst-chk3 \
 | 
|---|
| 57 |         tst-lfschk1 tst-lfschk2 tst-lfschk3 test-strcpy_chk test-stpcpy_chk
 | 
|---|
| 58 | 
 | 
|---|
| 59 | extra-libs = libSegFault libpcprofile
 | 
|---|
| 60 | extra-libs-others = $(extra-libs)
 | 
|---|
| 61 | 
 | 
|---|
| 62 | libSegFault-routines = segfault
 | 
|---|
| 63 | libSegFault-inhibit-o = $(filter-out .os,$(object-suffixes))
 | 
|---|
| 64 | 
 | 
|---|
| 65 | libpcprofile-routines = pcprofile
 | 
|---|
| 66 | libpcprofile-inhibit-o = $(filter-out .os,$(object-suffixes))
 | 
|---|
| 67 | 
 | 
|---|
| 68 | others = pcprofiledump
 | 
|---|
| 69 | install-bin = pcprofiledump
 | 
|---|
| 70 | install-bin-script = xtrace
 | 
|---|
| 71 | 
 | 
|---|
| 72 | include ../Makeconfig
 | 
|---|
| 73 | 
 | 
|---|
| 74 | distribute += catchsegv.sh xtrace.sh
 | 
|---|
| 75 | ifeq ($(elf),yes)
 | 
|---|
| 76 | ifeq ($(build-shared),yes)
 | 
|---|
| 77 | install-bin-script += catchsegv
 | 
|---|
| 78 | endif
 | 
|---|
| 79 | endif
 | 
|---|
| 80 | generated = catchsegv xtrace
 | 
|---|
| 81 | 
 | 
|---|
| 82 | include ../Rules
 | 
|---|
| 83 | 
 | 
|---|
| 84 | $(objpfx)catchsegv: catchsegv.sh $(common-objpfx)soversions.mk \
 | 
|---|
| 85 |                     $(common-objpfx)config.make
 | 
|---|
| 86 |         slibpfx=`echo $(slibdir)|sed 's/lib\(64\|\)$$/\\\\\\\\$$LIB/'`; \
 | 
|---|
| 87 |         sed -e 's|@VERSION@|$(version)|' -e "s|@SLIB@|$$slibpfx|" $< > $@.new
 | 
|---|
| 88 |         chmod 555 $@.new
 | 
|---|
| 89 |         mv -f $@.new $@
 | 
|---|
| 90 | 
 | 
|---|
| 91 | $(objpfx)pcprofiledump: $(objpfx)pcprofiledump.o
 | 
|---|
| 92 | 
 | 
|---|
| 93 | $(objpfx)xtrace: xtrace.sh
 | 
|---|
| 94 |         rm -f $@.new
 | 
|---|
| 95 |         sed -e 's|@BASH@|$(BASH)|' -e 's|@VERSION@|$(version)|' \
 | 
|---|
| 96 |             -e 's|@SLIBDIR@|$(slibdir)|' -e 's|@BINDIR@|$(bindir)|' $^ > $@.new \
 | 
|---|
| 97 |         && rm -f $@ && mv $@.new $@ && chmod +x $@
 | 
|---|
| 98 | 
 | 
|---|
| 99 | # Depend on libc.so so a DT_NEEDED is generated in the shared objects.
 | 
|---|
| 100 | # This ensures they will load libc.so for needed symbols if loaded by
 | 
|---|
| 101 | # a statically-linked program that hasn't already loaded it.
 | 
|---|
| 102 | $(objpfx)libSegFault.so: $(common-objpfx)libc.so \
 | 
|---|
| 103 |                          $(common-objpfx)libc_nonshared.a \
 | 
|---|
| 104 |                          $(elf-objpfx)$(rtld-installed-name)
 | 
|---|
| 105 | $(objpfx)libpcprofile.so: $(common-objpfx)libc.so \
 | 
|---|
| 106 |                           $(common-objpfx)libc_nonshared.a \
 | 
|---|
| 107 |                           $(elf-objpfx)$(rtld-installed-name)
 | 
|---|