]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
ctf: fix the signed-modules case
authorNick Alcock <nick.alcock@oracle.com>
Fri, 10 Aug 2012 22:52:19 +0000 (23:52 +0100)
committerNick Alcock <nick.alcock@oracle.com>
Mon, 29 Jun 2015 21:40:30 +0000 (22:40 +0100)
The code in Makefile.modpost's module-ctf-flags variable which computes the name
of the CTF file, given the name of the kernel module being linked, was torpedoed
by the name of the unsigned module that is linked when module signing is in use.
So introduce a new ctf-module-name variable that substitutes the name
appropriately given the state of module signing.

Also, fix up some related places where I used spaces instead of tabs by mistake.

(3.6: most signed-modules code omitted, but a bit of supporting code remains
 in readiness for signed modules in 3.7.)

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
scripts/Makefile.modpost

index cd6da8c7a663c0bace418467993b7ad389eb29fa..27b6e809d781b2cfa188079aad2cdbcc3c572338 100644 (file)
@@ -179,16 +179,25 @@ $(ctf-stamp): $(builtins) $(modules:.ko=.o)
 module-ctfs-modular-prereq = $$(addprefix .ctf/,$$(notdir $$*.mod.ctf))
 module-ctfs-modular = $(addprefix .ctf/,$(notdir $*.mod.ctf))
 
+# Expands to the name of a CTF file, given a target of a module name given to
+# one of the link rules below.
+
+ifneq ($(CONFIG_MODULE_SIG),y)
+ctf-module-name = $(addprefix .ctf/,$(notdir $(basename $@)).mod.ctf)
+else
+ctf-module-name = $(addprefix .ctf/,$(notdir $(basename $(basename $@))).mod.ctf)
+endif
+
 # Expands to a series of objcopy --add-section arguments to add all
 # necessary CTF files to a module, with appropriate section names.
 # We also take advantage of the opportunity to strip the guaranteed-
 # useless debugging information out of dtrace_ctf.ko at the same time.
 
-module-ctf-flags = $(if $(filter dtrace_ctf.ko,$(notdir $@)), \
+module-ctf-flags = $(if $(filter dtrace_ctf.ko dtrace_ctf.ko.unsigned,$(notdir $@)), \
                   --strip-debug \
-                   $(foreach builtin,$(wildcard .ctf/*.builtin.ctf), \
-                             --add-section $(patsubst %.builtin.ctf,.dtrace_ctf.%,$(notdir $(builtin)))=$(builtin)), \
-                   --add-section .dtrace_ctf=$(addprefix .ctf/,$(notdir $(basename $@)).mod.ctf))
+                  $(foreach builtin,$(wildcard .ctf/*.builtin.ctf), \
+                            --add-section $(patsubst %.builtin.ctf,.dtrace_ctf.%,$(notdir $(builtin)))=$(builtin)), \
+                  --add-section .dtrace_ctf=$(ctf-module-name))
 
 # We have to put content in our dummy no-CTF files because --add-section
 # in binutils 2.20 silently fails if asked to add an empty file as a section.
@@ -208,11 +217,11 @@ endif
 
 # Step 7), final link of the modules
 quiet_cmd_ld_ko_o = LD [M]  $@
-      cmd_ld_ko_o = $(LD) -r $(LDFLAGS)                                 \
-                             $(KBUILD_LDFLAGS_MODULE) $(LDFLAGS_MODULE) \
-                             $(LDFLAGS_$(modname)) -o $@.tmp            \
-                             $(patsubst .ctf/%,,$(filter-out FORCE,$^)) && \
-                    $(OBJCOPY) $(module-ctf-flags) $@.tmp $@ && rm -f $@.tmp
+      cmd_ld_ko_o = $(LD) -r $(LDFLAGS)                                        \
+                            $(KBUILD_LDFLAGS_MODULE) $(LDFLAGS_MODULE) \
+                            $(LDFLAGS_$(modname)) -o $@.tmp            \
+                            $(patsubst .ctf/%,,$(filter-out FORCE,$^)) && \
+                   $(OBJCOPY) $(module-ctf-flags) $@.tmp $@ && rm -f $@.tmp
 
 $(modules): %.ko : %.o %.mod.o $(module-ctfs-modular-prereq) FORCE
        $(call cmd_touch_ctf)