]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
dtrace, ctf: build sdtstubs and CTF after sdtinfo; sdtinfo follows modpost
authorNick Alcock <nick.alcock@oracle.com>
Fri, 1 Jul 2016 14:38:01 +0000 (15:38 +0100)
committerNick Alcock <nick.alcock@oracle.com>
Mon, 4 Jul 2016 16:14:21 +0000 (17:14 +0100)
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 <nick.alcock@oracle.com>
Acked-by: Kris Van Hees <kris.van.hees@oracle.com
scripts/Makefile.modpost

index 2ad9dd919661b44cce714a9239e070f580e1babb..8a94bea22553bf345819a10cb2a72700da7b5273 100644 (file)
@@ -13,7 +13,7 @@
 # 2) modpost is then used to
 # 3)  create one <module>.mod.c file pr. module
 # 4)  create one Module.symvers file with CRC for all exported symbols
-# 5) compile all <module>.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 <module.ko> 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; \