diff options
author | Thomas Schwinge <tschwinge@baylibre.com> | 2024-03-11 00:17:15 +0100 |
---|---|---|
committer | Thomas Schwinge <tschwinge@baylibre.com> | 2024-03-11 00:17:15 +0100 |
commit | 198badab349257a29e545f1d9ed92104412a1140 (patch) | |
tree | 03e057d07e2f871494dac37c9579397a20b57628 | |
parent | cd9de752bd224189e57468aa183abc67f41d6889 (diff) | |
parent | b48e994077b6cc165ce136428277952a0b8bc9d2 (diff) | |
download | gcc-198badab349257a29e545f1d9ed92104412a1140.zip gcc-198badab349257a29e545f1d9ed92104412a1140.tar.gz gcc-198badab349257a29e545f1d9ed92104412a1140.tar.bz2 |
Merge commit 'ab422974567ae73926c2308c3400b5974d6e09f1^' into HEAD
-rw-r--r-- | Makefile.def | 11 | ||||
-rw-r--r-- | Makefile.in | 500 | ||||
-rw-r--r-- | Makefile.tpl | 3 | ||||
-rw-r--r-- | config/zstd.m4 | 23 | ||||
-rwxr-xr-x | configure | 80 | ||||
-rw-r--r-- | configure.ac | 57 | ||||
-rw-r--r-- | include/collectorAPI.h | 73 | ||||
-rw-r--r-- | include/libcollector.h | 89 | ||||
-rw-r--r-- | include/libfcollector.h | 42 |
9 files changed, 876 insertions, 2 deletions
diff --git a/Makefile.def b/Makefile.def index 3030d54..2d9f71d 100644 --- a/Makefile.def +++ b/Makefile.def @@ -73,6 +73,7 @@ host_modules= { module= isl; lib_path=.libs; bootstrap=true; no_install= true; }; host_modules= { module= gold; bootstrap=true; }; host_modules= { module= gprof; }; +host_modules= { module= gprofng; }; // intl acts on 'host_shared' directly, and does not support --with-pic. host_modules= { module= intl; bootstrap=true; }; host_modules= { module= tcl; @@ -514,6 +515,16 @@ dependencies = { module=all-gprof; on=all-bfd; }; dependencies = { module=all-gprof; on=all-opcodes; }; dependencies = { module=all-gprof; on=all-intl; }; dependencies = { module=all-gprof; on=all-gas; }; + +dependencies = { module=configure-gprofng; on=configure-intl; }; +dependencies = { module=all-gprofng; on=all-libiberty; }; +dependencies = { module=all-gprofng; on=all-bfd; }; +dependencies = { module=all-gprofng; on=all-opcodes; }; +dependencies = { module=all-gprofng; on=all-intl; }; +dependencies = { module=all-gprofng; on=all-gas; }; +dependencies = { module=install-gprofng; on=install-opcodes; }; +dependencies = { module=install-gprofng; on=install-bfd; }; + dependencies = { module=configure-ld; on=configure-intl; }; dependencies = { module=all-ld; on=all-libiberty; }; dependencies = { module=all-ld; on=all-bfd; }; diff --git a/Makefile.in b/Makefile.in index 30648ca..4fb489f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -221,6 +221,7 @@ HOST_EXPORTS = \ OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ OTOOL="$(OTOOL)"; export OTOOL; \ + PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)"; export PKG_CONFIG_PATH; \ READELF="$(READELF)"; export READELF; \ AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \ AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \ @@ -447,6 +448,8 @@ GOCFLAGS = $(CFLAGS) GDCFLAGS = @GDCFLAGS@ GM2FLAGS = $(CFLAGS) +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ + # Pass additional PGO and LTO compiler options to the PGO build. BUILD_CFLAGS = $(PGO_BUILD_CFLAGS) $(PGO_BUILD_LTO_CFLAGS) override CFLAGS += $(BUILD_CFLAGS) @@ -1089,6 +1092,7 @@ configure-host: \ maybe-configure-isl \ maybe-configure-gold \ maybe-configure-gprof \ + maybe-configure-gprofng \ maybe-configure-intl \ maybe-configure-tcl \ maybe-configure-itcl \ @@ -1244,6 +1248,7 @@ all-host: maybe-all-isl all-host: maybe-all-gold @endif gold-no-bootstrap all-host: maybe-all-gprof +all-host: maybe-all-gprofng @if intl-no-bootstrap all-host: maybe-all-intl @endif intl-no-bootstrap @@ -1387,6 +1392,7 @@ info-host: maybe-info-mpc info-host: maybe-info-isl info-host: maybe-info-gold info-host: maybe-info-gprof +info-host: maybe-info-gprofng info-host: maybe-info-intl info-host: maybe-info-tcl info-host: maybe-info-itcl @@ -1479,6 +1485,7 @@ dvi-host: maybe-dvi-mpc dvi-host: maybe-dvi-isl dvi-host: maybe-dvi-gold dvi-host: maybe-dvi-gprof +dvi-host: maybe-dvi-gprofng dvi-host: maybe-dvi-intl dvi-host: maybe-dvi-tcl dvi-host: maybe-dvi-itcl @@ -1571,6 +1578,7 @@ pdf-host: maybe-pdf-mpc pdf-host: maybe-pdf-isl pdf-host: maybe-pdf-gold pdf-host: maybe-pdf-gprof +pdf-host: maybe-pdf-gprofng pdf-host: maybe-pdf-intl pdf-host: maybe-pdf-tcl pdf-host: maybe-pdf-itcl @@ -1663,6 +1671,7 @@ html-host: maybe-html-mpc html-host: maybe-html-isl html-host: maybe-html-gold html-host: maybe-html-gprof +html-host: maybe-html-gprofng html-host: maybe-html-intl html-host: maybe-html-tcl html-host: maybe-html-itcl @@ -1755,6 +1764,7 @@ TAGS-host: maybe-TAGS-mpc TAGS-host: maybe-TAGS-isl TAGS-host: maybe-TAGS-gold TAGS-host: maybe-TAGS-gprof +TAGS-host: maybe-TAGS-gprofng TAGS-host: maybe-TAGS-intl TAGS-host: maybe-TAGS-tcl TAGS-host: maybe-TAGS-itcl @@ -1847,6 +1857,7 @@ install-info-host: maybe-install-info-mpc install-info-host: maybe-install-info-isl install-info-host: maybe-install-info-gold install-info-host: maybe-install-info-gprof +install-info-host: maybe-install-info-gprofng install-info-host: maybe-install-info-intl install-info-host: maybe-install-info-tcl install-info-host: maybe-install-info-itcl @@ -1939,6 +1950,7 @@ install-dvi-host: maybe-install-dvi-mpc install-dvi-host: maybe-install-dvi-isl install-dvi-host: maybe-install-dvi-gold install-dvi-host: maybe-install-dvi-gprof +install-dvi-host: maybe-install-dvi-gprofng install-dvi-host: maybe-install-dvi-intl install-dvi-host: maybe-install-dvi-tcl install-dvi-host: maybe-install-dvi-itcl @@ -2031,6 +2043,7 @@ install-pdf-host: maybe-install-pdf-mpc install-pdf-host: maybe-install-pdf-isl install-pdf-host: maybe-install-pdf-gold install-pdf-host: maybe-install-pdf-gprof +install-pdf-host: maybe-install-pdf-gprofng install-pdf-host: maybe-install-pdf-intl install-pdf-host: maybe-install-pdf-tcl install-pdf-host: maybe-install-pdf-itcl @@ -2123,6 +2136,7 @@ install-html-host: maybe-install-html-mpc install-html-host: maybe-install-html-isl install-html-host: maybe-install-html-gold install-html-host: maybe-install-html-gprof +install-html-host: maybe-install-html-gprofng install-html-host: maybe-install-html-intl install-html-host: maybe-install-html-tcl install-html-host: maybe-install-html-itcl @@ -2215,6 +2229,7 @@ installcheck-host: maybe-installcheck-mpc installcheck-host: maybe-installcheck-isl installcheck-host: maybe-installcheck-gold installcheck-host: maybe-installcheck-gprof +installcheck-host: maybe-installcheck-gprofng installcheck-host: maybe-installcheck-intl installcheck-host: maybe-installcheck-tcl installcheck-host: maybe-installcheck-itcl @@ -2307,6 +2322,7 @@ mostlyclean-host: maybe-mostlyclean-mpc mostlyclean-host: maybe-mostlyclean-isl mostlyclean-host: maybe-mostlyclean-gold mostlyclean-host: maybe-mostlyclean-gprof +mostlyclean-host: maybe-mostlyclean-gprofng mostlyclean-host: maybe-mostlyclean-intl mostlyclean-host: maybe-mostlyclean-tcl mostlyclean-host: maybe-mostlyclean-itcl @@ -2399,6 +2415,7 @@ clean-host: maybe-clean-mpc clean-host: maybe-clean-isl clean-host: maybe-clean-gold clean-host: maybe-clean-gprof +clean-host: maybe-clean-gprofng clean-host: maybe-clean-intl clean-host: maybe-clean-tcl clean-host: maybe-clean-itcl @@ -2491,6 +2508,7 @@ distclean-host: maybe-distclean-mpc distclean-host: maybe-distclean-isl distclean-host: maybe-distclean-gold distclean-host: maybe-distclean-gprof +distclean-host: maybe-distclean-gprofng distclean-host: maybe-distclean-intl distclean-host: maybe-distclean-tcl distclean-host: maybe-distclean-itcl @@ -2583,6 +2601,7 @@ maintainer-clean-host: maybe-maintainer-clean-mpc maintainer-clean-host: maybe-maintainer-clean-isl maintainer-clean-host: maybe-maintainer-clean-gold maintainer-clean-host: maybe-maintainer-clean-gprof +maintainer-clean-host: maybe-maintainer-clean-gprofng maintainer-clean-host: maybe-maintainer-clean-intl maintainer-clean-host: maybe-maintainer-clean-tcl maintainer-clean-host: maybe-maintainer-clean-itcl @@ -2733,6 +2752,7 @@ check-host: \ maybe-check-isl \ maybe-check-gold \ maybe-check-gprof \ + maybe-check-gprofng \ maybe-check-intl \ maybe-check-tcl \ maybe-check-itcl \ @@ -2872,6 +2892,7 @@ install-host-nogcc: \ maybe-install-isl \ maybe-install-gold \ maybe-install-gprof \ + maybe-install-gprofng \ maybe-install-intl \ maybe-install-tcl \ maybe-install-itcl \ @@ -2928,6 +2949,7 @@ install-host: \ maybe-install-isl \ maybe-install-gold \ maybe-install-gprof \ + maybe-install-gprofng \ maybe-install-intl \ maybe-install-tcl \ maybe-install-itcl \ @@ -3040,6 +3062,7 @@ install-strip-host: \ maybe-install-strip-isl \ maybe-install-strip-gold \ maybe-install-strip-gprof \ + maybe-install-strip-gprofng \ maybe-install-strip-intl \ maybe-install-strip-tcl \ maybe-install-strip-itcl \ @@ -19342,6 +19365,474 @@ maintainer-clean-gprof: +.PHONY: configure-gprofng maybe-configure-gprofng +maybe-configure-gprofng: +@if gcc-bootstrap +configure-gprofng: stage_current +@endif gcc-bootstrap +@if gprofng +maybe-configure-gprofng: configure-gprofng +configure-gprofng: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + test ! -f $(HOST_SUBDIR)/gprofng/Makefile || exit 0; \ + $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)/gprofng; \ + $(HOST_EXPORTS) \ + echo Configuring in $(HOST_SUBDIR)/gprofng; \ + cd "$(HOST_SUBDIR)/gprofng" || exit 1; \ + case $(srcdir) in \ + /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ + *) topdir=`echo $(HOST_SUBDIR)/gprofng/ | \ + sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ + esac; \ + module_srcdir=gprofng; \ + $(SHELL) \ + $$s/$$module_srcdir/configure \ + --srcdir=$${topdir}/$$module_srcdir \ + $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ + --target=${target_alias} \ + || exit 1 +@endif gprofng + + + + + +.PHONY: all-gprofng maybe-all-gprofng +maybe-all-gprofng: +@if gcc-bootstrap +all-gprofng: stage_current +@endif gcc-bootstrap +@if gprofng +TARGET-gprofng=all +maybe-all-gprofng: all-gprofng +all-gprofng: configure-gprofng + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/gprofng && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(STAGE1_FLAGS_TO_PASS) \ + $(TARGET-gprofng)) +@endif gprofng + + + + +.PHONY: check-gprofng maybe-check-gprofng +maybe-check-gprofng: +@if gprofng +maybe-check-gprofng: check-gprofng + +check-gprofng: + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/gprofng && \ + $(MAKE) $(FLAGS_TO_PASS) check) + +@endif gprofng + +.PHONY: install-gprofng maybe-install-gprofng +maybe-install-gprofng: +@if gprofng +maybe-install-gprofng: install-gprofng + +install-gprofng: installdirs + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/gprofng && \ + $(MAKE) $(FLAGS_TO_PASS) install) + +@endif gprofng + +.PHONY: install-strip-gprofng maybe-install-strip-gprofng +maybe-install-strip-gprofng: +@if gprofng +maybe-install-strip-gprofng: install-strip-gprofng + +install-strip-gprofng: installdirs + @: $(MAKE); $(unstage) + @r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + (cd $(HOST_SUBDIR)/gprofng && \ + $(MAKE) $(FLAGS_TO_PASS) install-strip) + +@endif gprofng + +# Other targets (info, dvi, pdf, etc.) + +.PHONY: maybe-info-gprofng info-gprofng +maybe-info-gprofng: +@if gprofng +maybe-info-gprofng: info-gprofng + +info-gprofng: \ + configure-gprofng + @: $(MAKE); $(unstage) + @[ -f ./gprofng/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing info in gprofng"; \ + (cd $(HOST_SUBDIR)/gprofng && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + info) \ + || exit 1 + +@endif gprofng + +.PHONY: maybe-dvi-gprofng dvi-gprofng +maybe-dvi-gprofng: +@if gprofng +maybe-dvi-gprofng: dvi-gprofng + +dvi-gprofng: \ + configure-gprofng + @: $(MAKE); $(unstage) + @[ -f ./gprofng/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing dvi in gprofng"; \ + (cd $(HOST_SUBDIR)/gprofng && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + dvi) \ + || exit 1 + +@endif gprofng + +.PHONY: maybe-pdf-gprofng pdf-gprofng +maybe-pdf-gprofng: +@if gprofng +maybe-pdf-gprofng: pdf-gprofng + +pdf-gprofng: \ + configure-gprofng + @: $(MAKE); $(unstage) + @[ -f ./gprofng/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing pdf in gprofng"; \ + (cd $(HOST_SUBDIR)/gprofng && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + pdf) \ + || exit 1 + +@endif gprofng + +.PHONY: maybe-html-gprofng html-gprofng +maybe-html-gprofng: +@if gprofng +maybe-html-gprofng: html-gprofng + +html-gprofng: \ + configure-gprofng + @: $(MAKE); $(unstage) + @[ -f ./gprofng/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing html in gprofng"; \ + (cd $(HOST_SUBDIR)/gprofng && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + html) \ + || exit 1 + +@endif gprofng + +.PHONY: maybe-TAGS-gprofng TAGS-gprofng +maybe-TAGS-gprofng: +@if gprofng +maybe-TAGS-gprofng: TAGS-gprofng + +TAGS-gprofng: \ + configure-gprofng + @: $(MAKE); $(unstage) + @[ -f ./gprofng/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing TAGS in gprofng"; \ + (cd $(HOST_SUBDIR)/gprofng && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + TAGS) \ + || exit 1 + +@endif gprofng + +.PHONY: maybe-install-info-gprofng install-info-gprofng +maybe-install-info-gprofng: +@if gprofng +maybe-install-info-gprofng: install-info-gprofng + +install-info-gprofng: \ + configure-gprofng \ + info-gprofng + @: $(MAKE); $(unstage) + @[ -f ./gprofng/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-info in gprofng"; \ + (cd $(HOST_SUBDIR)/gprofng && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + install-info) \ + || exit 1 + +@endif gprofng + +.PHONY: maybe-install-dvi-gprofng install-dvi-gprofng +maybe-install-dvi-gprofng: +@if gprofng +maybe-install-dvi-gprofng: install-dvi-gprofng + +install-dvi-gprofng: \ + configure-gprofng \ + dvi-gprofng + @: $(MAKE); $(unstage) + @[ -f ./gprofng/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-dvi in gprofng"; \ + (cd $(HOST_SUBDIR)/gprofng && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + install-dvi) \ + || exit 1 + +@endif gprofng + +.PHONY: maybe-install-pdf-gprofng install-pdf-gprofng +maybe-install-pdf-gprofng: +@if gprofng +maybe-install-pdf-gprofng: install-pdf-gprofng + +install-pdf-gprofng: \ + configure-gprofng \ + pdf-gprofng + @: $(MAKE); $(unstage) + @[ -f ./gprofng/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-pdf in gprofng"; \ + (cd $(HOST_SUBDIR)/gprofng && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + install-pdf) \ + || exit 1 + +@endif gprofng + +.PHONY: maybe-install-html-gprofng install-html-gprofng +maybe-install-html-gprofng: +@if gprofng +maybe-install-html-gprofng: install-html-gprofng + +install-html-gprofng: \ + configure-gprofng \ + html-gprofng + @: $(MAKE); $(unstage) + @[ -f ./gprofng/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing install-html in gprofng"; \ + (cd $(HOST_SUBDIR)/gprofng && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + install-html) \ + || exit 1 + +@endif gprofng + +.PHONY: maybe-installcheck-gprofng installcheck-gprofng +maybe-installcheck-gprofng: +@if gprofng +maybe-installcheck-gprofng: installcheck-gprofng + +installcheck-gprofng: \ + configure-gprofng + @: $(MAKE); $(unstage) + @[ -f ./gprofng/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing installcheck in gprofng"; \ + (cd $(HOST_SUBDIR)/gprofng && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + installcheck) \ + || exit 1 + +@endif gprofng + +.PHONY: maybe-mostlyclean-gprofng mostlyclean-gprofng +maybe-mostlyclean-gprofng: +@if gprofng +maybe-mostlyclean-gprofng: mostlyclean-gprofng + +mostlyclean-gprofng: + @: $(MAKE); $(unstage) + @[ -f ./gprofng/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing mostlyclean in gprofng"; \ + (cd $(HOST_SUBDIR)/gprofng && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + mostlyclean) \ + || exit 1 + +@endif gprofng + +.PHONY: maybe-clean-gprofng clean-gprofng +maybe-clean-gprofng: +@if gprofng +maybe-clean-gprofng: clean-gprofng + +clean-gprofng: + @: $(MAKE); $(unstage) + @[ -f ./gprofng/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing clean in gprofng"; \ + (cd $(HOST_SUBDIR)/gprofng && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + clean) \ + || exit 1 + +@endif gprofng + +.PHONY: maybe-distclean-gprofng distclean-gprofng +maybe-distclean-gprofng: +@if gprofng +maybe-distclean-gprofng: distclean-gprofng + +distclean-gprofng: + @: $(MAKE); $(unstage) + @[ -f ./gprofng/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing distclean in gprofng"; \ + (cd $(HOST_SUBDIR)/gprofng && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + distclean) \ + || exit 1 + +@endif gprofng + +.PHONY: maybe-maintainer-clean-gprofng maintainer-clean-gprofng +maybe-maintainer-clean-gprofng: +@if gprofng +maybe-maintainer-clean-gprofng: maintainer-clean-gprofng + +maintainer-clean-gprofng: + @: $(MAKE); $(unstage) + @[ -f ./gprofng/Makefile ] || exit 0; \ + r=`${PWD_COMMAND}`; export r; \ + s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ + $(HOST_EXPORTS) \ + for flag in $(EXTRA_HOST_FLAGS) ; do \ + eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ + done; \ + echo "Doing maintainer-clean in gprofng"; \ + (cd $(HOST_SUBDIR)/gprofng && \ + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ + "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ + "RANLIB=$${RANLIB}" \ + "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ + maintainer-clean) \ + || exit 1 + +@endif gprofng + + + .PHONY: configure-intl maybe-configure-intl maybe-configure-intl: @if gcc-bootstrap @@ -67847,6 +68338,8 @@ all-stagetrain-gas: maybe-all-stagetrain-intl all-stagefeedback-gas: maybe-all-stagefeedback-intl all-stageautoprofile-gas: maybe-all-stageautoprofile-intl all-stageautofeedback-gas: maybe-all-stageautofeedback-intl +install-gprofng: maybe-install-opcodes +install-gprofng: maybe-install-bfd configure-ld: maybe-configure-intl configure-stage1-ld: maybe-configure-stage1-intl configure-stage2-ld: maybe-configure-stage2-intl @@ -68287,6 +68780,7 @@ configure-gdb: stage_last configure-gdbserver: stage_last configure-gdbsupport: stage_last configure-gprof: stage_last +configure-gprofng: stage_last configure-sid: stage_last configure-sim: stage_last configure-fastjar: stage_last @@ -68321,6 +68815,12 @@ all-gprof: maybe-all-bfd all-gprof: maybe-all-opcodes all-gprof: maybe-all-intl all-gprof: maybe-all-gas +configure-gprofng: maybe-configure-intl +all-gprofng: maybe-all-libiberty +all-gprofng: maybe-all-bfd +all-gprofng: maybe-all-opcodes +all-gprofng: maybe-all-intl +all-gprofng: maybe-all-gas all-sid: maybe-all-libiberty all-sid: maybe-all-bfd all-sid: maybe-all-opcodes diff --git a/Makefile.tpl b/Makefile.tpl index 6586e90..36fa209 100644 --- a/Makefile.tpl +++ b/Makefile.tpl @@ -224,6 +224,7 @@ HOST_EXPORTS = \ OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ OTOOL="$(OTOOL)"; export OTOOL; \ + PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)"; export PKG_CONFIG_PATH; \ READELF="$(READELF)"; export READELF; \ AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \ AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \ @@ -450,6 +451,8 @@ GOCFLAGS = $(CFLAGS) GDCFLAGS = @GDCFLAGS@ GM2FLAGS = $(CFLAGS) +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ + # Pass additional PGO and LTO compiler options to the PGO build. BUILD_CFLAGS = $(PGO_BUILD_CFLAGS) $(PGO_BUILD_LTO_CFLAGS) override CFLAGS += $(BUILD_CFLAGS) diff --git a/config/zstd.m4 b/config/zstd.m4 new file mode 100644 index 0000000..eb34c0f --- /dev/null +++ b/config/zstd.m4 @@ -0,0 +1,23 @@ +dnl Copyright (C) 2022 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License. As a special exception to the GNU General +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. + +dnl Enable features using the zstd library. +AC_DEFUN([AC_ZSTD], [ +AC_ARG_WITH(zstd, + [AS_HELP_STRING([--with-zstd], [support zstd compressed debug sections (default=auto)])], + [], [with_zstd=auto]) + +AS_IF([test "$with_zstd" != no], + [PKG_CHECK_MODULES(ZSTD, [libzstd >= 1.4.0], [ + AC_DEFINE(HAVE_ZSTD, 1, [Define to 1 if zstd is enabled.]) + ], [ + if test "$with_zstd" = yes; then + AC_MSG_ERROR([--with-zstd was given, but pkgconfig/libzstd.pc is not found]) + fi + ]) + ]) +]) @@ -622,6 +622,7 @@ CXX_FOR_TARGET CC_FOR_TARGET RANLIB_PLUGIN_OPTION AR_PLUGIN_OPTION +PKG_CONFIG_PATH GDCFLAGS READELF OTOOL @@ -800,12 +801,16 @@ ac_user_opts=' enable_option_checking with_build_libsubdir with_system_zlib +with_zstd enable_as_accelerator_for enable_offload_targets enable_offload_defaulted enable_gold enable_ld +enable_gprofng enable_compressed_debug_sections +enable_default_compressed_debug_sections_algorithm +enable_year2038 enable_libquadmath enable_libquadmath_support enable_libada @@ -1542,9 +1547,14 @@ Optional Features: --enable-gold[=ARG] build gold [ARG={default,yes,no}] --enable-ld[=ARG] build ld [ARG={default,yes,no}] + --enable-gprofng[=ARG] build gprofng [ARG={yes,no}] --enable-compressed-debug-sections={all,gas,gold,ld,none} Enable compressed debug sections for gas, gold or ld by default + --enable-default-compressed-debug-sections-algorithm={zlib,zstd} + Default compression algorithm for + --enable-compressed-debug-sections. + --enable-year2038 enable support for timestamps past the year 2038 --disable-libquadmath do not build libquadmath directory --disable-libquadmath-support disable libquadmath support for Fortran @@ -1589,6 +1599,8 @@ Optional Packages: --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-build-libsubdir=DIR Directory where to find libraries for build system --with-system-zlib use installed libz + --with-zstd Support zstd compressed debug sections + (default=auto) --with-mpc=PATH specify prefix directory for installed MPC package. Equivalent to --with-mpc-include=PATH/include plus --with-mpc-lib=PATH/lib @@ -2963,6 +2975,13 @@ if test x$with_system_readline = xyes ; then noconfigdirs="$noconfigdirs readline" fi + +# Check whether --with-zstd was given. +if test "${with_zstd+set}" = set; then : + withval=$with_zstd; +fi + + # some tools are so dependent upon X11 that if we're not building with X, # it's not even worth trying to configure, much less build, that tool. @@ -3073,7 +3092,7 @@ case "${ENABLE_GOLD}" in # Check for target supported by gold. case "${target}" in i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-* \ - | aarch64*-*-* | mips*-*-* | s390*-*-* | loongarch*-*-*) + | aarch64*-*-* | tilegx*-*-* | mips*-*-* | s390*-*-* | loongarch*-*-*) configdirs="$configdirs gold" if test x${ENABLE_GOLD} = xdefault; then default_ld=gold @@ -3118,6 +3137,22 @@ $as_echo "$as_me: WARNING: neither ld nor gold are enabled" >&2;} ;; esac +# Check whether --enable-gprofng was given. +if test "${enable_gprofng+set}" = set; then : + enableval=$enable_gprofng; enable_gprofng=$enableval +else + enable_gprofng=yes +fi + +if test "$enable_gprofng" = "yes"; then + case "${target}" in + x86_64-*-linux* | i?86-*-linux* | aarch64-*-linux*) + configdirs="$configdirs gprofng" + ;; + esac +fi + + # PR gas/19109 # Decide the default method for compressing debug sections. # Provide a configure time option to override our default. @@ -3133,6 +3168,15 @@ else fi +# Select default compression algorithm. +# Check whether --enable-default_compressed_debug_sections_algorithm was given. +if test "${enable_default_compressed_debug_sections_algorithm+set}" = set; then : + enableval=$enable_default_compressed_debug_sections_algorithm; +else + default_compressed_debug_sections_algorithm= +fi + + # Configure extra directories which are host specific case "${host}" in @@ -3154,6 +3198,20 @@ case "${host}" in ;; esac +# Default to --disable-year2038 until we can handle differences between +# projects that use gnulib (which understands year 2038) and projects that +# do not (like BFD). +# Check whether --enable-year2038 was given. +if test "${enable_year2038+set}" = set; then : + enableval=$enable_year2038; ENABLE_YEAR2038=$enableval +else + ENABLE_YEAR2038=no +fi + +enable_year2038= +if test "${ENABLE_YEAR2038}" = "no" ; then + enable_year2038=no +fi # Check whether --enable-libquadmath was given. if test "${enable_libquadmath+set}" = set; then : @@ -3526,6 +3584,11 @@ case "${target}" in hppa*64*-*-hpux*) noconfigdirs="$noconfigdirs target-libffi" ;; + hppa*-hp-hpux11*) + ;; + hppa*-*-hpux*) + noconfigdirs="$noconfigdirs target-libffi" + ;; ia64*-*-*vms*) noconfigdirs="$noconfigdirs target-libffi" ;; @@ -3832,9 +3895,14 @@ case "${target}" in h8500-*-*) noconfigdirs="$noconfigdirs target-libgloss" ;; + hppa1.1-*-osf* | hppa1.1-*-bsd* ) + ;; hppa*64*-*-hpux*) noconfigdirs="$noconfigdirs gdb" ;; + hppa*-*-hpux11*) + noconfigdirs="$noconfigdirs gdb ld" + ;; hppa*64*-*-linux*) ;; hppa*-*-linux*) @@ -3989,6 +4057,9 @@ case "${target}" in tic6x-*-*) noconfigdirs="$noconfigdirs sim" ;; + tilepro*-*-* | tilegx*-*-*) + noconfigdirs="$noconfigdirs sim" + ;; v810-*-*) noconfigdirs="$noconfigdirs bfd binutils gas gdb ld opcodes target-libgloss" ;; @@ -10183,9 +10254,15 @@ if test "$silent" = yes; then baseargs="$baseargs --silent" tbaseargs="$tbaseargs --silent" fi + baseargs="$baseargs --disable-option-checking" tbaseargs="$tbaseargs --disable-option-checking" +if test "$enable_year2038" = no; then + baseargs="$baseargs --disable-year2038" + tbaseargs="$tbaseargs --disable-year2038" +fi + # Record and document user additions to sub configure arguments. @@ -12963,6 +13040,7 @@ fi GDCFLAGS=${GDCFLAGS-${CFLAGS}} + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -plugin option" >&5 $as_echo_n "checking for -plugin option... " >&6; } diff --git a/configure.ac b/configure.ac index 432a218..cb3e183 100644 --- a/configure.ac +++ b/configure.ac @@ -255,6 +255,9 @@ if test x$with_system_readline = xyes ; then noconfigdirs="$noconfigdirs readline" fi +AC_ARG_WITH(zstd, +[AS_HELP_STRING([--with-zstd], [Support zstd compressed debug sections (default=auto)])]) + # some tools are so dependent upon X11 that if we're not building with X, # it's not even worth trying to configure, much less build, that tool. @@ -361,7 +364,7 @@ case "${ENABLE_GOLD}" in # Check for target supported by gold. case "${target}" in i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-* \ - | aarch64*-*-* | mips*-*-* | s390*-*-* | loongarch*-*-*) + | aarch64*-*-* | tilegx*-*-* | mips*-*-* | s390*-*-* | loongarch*-*-*) configdirs="$configdirs gold" if test x${ENABLE_GOLD} = xdefault; then default_ld=gold @@ -403,6 +406,20 @@ case "${ENABLE_LD}" in ;; esac +AC_ARG_ENABLE(gprofng, +[AS_HELP_STRING([[--enable-gprofng[=ARG]]], + [build gprofng @<:@ARG={yes,no}@:>@])], +enable_gprofng=$enableval, +enable_gprofng=yes) +if test "$enable_gprofng" = "yes"; then + case "${target}" in + x86_64-*-linux* | i?86-*-linux* | aarch64-*-linux*) + configdirs="$configdirs gprofng" + ;; + esac +fi + + # PR gas/19109 # Decide the default method for compressing debug sections. # Provide a configure time option to override our default. @@ -416,6 +433,12 @@ AC_ARG_ENABLE(compressed_debug_sections, fi ], [enable_compressed_debug_sections=]) +# Select default compression algorithm. +AC_ARG_ENABLE(default_compressed_debug_sections_algorithm, +[AS_HELP_STRING([--enable-default-compressed-debug-sections-algorithm={zlib,zstd}], + [Default compression algorithm for --enable-compressed-debug-sections.])], +[], [default_compressed_debug_sections_algorithm=]) + # Configure extra directories which are host specific case "${host}" in @@ -437,6 +460,18 @@ case "${host}" in ;; esac +# Default to --disable-year2038 until we can handle differences between +# projects that use gnulib (which understands year 2038) and projects that +# do not (like BFD). +AC_ARG_ENABLE(year2038, +AS_HELP_STRING([--enable-year2038], + [enable support for timestamps past the year 2038]), +ENABLE_YEAR2038=$enableval, +ENABLE_YEAR2038=no) +enable_year2038= +if test "${ENABLE_YEAR2038}" = "no" ; then + enable_year2038=no +fi AC_ARG_ENABLE(libquadmath, AS_HELP_STRING([--disable-libquadmath], @@ -779,6 +814,11 @@ case "${target}" in hppa*64*-*-hpux*) noconfigdirs="$noconfigdirs target-libffi" ;; + hppa*-hp-hpux11*) + ;; + hppa*-*-hpux*) + noconfigdirs="$noconfigdirs target-libffi" + ;; ia64*-*-*vms*) noconfigdirs="$noconfigdirs target-libffi" ;; @@ -1082,9 +1122,14 @@ case "${target}" in h8500-*-*) noconfigdirs="$noconfigdirs target-libgloss" ;; + hppa1.1-*-osf* | hppa1.1-*-bsd* ) + ;; hppa*64*-*-hpux*) noconfigdirs="$noconfigdirs gdb" ;; + hppa*-*-hpux11*) + noconfigdirs="$noconfigdirs gdb ld" + ;; hppa*64*-*-linux*) ;; hppa*-*-linux*) @@ -1239,6 +1284,9 @@ case "${target}" in tic6x-*-*) noconfigdirs="$noconfigdirs sim" ;; + tilepro*-*-* | tilegx*-*-*) + noconfigdirs="$noconfigdirs sim" + ;; v810-*-*) noconfigdirs="$noconfigdirs bfd binutils gas gdb ld opcodes target-libgloss" ;; @@ -3325,9 +3373,15 @@ if test "$silent" = yes; then baseargs="$baseargs --silent" tbaseargs="$tbaseargs --silent" fi + baseargs="$baseargs --disable-option-checking" tbaseargs="$tbaseargs --disable-option-checking" +if test "$enable_year2038" = no; then + baseargs="$baseargs --disable-year2038" + tbaseargs="$tbaseargs --disable-year2038" +fi + # Record and document user additions to sub configure arguments. AC_ARG_VAR([build_configargs], [additional configure arguments for build directories]) @@ -3676,6 +3730,7 @@ AC_SUBST(CXXFLAGS) AC_SUBST(GDC) AC_SUBST(GDCFLAGS) GDCFLAGS=${GDCFLAGS-${CFLAGS}} +AC_SUBST(PKG_CONFIG_PATH) GCC_PLUGIN_OPTION(PLUGIN_OPTION) AR_PLUGIN_OPTION= diff --git a/include/collectorAPI.h b/include/collectorAPI.h new file mode 100644 index 0000000..010074a --- /dev/null +++ b/include/collectorAPI.h @@ -0,0 +1,73 @@ +/* Copyright (C) 2021-2023 Free Software Foundation, Inc. + Contributed by Oracle. + + This file is part of GNU Binutils. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, 51 Franklin Street - Fifth Floor, Boston, + MA 02110-1301, USA. */ + +#ifndef _COLLECTORAPI_H +#define _COLLECTORAPI_H + +/* This file contains function prototypes for the user-callable API + routines in libcollector. */ + +#include <pthread.h> + +#ifdef __cplusplus +extern "C" +{ +#endif + /* Routine to record a sample in the experiment. */ + extern void collector_sample (const char *name); + + /* Routine to suspend data collection during an experiment. */ + extern void collector_pause (void); + + /* Routine to resume data collection during an experiment. */ + extern void collector_resume (void); + + /* Routine to suspend per-thread data collection during an experiment. */ + extern void collector_thread_pause (pthread_t tid); + + /* Routine to resume per-thread data collection during an experiment. */ + extern void collector_thread_resume (pthread_t tid); + + /* Routine to close the experiment, and stop all data collection. */ + extern void collector_terminate_expt (void); + + typedef struct + { + unsigned int offset; + unsigned int lineno; + } Lineno; + + /* Routines to let libcollector know about dynamically loaded functions. */ + extern void collector_func_load (const char *name, const char *alias, + const char *sourcename, void *vaddr, + int size, int lntsize, Lineno *lntable); + + extern void collector_func_unload (void *vaddr); + +#ifdef NEED_COLLECTOR_MODULE + extern void collector_module_load (const char *modulename, void *vaddr); + extern void collector_module_unload (void *vaddr); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _COLLECTORAPI_H */ diff --git a/include/libcollector.h b/include/libcollector.h new file mode 100644 index 0000000..e1c2a44 --- /dev/null +++ b/include/libcollector.h @@ -0,0 +1,89 @@ +/* Copyright (C) 2021-2023 Free Software Foundation, Inc. + Contributed by Oracle. + + This file is part of GNU Binutils. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, 51 Franklin Street - Fifth Floor, Boston, + MA 02110-1301, USA. */ + +#ifndef _LIBCOLLECTOR_H +#define _LIBCOLLECTOR_H + +typedef struct +{ + unsigned int offset; + unsigned int lineno; +} Lineno; + +#ifdef __cplusplus +extern "C" +{ +#endif + + /* This file contains function prototypes for the user-callable API + routines in libcollector for C and C++ codes. */ + + /* Routine to record a sample in the experiment. */ + void collector_sample (char *name); + + /* Routine to suspend data collection during an experiment. */ + void collector_pause (void); + + /* Routine to resume data collection during an experiment. */ + void collector_resume (void); + + /* Routine to suspend per-thread data collection during an experiment. */ + void collector_thread_pause (unsigned int tid); + + /* Routine to resume per-thread data collection during an experiment. */ + void collector_thread_resume (unsigned int tid); + + /* Routine to close the experiment, and stop all data collection. */ + void collector_terminate_expt (void); + + /* Routines to let libcollector know about a dynamically loaded function. */ + void collector_func_load (char *name, char *alias, char *sourcename, + void *vaddr, int size, int lntsize, Lineno *lntable); + void collector_func_unload (void *vaddr); + + /* Define the weak symbols for the API. */ + void collector_sample () __attribute__ ((weak)); + void collector_pause () __attribute__ ((weak)); + void collector_resume () __attribute__ ((weak)); + void collector_thread_pause () __attribute__ ((weak)); + void collector_thread_resume () __attribute__ ((weak)); + void collector_terminate_expt () __attribute__ ((weak)); + void collector_func_load () __attribute__ ((weak)); + void collector_func_unload () __attribute__ ((weak)); + +#ifdef __cplusplus +} +#endif + +/* Define the macros that actually get inserted in the caller's code. */ +#define collector_sample(x) (collector_sample ? collector_sample(x), 0 : 0) +#define collector_pause() (collector_pause ? collector_pause(), 0 : 0) +#define collector_resume() (collector_resume ? collector_resume(),0 : 0 +#define collector_thread_pause(tid) \ + (collector_thread_pause ? collector_thread_pause(tid), 0 : 0) +#define collector_thread_resume(tid) \ + (collector_thread_resume ? collector_thread_resume(tid), 0 : 0) +#define collector_terminate_expt() \ + (collector_terminate_expt ? collector_terminate_expt(), 0 : 0) +#define collector_func_load(x0,x1,x2,x3,x4,x5,x6) \ + collector_func_load ? collector_func_load(x0,x1,x2,x3,x4,x5,x6), 0 : 0) +#define collector_func_unload(x) \ + (collector_func_unload ? collector_func_unload(x), 0 : 0) +#endif /* _LIBCOLLECTOR_H */ diff --git a/include/libfcollector.h b/include/libfcollector.h new file mode 100644 index 0000000..1dc6b14 --- /dev/null +++ b/include/libfcollector.h @@ -0,0 +1,42 @@ +! Copyright (C) 2021-2023 Free Software Foundation, Inc. +! Contributed by Oracle. +! +! This file is part of GNU Binutils. +! +! This program is free software; you can redistribute it and/or modify +! it under the terms of the GNU General Public License as published by +! the Free Software Foundation; either version 3, or (at your option) +! any later version. +! +! This program 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 General Public License for more details. +! +! You should have received a copy of the GNU General Public License +! along with this program; if not, write to the Free Software +! Foundation, 51 Franklin Street - Fifth Floor, Boston, +! MA 02110-1301, USA. +! +! Developer Sampling Collector interface include file + + interface + + ! Routine to record a sample in the experiment. + subroutine collector_sample(name) + character(len=*), intent(in) :: name + end subroutine + + ! Routine to suspend data collection during an experiment. + subroutine collector_pause() + end subroutine + + ! Routine to resume data collection during an experiment. + subroutine collector_resume() + end subroutine + + ! Routine to stop all data collection and close the experiment. + subroutine collector_terminate_expt() + end subroutine + + end interface |