@@ -113,3 +113,5 @@ all.config
# Kdevelop4
*.kdev4
+
+scripts/module-common.lds
@@ -408,6 +408,10 @@ KBUILD_AFLAGS_MODULE := -DMODULE
KBUILD_CFLAGS_MODULE := -DMODULE
KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds
+$(srctree)/scripts/module-common.lds: $(srctree)/scripts/module-common.lds.S
+ $(Q)$(CC) $(CFLAGS) $(INCLUDES) $(LINUXINCLUDE) -E -P \
+ -D__ASSEMBLY__ -DLINKER_SCRIPT -o $@ $<
+
# Read KERNELRELEASE from include/config/kernel.release (if it exists)
KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
@@ -1178,7 +1182,7 @@ all: modules
# using awk while concatenating to the final file.
PHONY += modules
-modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin
+modules: $(srctree)/scripts/module-common.lds $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin
$(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order
@$(kecho) ' Building modules, stage 2.';
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
@@ -121,7 +121,7 @@ quiet_cmd_ld_ko_o = LD [M] $@
$(KBUILD_LDFLAGS_MODULE) $(LDFLAGS_MODULE) \
-o $@ $(filter-out FORCE,$^)
-$(modules): %.ko :%.o %.mod.o FORCE
+$(modules): %.ko : $(srctree)/scripts/module-common.lds %.o %.mod.o FORCE
$(call if_changed,ld_ko_o)
targets += $(modules)
similarity index 100%
rename from scripts/module-common.lds
rename to scripts/module-common.lds.S
scripts/module-common.lds is currently pretty static, in the future this may change and we will want access to kernel macros to help expands certain areas. To get access to use macros we need to generate module-common.lds from module-common.lds.S, for now though only enable the generation. We'll later expand on this as needed. Since this file is now generated add it to .gitignore. v3: new to this series Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org> --- .gitignore | 2 ++ Makefile | 6 +++++- scripts/Makefile.modpost | 2 +- scripts/{module-common.lds => module-common.lds.S} | 0 4 files changed, 8 insertions(+), 2 deletions(-) rename scripts/{module-common.lds => module-common.lds.S} (100%)