diff options
author | Nick Clifton <nickc@redhat.com> | 2022-03-18 15:45:34 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2022-03-18 15:46:33 +0000 |
commit | 0a30596cfad9cd221a81eea984b6fe3fabb20b95 (patch) | |
tree | b688d33f46d2507a16dc89d7f057cba01618c355 /gprofng | |
parent | f0cf07f341f565978228c9a2cfa73d2a9f3001c3 (diff) | |
download | gdb-0a30596cfad9cd221a81eea984b6fe3fabb20b95.zip gdb-0a30596cfad9cd221a81eea984b6fe3fabb20b95.tar.gz gdb-0a30596cfad9cd221a81eea984b6fe3fabb20b95.tar.bz2 |
Fix Build issues due to patch "gprofng: a new GNU profiler"
Find and fix more places where clock_gettime() and CLOCK_MONOTONIC_RAW are used.
Diffstat (limited to 'gprofng')
-rw-r--r-- | gprofng/Makefile.in | 1 | ||||
-rwxr-xr-x | gprofng/configure | 57 | ||||
-rw-r--r-- | gprofng/configure.ac | 13 | ||||
-rw-r--r-- | gprofng/doc/Makefile.in | 1 | ||||
-rw-r--r-- | gprofng/gp-display-html/Makefile.in | 1 | ||||
-rw-r--r-- | gprofng/libcollector/Makefile.in | 4 | ||||
-rwxr-xr-x | gprofng/libcollector/configure | 57 | ||||
-rw-r--r-- | gprofng/libcollector/configure.ac | 13 | ||||
-rw-r--r-- | gprofng/src/Makefile.am | 10 | ||||
-rw-r--r-- | gprofng/src/Makefile.in | 21 | ||||
-rw-r--r-- | gprofng/src/gethrtime.c | 4 | ||||
-rw-r--r-- | gprofng/testsuite/gprofng.display/mttest/gethrtime.c | 5 |
12 files changed, 99 insertions, 88 deletions
diff --git a/gprofng/Makefile.in b/gprofng/Makefile.in index 27889c0f..c7e3780 100644 --- a/gprofng/Makefile.in +++ b/gprofng/Makefile.in @@ -242,6 +242,7 @@ BUILD_SUBDIRS = @BUILD_SUBDIRS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CLOCK_GETTIME_LINK = @CLOCK_GETTIME_LINK@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ diff --git a/gprofng/configure b/gprofng/configure index 983150f..bd52fd9 100755 --- a/gprofng/configure +++ b/gprofng/configure @@ -634,6 +634,7 @@ am__EXEEXT_TRUE LTLIBOBJS LIBOBJS BUILD_SUBDIRS +CLOCK_GETTIME_LINK GPROFNG_LIBDIR GPROFNG_CPPFLAGS GPROFNG_CFLAGS @@ -12136,7 +12137,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12139 "configure" +#line 12140 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12242,7 +12243,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12245 "configure" +#line 12246 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -16721,6 +16722,58 @@ fi done +clock_gettime_link= +# At least for glibc, clock_gettime is in librt. But don't +# pull that in if it still doesn't give us the function we want. This +# test is copied from libgomp, and modified to not link in -lrt as +# we're using this for test timing only. +if test "$ac_cv_func_clock_gettime" = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5 +$as_echo_n "checking for clock_gettime in -lrt... " >&6; } +if ${ac_cv_lib_rt_clock_gettime+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lrt $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char clock_gettime (); +int +main () +{ +return clock_gettime (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_rt_clock_gettime=yes +else + ac_cv_lib_rt_clock_gettime=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_clock_gettime" >&5 +$as_echo "$ac_cv_lib_rt_clock_gettime" >&6; } +if test "x$ac_cv_lib_rt_clock_gettime" = xyes; then : + CLOCK_GETTIME_LINK=-lrt + +$as_echo "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h + +fi + +fi + + ac_config_files="$ac_config_files Makefile src/Makefile gp-display-html/Makefile doc/Makefile" diff --git a/gprofng/configure.ac b/gprofng/configure.ac index 7fcf6c3..a4da4e0 100644 --- a/gprofng/configure.ac +++ b/gprofng/configure.ac @@ -202,6 +202,19 @@ AC_SUBST(GPROFNG_LIBDIR, [${libdir}]) AC_CHECK_DECLS([basename]) AC_CHECK_FUNCS(clock_gettime strsignal) +clock_gettime_link= +# At least for glibc, clock_gettime is in librt. But don't +# pull that in if it still doesn't give us the function we want. This +# test is copied from libgomp, and modified to not link in -lrt as +# we're using this for test timing only. +if test "$ac_cv_func_clock_gettime" = no; then + AC_CHECK_LIB(rt, clock_gettime, + [CLOCK_GETTIME_LINK=-lrt + AC_DEFINE(HAVE_CLOCK_GETTIME, 1, + [Define to 1 if you have the `clock_gettime' function.])]) +fi +AC_SUBST(CLOCK_GETTIME_LINK) + AC_SUBST(BUILD_SUBDIRS) AC_CONFIG_FILES([Makefile src/Makefile gp-display-html/Makefile doc/Makefile]) diff --git a/gprofng/doc/Makefile.in b/gprofng/doc/Makefile.in index 5064b23..6f41ef7 100644 --- a/gprofng/doc/Makefile.in +++ b/gprofng/doc/Makefile.in @@ -226,6 +226,7 @@ BUILD_SUBDIRS = @BUILD_SUBDIRS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CLOCK_GETTIME_LINK = @CLOCK_GETTIME_LINK@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ diff --git a/gprofng/gp-display-html/Makefile.in b/gprofng/gp-display-html/Makefile.in index 635c046..d8037ca 100644 --- a/gprofng/gp-display-html/Makefile.in +++ b/gprofng/gp-display-html/Makefile.in @@ -190,6 +190,7 @@ BUILD_SUBDIRS = @BUILD_SUBDIRS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CLOCK_GETTIME_LINK = @CLOCK_GETTIME_LINK@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ diff --git a/gprofng/libcollector/Makefile.in b/gprofng/libcollector/Makefile.in index 7a4470b..e871294 100644 --- a/gprofng/libcollector/Makefile.in +++ b/gprofng/libcollector/Makefile.in @@ -158,8 +158,7 @@ am__uninstall_files_from_dir = { \ } am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(myincludedir)" LTLIBRARIES = $(lib_LTLIBRARIES) -am__DEPENDENCIES_1 = -libgp_collector_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +libgp_collector_la_DEPENDENCIES = am__objects_1 = libgp_collector_la-gethrtime.lo \ libgp_collector_la-dispatcher.lo libgp_collector_la-iolib.lo \ libgp_collector_la-mmaptrace.lo libgp_collector_la-memmgr.lo \ @@ -308,7 +307,6 @@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ -CLOCK_GETTIME_LINK = @CLOCK_GETTIME_LINK@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ diff --git a/gprofng/libcollector/configure b/gprofng/libcollector/configure index cb4046c..9fea098 100755 --- a/gprofng/libcollector/configure +++ b/gprofng/libcollector/configure @@ -633,7 +633,6 @@ ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS -CLOCK_GETTIME_LINK GPROFNG_NO_NONNULL_COMPARE_CFLAGS GPROFNG_VARIANT CXXCPP @@ -12059,7 +12058,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12062 "configure" +#line 12061 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12165,7 +12164,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12168 "configure" +#line 12167 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -15542,58 +15541,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -clock_gettime_link= -# At least for glibc, clock_gettime is in librt. But don't -# pull that in if it still doesn't give us the function we want. This -# test is copied from libgomp, and modified to not link in -lrt as -# we're using this for test timing only. -if test "$ac_cv_func_clock_gettime" = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5 -$as_echo_n "checking for clock_gettime in -lrt... " >&6; } -if ${ac_cv_lib_rt_clock_gettime+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lrt $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char clock_gettime (); -int -main () -{ -return clock_gettime (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_rt_clock_gettime=yes -else - ac_cv_lib_rt_clock_gettime=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_clock_gettime" >&5 -$as_echo "$ac_cv_lib_rt_clock_gettime" >&6; } -if test "x$ac_cv_lib_rt_clock_gettime" = xyes; then : - CLOCK_GETTIME_LINK=-lrt - -$as_echo "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h - -fi - -fi - - ac_config_files="$ac_config_files Makefile" ac_config_headers="$ac_config_headers lib-config.h:../common/config.h.in" diff --git a/gprofng/libcollector/configure.ac b/gprofng/libcollector/configure.ac index 1da916e..f49d120 100644 --- a/gprofng/libcollector/configure.ac +++ b/gprofng/libcollector/configure.ac @@ -58,19 +58,6 @@ AC_SUBST(GPROFNG_VARIANT) ACX_PROG_CC_WARNING_OPTS([-Wno-nonnull-compare], [GPROFNG_NO_NONNULL_COMPARE_CFLAGS]) AC_SUBST(GPROFNG_NO_NONNULL_COMPARE_CFLAGS) -clock_gettime_link= -# At least for glibc, clock_gettime is in librt. But don't -# pull that in if it still doesn't give us the function we want. This -# test is copied from libgomp, and modified to not link in -lrt as -# we're using this for test timing only. -if test "$ac_cv_func_clock_gettime" = no; then - AC_CHECK_LIB(rt, clock_gettime, - [CLOCK_GETTIME_LINK=-lrt - AC_DEFINE(HAVE_CLOCK_GETTIME, 1, - [Define to 1 if you have the `clock_gettime' function.])]) -fi -AC_SUBST(CLOCK_GETTIME_LINK) - AC_CONFIG_FILES([Makefile]) AC_CONFIG_HEADERS([lib-config.h:../common/config.h.in]) AC_OUTPUT diff --git a/gprofng/src/Makefile.am b/gprofng/src/Makefile.am index 84fd1df..fdd95f5 100644 --- a/gprofng/src/Makefile.am +++ b/gprofng/src/Makefile.am @@ -133,19 +133,19 @@ dbe_DATA = $(srcdir)/gprofng.rc bin_PROGRAMS = gp-archive gp-collect-app gprofng gp-display-text gp-display-src gp_archive_SOURCES = gp-archive.cc ArchiveExp.cc -gp_archive_LDADD = $(LIBGPROFNG) +gp_archive_LDADD = $(LIBGPROFNG) $(CLOCK_GETTIME_LINK) gp_collect_app_SOURCES = gp-collect-app.cc checks.cc envsets.cc count.cc -gp_collect_app_LDADD = $(LIBGPROFNG) +gp_collect_app_LDADD = $(LIBGPROFNG) $(CLOCK_GETTIME_LINK) gprofng_SOURCES = gprofng.cc -gprofng_LDADD = $(LIBGPROFNG) +gprofng_LDADD = $(LIBGPROFNG) $(CLOCK_GETTIME_LINK) gp_display_src_SOURCES = gp-display-src.cc -gp_display_src_LDADD = $(LIBGPROFNG) +gp_display_src_LDADD = $(LIBGPROFNG) $(CLOCK_GETTIME_LINK) gp_display_text_SOURCES = gp-display-text.cc ipc.cc ipcio.cc -gp_display_text_LDADD = $(LIBGPROFNG) +gp_display_text_LDADD = $(LIBGPROFNG) $(CLOCK_GETTIME_LINK) if BUILD_MAN diff --git a/gprofng/src/Makefile.in b/gprofng/src/Makefile.in index 19b5960..3659ca0 100644 --- a/gprofng/src/Makefile.in +++ b/gprofng/src/Makefile.in @@ -193,21 +193,21 @@ libgprofng_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ PROGRAMS = $(bin_PROGRAMS) am_gp_archive_OBJECTS = gp-archive.$(OBJEXT) ArchiveExp.$(OBJEXT) gp_archive_OBJECTS = $(am_gp_archive_OBJECTS) -gp_archive_DEPENDENCIES = $(LIBGPROFNG) +gp_archive_DEPENDENCIES = $(LIBGPROFNG) $(am__DEPENDENCIES_1) am_gp_collect_app_OBJECTS = gp-collect-app.$(OBJEXT) checks.$(OBJEXT) \ envsets.$(OBJEXT) count.$(OBJEXT) gp_collect_app_OBJECTS = $(am_gp_collect_app_OBJECTS) -gp_collect_app_DEPENDENCIES = $(LIBGPROFNG) +gp_collect_app_DEPENDENCIES = $(LIBGPROFNG) $(am__DEPENDENCIES_1) am_gp_display_src_OBJECTS = gp-display-src.$(OBJEXT) gp_display_src_OBJECTS = $(am_gp_display_src_OBJECTS) -gp_display_src_DEPENDENCIES = $(LIBGPROFNG) +gp_display_src_DEPENDENCIES = $(LIBGPROFNG) $(am__DEPENDENCIES_1) am_gp_display_text_OBJECTS = gp-display-text.$(OBJEXT) ipc.$(OBJEXT) \ ipcio.$(OBJEXT) gp_display_text_OBJECTS = $(am_gp_display_text_OBJECTS) -gp_display_text_DEPENDENCIES = $(LIBGPROFNG) +gp_display_text_DEPENDENCIES = $(LIBGPROFNG) $(am__DEPENDENCIES_1) am_gprofng_OBJECTS = gprofng.$(OBJEXT) gprofng_OBJECTS = $(am_gprofng_OBJECTS) -gprofng_DEPENDENCIES = $(LIBGPROFNG) +gprofng_DEPENDENCIES = $(LIBGPROFNG) $(am__DEPENDENCIES_1) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false @@ -309,6 +309,7 @@ BUILD_SUBDIRS = @BUILD_SUBDIRS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CLOCK_GETTIME_LINK = @CLOCK_GETTIME_LINK@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ @@ -548,15 +549,15 @@ libgprofng_la_LIBADD = $(top_builddir)/../opcodes/libopcodes.la \ dbedir = $(prefix)/etc dbe_DATA = $(srcdir)/gprofng.rc gp_archive_SOURCES = gp-archive.cc ArchiveExp.cc -gp_archive_LDADD = $(LIBGPROFNG) +gp_archive_LDADD = $(LIBGPROFNG) $(CLOCK_GETTIME_LINK) gp_collect_app_SOURCES = gp-collect-app.cc checks.cc envsets.cc count.cc -gp_collect_app_LDADD = $(LIBGPROFNG) +gp_collect_app_LDADD = $(LIBGPROFNG) $(CLOCK_GETTIME_LINK) gprofng_SOURCES = gprofng.cc -gprofng_LDADD = $(LIBGPROFNG) +gprofng_LDADD = $(LIBGPROFNG) $(CLOCK_GETTIME_LINK) gp_display_src_SOURCES = gp-display-src.cc -gp_display_src_LDADD = $(LIBGPROFNG) +gp_display_src_LDADD = $(LIBGPROFNG) $(CLOCK_GETTIME_LINK) gp_display_text_SOURCES = gp-display-text.cc ipc.cc ipcio.cc -gp_display_text_LDADD = $(LIBGPROFNG) +gp_display_text_LDADD = $(LIBGPROFNG) $(CLOCK_GETTIME_LINK) # The man pages depend on the version number and on a help2man include file. @BUILD_MAN_TRUE@common_mandeps = $(top_srcdir)/../bfd/version.m4 diff --git a/gprofng/src/gethrtime.c b/gprofng/src/gethrtime.c index 8ba7295..9e17f1e 100644 --- a/gprofng/src/gethrtime.c +++ b/gprofng/src/gethrtime.c @@ -159,7 +159,11 @@ gethrtime (void) * There is no issue on Solaris, where gethrtime() is provided by the kernel * and used by DTrace. */ +#ifdef CLOCK_MONOTONIC_RAW int r = clock_gettime (CLOCK_MONOTONIC_RAW, &tp); +#else + int r = clock_gettime (CLOCK_MONOTONIC, &tp); +#endif if (r == 0) rc = ((hrtime_t) tp.tv_sec) * 1000000000 + (hrtime_t) tp.tv_nsec; return rc; diff --git a/gprofng/testsuite/gprofng.display/mttest/gethrtime.c b/gprofng/testsuite/gprofng.display/mttest/gethrtime.c index a985401..aa5a4b9 100644 --- a/gprofng/testsuite/gprofng.display/mttest/gethrtime.c +++ b/gprofng/testsuite/gprofng.display/mttest/gethrtime.c @@ -222,7 +222,12 @@ gethrtime (void) { struct timespec tp; hrtime_t rc = 0; +#ifdef CLOCK_MONOTONIC_RAW + int r = clock_gettime (CLOCK_MONOTONIC_RAW, &tp); +#else int r = clock_gettime (CLOCK_MONOTONIC, &tp); +#endif + if (r == 0) rc = ((hrtime_t) tp.tv_sec) * 1000000000 + (hrtime_t) tp.tv_nsec; return rc; |