diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2025-03-08 17:13:17 +0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2025-03-08 18:38:01 +0800 |
commit | 1563d43f32090495d50f0c262d6e1bcc17807064 (patch) | |
tree | 78525b6eba0b2434cbca54dc262202c3e1525d19 | |
parent | 4f0636220e6a60d85809fb4a982150f8bc3f218e (diff) | |
download | binutils-1563d43f32090495d50f0c262d6e1bcc17807064.zip binutils-1563d43f32090495d50f0c262d6e1bcc17807064.tar.gz binutils-1563d43f32090495d50f0c262d6e1bcc17807064.tar.bz2 |
gprof: Compile tst-gmon.c with -O2 -fno-omit-frame-pointer
Compile tst-gmon.c with -O2 -fno-omit-frame-pointer to ensure proper call
graph generation.
PR gprof/32768
* configure.ac: Compile tst-gmon.c with -fno-omit-frame-pointer.
* configure: Regenerated.
* testsuite/Makefile.am (GPROF_FLAGS): Add -O2
-fno-omit-frame-pointer.
(AM_CFLAGS): Removed.
(COMPILE): Append $(GPROF_FLAGS).
(LINK): Likewise.
* testsuite/Makefile.in: Regenerated.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
-rwxr-xr-x | gprof/configure | 2 | ||||
-rw-r--r-- | gprof/configure.ac | 2 | ||||
-rw-r--r-- | gprof/testsuite/Makefile.am | 10 | ||||
-rw-r--r-- | gprof/testsuite/Makefile.in | 10 |
4 files changed, 13 insertions, 11 deletions
diff --git a/gprof/configure b/gprof/configure index b830da0..2acae7b 100755 --- a/gprof/configure +++ b/gprof/configure @@ -13972,7 +13972,7 @@ if ${gprof_cv_sys_native+:} false; then : else gprof_cv_sys_native=no if test x"${host}" = x"${target}" \ - && ${CC-cc} -O2 -pg -o tst-gmon $srcdir/testsuite/tst-gmon.c; then + && ${CC-cc} -O2 -fno-omit-frame-pointer -pg -o tst-gmon $srcdir/testsuite/tst-gmon.c; then rm -f gmon.out ./tst-gmon if test -s gmon.out; then diff --git a/gprof/configure.ac b/gprof/configure.ac index f74da7d..166e16c 100644 --- a/gprof/configure.ac +++ b/gprof/configure.ac @@ -77,7 +77,7 @@ AC_CACHE_CHECK([whether gprof tests can run], [gprof_cv_sys_native], [dnl gprof_cv_sys_native=no if test x"${host}" = x"${target}" \ - && ${CC-cc} -O2 -pg -o tst-gmon $srcdir/testsuite/tst-gmon.c; then + && ${CC-cc} -O2 -fno-omit-frame-pointer -pg -o tst-gmon $srcdir/testsuite/tst-gmon.c; then rm -f gmon.out ./tst-gmon if test -s gmon.out; then diff --git a/gprof/testsuite/Makefile.am b/gprof/testsuite/Makefile.am index 7cc95e3..6a3eb72 100644 --- a/gprof/testsuite/Makefile.am +++ b/gprof/testsuite/Makefile.am @@ -4,13 +4,13 @@ AUTOMAKE_OPTIONS = foreign GPROF = ../gprof$(EXEEXT) -GPROF_FLAGS = -pg - -AM_CFLAGS = $(GPROF_FLAGS) +# NB: -O2 -fno-omit-frame-pointer is needed for expected call graph. See +# https://sourceware.org/bugzilla/show_bug.cgi?id=32768 +GPROF_FLAGS = -O2 -fno-omit-frame-pointer -pg COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(OPT_NO_PLUGINS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(GPROF_FLAGS) +LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(OPT_NO_PLUGINS) $(GPROF_FLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ # We will add to these later, for each individual test. Note diff --git a/gprof/testsuite/Makefile.in b/gprof/testsuite/Makefile.in index 91d2854..3e26c2c 100644 --- a/gprof/testsuite/Makefile.in +++ b/gprof/testsuite/Makefile.in @@ -493,12 +493,14 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = foreign GPROF = ../gprof$(EXEEXT) -GPROF_FLAGS = -pg -AM_CFLAGS = $(GPROF_FLAGS) + +# NB: -O2 -fno-omit-frame-pointer is needed for expected call graph. See +# https://sourceware.org/bugzilla/show_bug.cgi?id=32768 +GPROF_FLAGS = -O2 -fno-omit-frame-pointer -pg COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(GPROF_FLAGS) -LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(OPT_NO_PLUGINS) \ +LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(OPT_NO_PLUGINS) $(GPROF_FLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ |