3 @@ -366,6 +366,7 @@ KBUILD_AFLAGS := -D__ASSEMBLY__
4 KBUILD_AFLAGS_MODULE := -DMODULE
5 KBUILD_CFLAGS_MODULE := -DMODULE
6 KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds
7 +KBUILD_LDFLAGS_MODULE_PREREQ :=
9 # Read KERNELRELEASE from include/config/kernel.release (if it exists)
10 KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
11 @@ -375,7 +376,7 @@ export VERSION PATCHLEVEL SUBLEVEL KERNE
12 export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC
13 export CPP AR NM STRIP OBJCOPY OBJDUMP
14 export MAKE AWK GENKSYMS INSTALLKERNEL PERL UTS_MACHINE
15 -export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
16 +export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE KBUILD_LDFLAGS_MODULE_PREREQ CHECK CHECKFLAGS
18 export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
19 export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE CFLAGS_GCOV
20 --- a/arch/powerpc/Makefile
21 +++ b/arch/powerpc/Makefile
22 @@ -94,7 +94,7 @@ else
26 -KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
27 +KBUILD_LDFLAGS_MODULE_PREREQ += arch/powerpc/lib/crtsavres.o
29 ifeq ($(CONFIG_TUNE_CELL),y)
30 KBUILD_CFLAGS += $(call cc-option,-mtune=cell)
31 --- a/scripts/Makefile.modpost
32 +++ b/scripts/Makefile.modpost
33 @@ -110,7 +110,14 @@ quiet_cmd_cc_o_c = CC $@
34 cmd_cc_o_c = $(CC) $(c_flags) $(KBUILD_CFLAGS_MODULE) $(CFLAGS_MODULE) \
37 -$(modules:.ko=.mod.o): %.mod.o: %.mod.c FORCE
38 +quiet_cmd_as_o_S = AS $(quiet_modtag) $@
39 +cmd_as_o_S = $(CC) $(a_flags) $(AFLAGS_MODULE) -c -o $@ $<
41 +$(KBUILD_LDFLAGS_MODULE_PREREQ): %.o: %.S FORCE
42 + $(Q)mkdir -p $(dir $@)
43 + $(call if_changed_dep,as_o_S)
45 +$(modules:.ko=.mod.o): %.mod.o: %.mod.c $(KBUILD_LDFLAGS_MODULE_PREREQ) FORCE
46 $(call if_changed_dep,cc_o_c)
48 targets += $(modules:.ko=.mod.o)
49 @@ -119,6 +126,7 @@ targets += $(modules:.ko=.mod.o)
50 quiet_cmd_ld_ko_o = LD [M] $@
51 cmd_ld_ko_o = $(LD) -r $(LDFLAGS) \
52 $(KBUILD_LDFLAGS_MODULE) $(LDFLAGS_MODULE) \
53 + $(KBUILD_LDFLAGS_MODULE_PREREQ) \
54 -o $@ $(filter-out FORCE,$^)
56 $(modules): %.ko :%.o %.mod.o FORCE