summaryrefslogtreecommitdiff
path: root/scripts/Makefile.lib
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2002-12-01 02:15:26 -0800
committerJames Bottomley <jejb@raven.il.steeleye.com>2002-12-01 02:15:26 -0800
commitc99f5cea7036f066e9cdefade80a85f0c4f13d93 (patch)
tree9f22f0cd5b16e8da9930261325903546351c0595 /scripts/Makefile.lib
parent1504317a0d85ff9cbf729d9d4ff3886aacc7a695 (diff)
[PATCH] module names fix
By Kai Germaschewski: "Well, I have another solution, which doesn't need additional Makefile magic or anything. I just put the module name into each .o file where <linux/module.h> is included. Putting it into the section .gnu.linkonce.modname has the effect that even for multi-part modules, we only end up with one copy of the name. Caveat: I'm using the preprocessor macro KBUILD_MODNAME to know what to put into .gnu.linkonce.modname. The following used to happen: (drivers/isdn/eicon/Makefile) divas-objs := common.o Divas_mod.o ... eicon-objs := common.o eicon_mod.o ... Divas_mod.o is compiled with -DKBUILD_MODNAME=divas eicon_mod.o is compiled with -DKBUILD_MODNAME=eicon common.o is compiled with -DKBUILD_MODNAME=divas_eicon So in the case above, both divas.o and eicon.o would end up with a .gnu.linkonce.modname section containing "divas_eicon" My fix to this is to not define KBUILD_MODNAME when compiling an object whilch will be linked into more than one module - so common.o gets no .gnu.linkonce.modname section at all. Works fine here. Now, doing this I remove one of the reasons why we would need modules linked as '.ko' ;), but it seems much cleaner than generating a temporary file, using objcopy etc."
Diffstat (limited to 'scripts/Makefile.lib')
-rw-r--r--scripts/Makefile.lib6
1 files changed, 3 insertions, 3 deletions
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 95026d841a1c..c8e1528aae55 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -124,14 +124,14 @@ depfile = $(subst $(comma),_,$(@D)/.$(@F).d)
# than one module. In that case KBUILD_MODNAME will be set to foo_bar,
# where foo and bar are the name of the modules.
basename_flags = -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F)))
-modname_flags = -DKBUILD_MODNAME=$(subst $(comma),_,$(subst -,_,$(modname)))
+modname_flags = $(if $(filter 1,$(words $(modname))),-DKBUILD_MODNAME=$(subst $(comma),_,$(subst -,_,$(modname))))
c_flags = -Wp,-MD,$(depfile) $(CFLAGS) $(NOSTDINC_FLAGS) \
$(modkern_cflags) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o) \
$(basename_flags) $(modname_flags) $(export_flags)
# Finds the multi-part object the current object will be linked into
-modname-multi = $(subst $(space),_,$(sort $(foreach m,$(multi-used),\
- $(if $(filter $(subst $(obj)/,,$*.o), $($(m:.o=-objs)) $($(m:.o=-y))),$(m:.o=)))))
+modname-multi = $(sort $(foreach m,$(multi-used),\
+ $(if $(filter $(subst $(obj)/,,$*.o), $($(m:.o=-objs)) $($(m:.o=-y))),$(m:.o=))))
# Shipped files
# ===========================================================================