From: Nick Alcock Date: Fri, 10 Aug 2012 22:52:19 +0000 (+0100) Subject: ctf: fix the signed-modules case X-Git-Tag: v4.1.12-92~313^2~125 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=1589d5c3ab7934e9579112247393c62a10fb8f4d;p=users%2Fjedix%2Flinux-maple.git ctf: fix the signed-modules case 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 --- diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index cd6da8c7a663c..27b6e809d781b 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost @@ -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)