From 59d28d52983c811dac8f4ebf5a86f1442c221186 Mon Sep 17 00:00:00 2001 From: Nick Alcock Date: Fri, 1 Jul 2016 15:38:01 +0100 Subject: [PATCH] dtrace, ctf: build sdtstubs and CTF after sdtinfo; sdtinfo follows modpost In the following commit, sdtinfo generation will begin to rewrite the .o file. When this is happening, we cannot have sdtstubs generation, dwarf2ctf, or modpost run in parallel with it, since they all read the .o file (in modpost's case, for symbol versions; in sdtstubs' case, for the list of symbols; in dwarf2ctf's case, for the debugging info). So have both of the latter depend on the sdtinfo.c files that the sdtinfo pass generates. We force sdtinfo generation to run after modpost by depending on the .mod.c files modpost generates. For the CTF side of things, we use an order-only prerequisite because sdtinfo's changes do not change anything which might require dwarf2ctf to rerun, and so as not to disturb $^, which we use to build the list of files dwarf2ctf should run over. Signed-off-by: Nick Alcock Acked-by: Kris Van Hees .mod.c file pr. module # 4) create one Module.symvers file with CRC for all exported symbols -# 5) compile all .mod.c files +# 5) compute SDT offsets, generate SDT stubs, and compile all .mod.c files # 6) generate CTF for the entire kernel, or for the module alone if this is # a build of an external module # 7) final link of the module to a file @@ -128,10 +128,13 @@ quiet_cmd_sdtinfo = SDTINF $@ quiet_cmd_sdtstub = SDTSTB $@ cmd_sdtstub = $(sdtgen) sdtstub $@ $< -$(modules:.ko=.sdtinfo.c): %.sdtinfo.c: %.o +# We depend on the .mod.c file to ensure that modpost runs before sdtinfo. +$(modules:.ko=.sdtinfo.c): %.sdtinfo.c: %.o %.mod.c $(call cmd,sdtinfo) -$(modules:.ko=.sdtstub.S) : %.sdtstub.S: %.o +# We depend on the sdtinfo file because info generation rewrites the .o, +# while sdtstubs reads it. +$(modules:.ko=.sdtstub.S) : %.sdtstub.S: %.o %.sdtinfo.c $(call cmd,sdtstub) $(modules:.ko=.mod.o): %.mod.o: %.mod.c %.sdtinfo.c FORCE @@ -215,7 +218,7 @@ define add-ctf-filelists-cmd $(foreach file,$(1),$(call add-ctf-filelist-cmd,$(file))) endef -$(ctf-filelist): $(builtins) $(modules:.ko=.o) +$(ctf-filelist): $(builtins) $(modules:.ko=.o) | $(modules:.ko=.sdtinfo.c) @rm -f $(ctf-filelist); @mkdir -p $(ctf-dir); $(call add-ctf-filelists-cmd,$^) @@ -223,6 +226,8 @@ $(ctf-filelist): $(builtins) $(modules:.ko=.o) # We depend upon a stamp file in lieu of the builtin modules' CTF files, because # the names of the generated CTF files for the builtins are so variable. # (Standalone modules get their own per-module stamp files.) +# The stamp file then depends on the .o files for the modules, and on the +# sdtinfo files (for the same reason that the sdtstub does). $(ctf-stamp): $(ctf-filelist) $(call if_changed,ctf) @shopt -s nullglob; \ -- 2.50.1