From ce0fa621eb35d47247ebb54742b486adf64588c8 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Wed, 15 Jul 2020 18:34:33 -0400 Subject: [PATCH] configury: make systemtap buildable with gcc -flto Two problems corrected: 1 - Some of the stap object files compiled the interned_string type differently based on whether config.h was #included early enough or not. Now they all do it at the top. 2 - The staprun/libstrfloctime.a pseudo-archive (added in commit 0a5f4aa83e5b4 to work around an autoconf limitation), needs a -Wl,--whole-archive wrapper around it for lto linking purposes. Now also stap builds on f32 both with and without: make CXX="g++ -flto" CC="gcc -flto" --- coveragedb.cxx | 2 +- java/Makefile.in | 2 +- python/Makefile.in | 2 +- stap-exporter/Makefile.in | 2 +- staprun/Makefile.am | 5 +++-- staprun/Makefile.in | 7 +++++-- tapset-been.cxx | 1 + 7 files changed, 13 insertions(+), 8 deletions(-) diff --git a/coveragedb.cxx b/coveragedb.cxx index 5b1e8fa0f..4f37babc4 100644 --- a/coveragedb.cxx +++ b/coveragedb.cxx @@ -6,9 +6,9 @@ // Public License (GPL); either version 2, or (at your option) any // later version. +#include "config.h" #include "parse.h" #include "coveragedb.h" -#include "config.h" #include "elaborate.h" #include "tapsets.h" #include "session.h" diff --git a/java/Makefile.in b/java/Makefile.in index 2af5cf1ba..c5b558cde 100644 --- a/java/Makefile.in +++ b/java/Makefile.in @@ -676,8 +676,8 @@ maintainer-clean-generic: @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) @HAVE_JAVA_FALSE@install-exec-local: -@HAVE_JAVA_FALSE@install-data-local: @HAVE_JAVA_FALSE@uninstall-local: +@HAVE_JAVA_FALSE@install-data-local: clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-noinstPROGRAMS \ diff --git a/python/Makefile.in b/python/Makefile.in index bf97e028c..65d973b1f 100644 --- a/python/Makefile.in +++ b/python/Makefile.in @@ -524,8 +524,8 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -@HAVE_PYTHON_PROBES_FALSE@install-exec-local: @HAVE_PYTHON_PROBES_FALSE@clean-local: +@HAVE_PYTHON_PROBES_FALSE@install-exec-local: clean: clean-am clean-am: clean-generic clean-local mostlyclean-am diff --git a/stap-exporter/Makefile.in b/stap-exporter/Makefile.in index 6b41eb8b3..f7da3f967 100644 --- a/stap-exporter/Makefile.in +++ b/stap-exporter/Makefile.in @@ -513,8 +513,8 @@ maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." @HAVE_PYTHON3_PROBES_FALSE@clean-local: -@HAVE_PYTHON3_PROBES_FALSE@uninstall-local: @HAVE_PYTHON3_PROBES_FALSE@install-data-local: +@HAVE_PYTHON3_PROBES_FALSE@uninstall-local: clean: clean-am clean-am: clean-generic clean-local mostlyclean-am diff --git a/staprun/Makefile.am b/staprun/Makefile.am index 65152d648..4fa093c27 100644 --- a/staprun/Makefile.am +++ b/staprun/Makefile.am @@ -28,7 +28,7 @@ staprun_CFLAGS = $(AM_CFLAGS) -DSINGLE_THREADED $(debuginfod_CFLAGS) staprun_CXXFLAGS = $(AM_CXXFLAGS) -DSINGLE_THREADED staprun_CPPFLAGS = $(AM_CPPFLAGS) staprun_LDADD = libstrfloctime.a $(staprun_LIBS) $(debuginfod_LIBS) -staprun_LDFLAGS = $(AM_LDFLAGS) +staprun_LDFLAGS = $(AM_LDFLAGS) -Wl,--whole-archive,libstrfloctime.a,--no-whole-archive if HAVE_NSS staprun_SOURCES += modverify.c ../nsscommon.cxx @@ -42,7 +42,8 @@ staprun_LDADD += $(openssl_LIBS) endif stapio_SOURCES = stapio.c mainloop.c common.c ctl.c relay.c relay_old.c monitor.c -stapio_LDADD = libstrfloctime.a -lpthread +stapio_LDADD = libstrfloctime.a -lpthread +stapio_LDFLAGS = -Wl,--whole-archive,libstrfloctime.a,--no-whole-archive if HAVE_MONITOR_LIBS stapio_LDADD += $(jsonc_LIBS) -lpanel $(ncurses_LIBS) diff --git a/staprun/Makefile.in b/staprun/Makefile.in index facc75e77..8ca93fdd8 100644 --- a/staprun/Makefile.in +++ b/staprun/Makefile.in @@ -137,6 +137,8 @@ am__DEPENDENCIES_1 = @HAVE_MONITOR_LIBS_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) \ @HAVE_MONITOR_LIBS_TRUE@ $(am__DEPENDENCIES_1) stapio_DEPENDENCIES = libstrfloctime.a $(am__DEPENDENCIES_2) +stapio_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(stapio_LDFLAGS) \ + $(LDFLAGS) -o $@ am__dirstamp = $(am__leading_dot)dirstamp @HAVE_NSS_TRUE@am__objects_1 = staprun-modverify.$(OBJEXT) \ @HAVE_NSS_TRUE@ ../staprun-nsscommon.$(OBJEXT) @@ -498,9 +500,10 @@ staprun_CXXFLAGS = $(AM_CXXFLAGS) -DSINGLE_THREADED $(am__append_3) staprun_CPPFLAGS = $(AM_CPPFLAGS) staprun_LDADD = libstrfloctime.a $(staprun_LIBS) $(debuginfod_LIBS) \ $(am__append_4) $(am__append_5) -staprun_LDFLAGS = $(AM_LDFLAGS) +staprun_LDFLAGS = $(AM_LDFLAGS) -Wl,--whole-archive,libstrfloctime.a,--no-whole-archive stapio_SOURCES = stapio.c mainloop.c common.c ctl.c relay.c relay_old.c monitor.c stapio_LDADD = libstrfloctime.a -lpthread $(am__append_6) +stapio_LDFLAGS = -Wl,--whole-archive,libstrfloctime.a,--no-whole-archive man_MANS = staprun.8 stap_merge_SOURCES = stap_merge.c stap_merge_CFLAGS = $(AM_CFLAGS) @@ -649,7 +652,7 @@ stap-merge$(EXEEXT): $(stap_merge_OBJECTS) $(stap_merge_DEPENDENCIES) $(EXTRA_st stapio$(EXEEXT): $(stapio_OBJECTS) $(stapio_DEPENDENCIES) $(EXTRA_stapio_DEPENDENCIES) @rm -f stapio$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(stapio_OBJECTS) $(stapio_LDADD) $(LIBS) + $(AM_V_CCLD)$(stapio_LINK) $(stapio_OBJECTS) $(stapio_LDADD) $(LIBS) ../$(am__dirstamp): @$(MKDIR_P) .. @: > ../$(am__dirstamp) diff --git a/tapset-been.cxx b/tapset-been.cxx index 6afbb8fcb..e4b303961 100644 --- a/tapset-been.cxx +++ b/tapset-been.cxx @@ -7,6 +7,7 @@ // Public License (GPL); either version 2, or (at your option) any // later version. +#include "config.h" #include "session.h" #include "tapsets.h" #include "translate.h" -- 2.43.5