]>
Commit | Line | Data |
---|---|---|
6d7e8eda | 1 | # Copyright (C) 1995-2023 Free Software Foundation, Inc. |
11c981a9 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. | |
11c981a9 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. |
11c981a9 | 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/>. |
11c981a9 RM |
17 | |
18 | # | |
19 | # Sub-makefile for gmon portion of the library. | |
20 | # | |
21 | subdir := gmon | |
22 | ||
a5f891ac JM |
23 | include ../Makeconfig |
24 | ||
a341068d | 25 | headers := sys/gmon.h sys/gmon_out.h sys/profil.h |
7ed87317 | 26 | routines := gmon mcount profil sprofil prof-freq |
0e043598 | 27 | |
31be941e | 28 | tests = tst-sprofil tst-gmon tst-mcount-overflow |
9f0d7b6d UD |
29 | ifeq ($(build-profile),yes) |
30 | tests += tst-profile-static | |
31 | tests-static += tst-profile-static | |
32 | ||
33 | LDFLAGS-tst-profile-static = -profile | |
34 | endif | |
11c981a9 | 35 | |
a4777c46 L |
36 | tests += tst-gmon-static |
37 | tests-static += tst-gmon-static | |
38 | ||
d165ca64 L |
39 | ifeq (yesyes,$(have-fpie)$(build-shared)) |
40 | tests += tst-gmon-pie | |
41 | tests-pie += tst-gmon-pie | |
9d7a3741 L |
42 | ifeq (yes,$(enable-static-pie)) |
43 | tests += tst-gmon-static-pie | |
44 | tests-static += tst-gmon-static-pie | |
45 | endif | |
d165ca64 L |
46 | endif |
47 | ||
d99d7e26 RM |
48 | # The mcount code won't work without a frame pointer. |
49 | CFLAGS-mcount.c := -fno-omit-frame-pointer | |
50 | ||
0c251257 | 51 | CFLAGS-tst-gmon.c := -fno-omit-frame-pointer -pg |
ce16eb52 | 52 | tst-gmon-no-pie = yes |
26803075 | 53 | CRT-tst-gmon := $(csu-objpfx)g$(start-installed-name) |
6014c65d | 54 | tst-gmon-ENV := GMON_OUT_PREFIX=$(objpfx)tst-gmon.data |
6b11a6ad | 55 | ifeq ($(run-built-tests),yes) |
6014c65d | 56 | tests-special += $(objpfx)tst-gmon-gprof.out |
6b11a6ad | 57 | endif |
6014c65d | 58 | |
31be941e SK |
59 | CFLAGS-tst-mcount-overflow.c := -fno-omit-frame-pointer -pg |
60 | tst-mcount-overflow-no-pie = yes | |
61 | CRT-tst-mcount-overflow := $(csu-objpfx)g$(start-installed-name) | |
62 | # Intentionally use invalid config where maxarcs<minarcs to check warning is printed | |
63 | tst-mcount-overflow-ENV := GMON_OUT_PREFIX=$(objpfx)tst-mcount-overflow.data \ | |
64 | GLIBC_TUNABLES=glibc.gmon.minarcs=51:glibc.gmon.maxarcs=50 | |
65 | # Send stderr into output file because we make sure expected messages are printed | |
66 | tst-mcount-overflow-ARGS := 2>&1 1>/dev/null | cat | |
67 | ifeq ($(run-built-tests),yes) | |
68 | tests-special += $(objpfx)tst-mcount-overflow-check.out | |
69 | endif | |
70 | ||
a4777c46 | 71 | CFLAGS-tst-gmon-static.c := $(PIE-ccflag) -fno-omit-frame-pointer -pg |
26803075 | 72 | CRT-tst-gmon-static := $(csu-objpfx)g$(static-start-installed-name) |
9d7a3741 | 73 | tst-gmon-static-no-pie = yes |
a4777c46 L |
74 | tst-gmon-static-ENV := GMON_OUT_PREFIX=$(objpfx)tst-gmon-static.data |
75 | ifeq ($(run-built-tests),yes) | |
76 | tests-special += $(objpfx)tst-gmon-static-gprof.out | |
77 | endif | |
78 | ||
d165ca64 | 79 | CFLAGS-tst-gmon-pie.c := $(PIE-ccflag) -fno-omit-frame-pointer -pg |
26803075 | 80 | CRT-tst-gmon-pie := $(csu-objpfx)g$(start-installed-name) |
d165ca64 L |
81 | tst-gmon-pie-ENV := GMON_OUT_PREFIX=$(objpfx)tst-gmon-pie.data |
82 | ifeq ($(run-built-tests),yes) | |
83 | tests-special += $(objpfx)tst-gmon-pie-gprof.out | |
84 | endif | |
85 | ||
9d7a3741 L |
86 | ifeq (yes,$(enable-static-pie)) |
87 | CFLAGS-tst-gmon-static-pie.c := $(PIE-ccflag) -fno-omit-frame-pointer -pg | |
26803075 | 88 | CRT-tst-gmon-static-pie := $(csu-objpfx)gr$(static-start-installed-name) |
9d7a3741 L |
89 | tst-gmon-static-pie-ENV := GMON_OUT_PREFIX=$(objpfx)tst-gmon-static-pie.data |
90 | ifeq ($(run-built-tests),yes) | |
91 | tests-special += $(objpfx)tst-gmon-static-pie-gprof.out | |
92 | endif | |
93 | endif | |
94 | ||
d165ca64 | 95 | |
d7d06f79 UD |
96 | include ../Rules |
97 | ||
d99d7e26 | 98 | # We cannot compile mcount.c with -pg because that would |
6d52618b | 99 | # create recursive calls. Just copy the normal static object. |
92777700 RM |
100 | # On systems where `profil' is not a system call, the same |
101 | # problem exists for the internal functions in profil.c. | |
102 | ||
87a07a43 | 103 | noprof := mcount $(sysdep_noprof) |
92777700 | 104 | ifeq (,$(filter profil,$(unix-syscalls))) |
4c48b267 | 105 | noprof += profil sprofil |
92777700 RM |
106 | endif |
107 | ||
40a55d20 | 108 | $(noprof:%=$(objpfx)%.op): %.op: %.o |
d99d7e26 RM |
109 | rm -f $@ |
110 | ln $< $@ | |
6014c65d FW |
111 | |
112 | # GMON_OUTPUT_PREFIX only sets the output prefix. The actual file | |
113 | # name contains the PID as well. | |
114 | $(objpfx)tst-gmon.out: clean-tst-gmon-data | |
115 | clean-tst-gmon-data: | |
116 | rm -f $(objpfx)tst-gmon.data.* | |
117 | ||
31be941e SK |
118 | $(objpfx)tst-mcount-overflow.o: clean-tst-mcount-overflow-data |
119 | clean-tst-mcount-overflow-data: | |
120 | rm -f $(objpfx)tst-mcount-overflow.data.* | |
121 | ||
122 | $(objpfx)tst-mcount-overflow-check.out: tst-mcount-overflow-check.sh $(objpfx)tst-mcount-overflow.out | |
123 | $(SHELL) $< $(objpfx)tst-mcount-overflow > $@; \ | |
124 | $(evaluate-test) | |
125 | ||
6014c65d FW |
126 | $(objpfx)tst-gmon-gprof.out: tst-gmon-gprof.sh $(objpfx)tst-gmon.out |
127 | $(SHELL) $< $(GPROF) $(objpfx)tst-gmon $(objpfx)tst-gmon.data.* > $@; \ | |
128 | $(evaluate-test) | |
d165ca64 | 129 | |
a4777c46 L |
130 | $(objpfx)tst-gmon-static.out: clean-tst-gmon-static-data |
131 | clean-tst-gmon-static-data: | |
132 | rm -f $(objpfx)tst-gmon-static.data.* | |
133 | ||
134 | $(objpfx)tst-gmon-static-gprof.out: tst-gmon-static-gprof.sh \ | |
135 | $(objpfx)tst-gmon-static.out | |
136 | $(SHELL) $< $(GPROF) $(objpfx)tst-gmon-static \ | |
137 | $(objpfx)tst-gmon-static.data.* > $@; \ | |
138 | $(evaluate-test) | |
139 | ||
d165ca64 L |
140 | $(objpfx)tst-gmon-pie.out: clean-tst-gmon-pie-data |
141 | clean-tst-gmon-pie-data: | |
142 | rm -f $(objpfx)tst-gmon-pie.data.* | |
143 | ||
144 | $(objpfx)tst-gmon-pie-gprof.out: tst-gmon-gprof.sh $(objpfx)tst-gmon-pie.out | |
145 | $(SHELL) $< $(GPROF) $(objpfx)tst-gmon-pie $(objpfx)tst-gmon-pie.data.* > $@; \ | |
146 | $(evaluate-test) | |
9d7a3741 L |
147 | |
148 | $(objpfx)tst-gmon-static-pie.out: clean-tst-gmon-static-pie-data | |
149 | clean-tst-gmon-static-pie-data: | |
150 | rm -f $(objpfx)tst-gmon-static-pie.data.* | |
151 | ||
152 | $(objpfx)tst-gmon-static-pie-gprof.out: tst-gmon-static-gprof.sh \ | |
153 | $(objpfx)tst-gmon-static-pie.out | |
154 | $(SHELL) $< $(GPROF) $(objpfx)tst-gmon-static-pie \ | |
155 | $(objpfx)tst-gmon-static-pie.data.* > $@; \ | |
156 | $(evaluate-test) |