H.J. Lu bdf9485559 gprof: Update PR gprof/32764 test
1. Remove gmon.out first before generating it in the configure check.
2. Make tst-gmon-gprof.out depend on the gprof binary.
3. Check that gmon.out is non-empty.
4. Don't include <sys/cdefs.h> in tst-gmon.c.

	PR gprof/32764
	* configure.ac: Remove gmon.out first.
	* configure: Regenerated.
	* testsuite/Makefile.am (tst-gmon-gprof.out): Depend on
	$(GPROF).
	* testsuite/Makefile.in: Regenerated.
	* testsuite/tst-gmon-gprof.sh: Check that gmon.out is non-empty.
	* testsuite/tst-gmon.c: Don't include <sys/cdefs.h>.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2025-03-07 15:05:57 +08:00

54 lines
1.2 KiB
C

/* Test program for profiling information collection (_mcount/gprof).
Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
/* This program does not use the test harness because we want tight
control over the call graph. */
__attribute__ ((weak))
void
f1 (void)
{
}
__attribute__ ((weak))
void
f2 (void)
{
f1 ();
/* Prevent tail call. */
asm volatile ("");
}
__attribute__ ((weak))
void
f3 (int count)
{
for (int i = 0; i < count; ++i)
{
f1 ();
f2 ();
}
}
int
main (void)
{
f3 (1000);
return 0;
}