File rawhide-6.13-kbuild-compatibility.patch of Package systemtap
From: Frank Ch. Eigler <fche@redhat.com>
Date: Fri Jan 17 19:40:56 2025 -0500
Subject: rawhide (6.13) kbuild compatibility
Git-commit: 048ee97b8d57209e824c7078b34f4a130da40363
Signed-off-by: Tony Jones <tonyj@suse.de>
PR32458: rawhide (6.13) kbuild compatibility
Subject kernel versions introduce changes to the kbuild $(MAKE)
invocations process command line options, and twiddle with working
directories, making our systemtap module Makefile not quite
compatible. Sprinkle $(obj)/ liberally around all the generated
header files (used for autoconf* purposes) and nearby. This appears
to make both >6.13 and <6.13 kbuilds happy.
diff --git a/buildrun.cxx b/buildrun.cxx
index 1dae071d1..f369135af 100644
--- a/buildrun.cxx
+++ b/buildrun.cxx
@@ -186,7 +186,7 @@ output_autoconf(systemtap_session& s, ofstream& o,
const char *deffalse)
{
autoconf_c_files.push_back (autoconf_c);
- o << endl << s.tmpdir << "/" << autoconf_c << ".h:" << endl;
+ o << endl << "$(obj)/" << autoconf_c << ".h:" << endl;
o << "\t";
if (s.verbose < 4)
o << "@";
@@ -286,7 +286,8 @@ compile_pass (systemtap_session& s)
string makefile_nm = s.tmpdir + "/Makefile";
ofstream o (makefile_nm.c_str());
- string stap_export_nm = s.tmpdir + "/stapconf_export.h";
+ string stap_export_basenm = "stapconf_export.h";
+ string stap_export_nm = s.tmpdir + "/" + stap_export_basenm;
ofstream o2 (stap_export_nm.c_str());
// Create makefile
@@ -343,7 +344,7 @@ compile_pass (systemtap_session& s)
o << module_cflags << " += -Wmissing-prototypes" << endl; // GCC14 prep, PR31288
- o << "STAPCONF_HEADER := " << s.tmpdir << "/" << s.stapconf_name << endl;
+ o << "STAPCONF_HEADER := " << "$(obj)/" << s.stapconf_name << endl;
o << ".DELETE_ON_ERROR: $(STAPCONF_HEADER)" << endl;
vector<string> cs; // to hold autoconf C file names
@@ -568,16 +569,16 @@ compile_pass (systemtap_session& s)
// PR32458 (!) Build the combined conf header as an ordinary
// dependency of the module.o file. Don't invoke a sub-$(MAKE) with
// crude command line parsing.
- o << "$(STAPCONF_HEADER): " << stap_export_nm;
+ o << "$(STAPCONF_HEADER): " << "$(obj)/" << stap_export_basenm;
for (unsigned i=0; i<cs.size(); i++)
- o << " " << s.tmpdir << "/" << cs[i] << ".h";
+ o << " " << "$(obj)/" << cs[i] << ".h";
o << endl;
o << "\t";
if (s.verbose < 4)
o << "@";
o << "cat $^ > $(STAPCONF_HEADER)" << endl;
- o << s.module_name <<".o : $(STAPCONF_HEADER)" << endl;
+ o << "$(obj)/" << s.module_name <<".o : $(STAPCONF_HEADER)" << endl;
o << module_cflags << " += -include $(STAPCONF_HEADER)" << endl;
@@ -692,18 +693,20 @@ compile_pass (systemtap_session& s)
}
o << " stap_symbols.o" << endl;
- o << s.tmpdir << "/stap_symbols.o: $(STAPCONF_HEADER)" << endl;
+ o << "$(obj)/stap_symbols.o: $(STAPCONF_HEADER)" << endl;
// add all stapconf dependencies
string translated = s.translated_source;
+ translated = translated.substr(translated.rfind('/')+1); // basename
translated[translated.size()-1] = 'o';
- o << translated << ": $(STAPCONF_HEADER)" << endl;
+ o << "$(obj)/" << translated << ": $(STAPCONF_HEADER)" << endl;
translated[translated.size()-1] = 'i';
- o << translated << ": $(STAPCONF_HEADER)" << endl;
+ o << "$(obj)/" << translated << ": $(STAPCONF_HEADER)" << endl;
for (unsigned i=0; i<s.auxiliary_outputs.size(); i++) {
translated = s.auxiliary_outputs[i]->filename;
+ translated = translated.substr(translated.rfind('/')+1); // basename
translated[translated.size()-1] = 'o';
- o << translated << ": $(STAPCONF_HEADER)" << endl;
+ o << "$(obj)/" << translated << ": $(STAPCONF_HEADER)" << endl;
}
o.close ();
@@ -723,7 +726,7 @@ compile_pass (systemtap_session& s)
// Run make
vector<string> make_cmd = make_make_cmd(s, s.tmpdir);
- if (s.keep_tmpdir)
+ if (false && s.keep_tmpdir) // PR32458: kbuild 6.13+ can't abide multiple make targets
{
string E_source = s.translated_source.substr(s.translated_source.find_last_of("/")+1);
E_source.at(E_source.length() - 1) = 'i'; // overwrite the last character