linux-um archives
 help / color / mirror / Atom feed
From: BlaisorBlade <blaisorblade_spam@yahoo.it>
To: user-mode-linux-devel@lists.sourceforge.net
Subject: Re: [uml-devel] Re: [PATCH]Modules support in 2.6: reaching the complete fix
Date: Wed, 17 Dec 2003 18:51:18 +0100	[thread overview]
Message-ID: <200312171851.18353.blaisorblade_spam@yahoo.it> (raw)
In-Reply-To: <200312132019.hBDKJ8rL002905@ccure.user-mode-linux.org>

[-- Attachment #1: Type: text/plain, Size: 1955 bytes --]

Alle 21:19, sabato 13 dicembre 2003, Jeff Dike ha scritto:

> > 2) then, the UML build system is broken for USER_OBJS.
>
> This is separate from the module problem.  It still needs fixing though.
>
> > Instead of specifying the rule each time, wouldn't it be good
> > something  such(in pseudo-code, I know there is only foreach in
> > make-language)?
> >
> > for i in USER_OBJS; do
> >   CFLAGS_$i+=USER_CFLAGS done
>
> It would be nice just to have something in one Makefile, like
> arch/um/Makefile, which makes this work.  I haven't looked at whether this
> is possible.

Aargh! I discovered how to write the above loop. BUT the problem is that 
setting CFLAGS_$i is not what we need, since that flags are added to kernel 
ones, while the kernel flags must be deleted.

So we must not do this, but instead add another rule to the main Makefiles, or 
something else patch them.
Do you need a different output(i.e. USERCC) for the USER_OBJS or it is not 
needed?

If not, I can just patch this way scripts/Makefile.lib:

c_flags         = $(if $(find $(@F),$(user-objs)), UML_user_c_flags, 
norm_c_flags)
#def. of norm_c_flags
#def. of UML_user_c_flags

In fact, the flags passed to the compiler are $(c_flags), which contain 
CFLAGS, EXTRA_CFLAGS, CFLAGS_$@ and the special, fixed kernel flags. So this 
instead is put inside norm_c_flags; 

Also, this can be moved to the main Makefile once for all (note these are 
deferred assignments):

USER_SINGLE_OBJS = $(foreach f,$(patsubst %.o,%,$(obj-y) \ 
$(obj-m)),$($(f)-objs))

user-objs = $(filter %_user.o,$(obj-y) $(obj-m) $(USER_SINGLE_OBJS))
# You can put:
#  user-objs += whatever.o
# in each sub-Makefile.

I'm posting the "structure" patch for this(a bit different for various little 
details). If you agree with this, I'll go patching each needed Makefile.

Bye
-- 
cat <<EOSIGN
Paolo Giarrusso, aka Blaisorblade
Linux Kernel 2.4.21/2.6.0-test on an i686; Linux registered user n. 292729
EOSIGN

[-- Attachment #2: User_obj_makefiles.patch --]
[-- Type: text/x-diff, Size: 3443 bytes --]

--- ./arch/um/kernel/Makefile.user_obj	2003-12-02 17:20:43.000000000 +0100
+++ ./arch/um/kernel/Makefile	2003-12-17 18:42:37.000000000 +0100
@@ -26,7 +26,8 @@
 user-objs-$(CONFIG_TTY_LOG) += tty_log.o
 
 USER_OBJS := $(filter %_user.o,$(obj-y))  $(user-objs-y) config.o helper.o \
-	process.o tempfile.o time.o tty_log.o umid.o user_util.o user_syms.o
+	process.o tempfile.o time.o tty_log.o umid.o user_util.o user_syms.o \
+	frame.o
 USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file))
 
 DMODULES-$(CONFIG_MODULES) = -D__CONFIG_MODULES__
@@ -36,16 +37,16 @@
 CFLAGS_user_syms.o = -D__AUTOCONF_INCLUDED__ $(DMODULES-y) $(DMODVERSIONS-y) \
 	-I/usr/include -I../include
 
-CFLAGS_frame.o := $(patsubst -fomit-frame-pointer,,$(USER_CFLAGS))
+CFLAGS_frame.o := $(patsubst -fomit-frame-pointer,,$(USER_CFLAGS)) -fno-omit-frame-pointer
 
 $(USER_OBJS) : %.o: %.c
 	$(CC) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) -c -o $@ $<
 
-# This has to be separate because it needs be compiled with frame pointers
-# regardless of how the rest of the kernel is built.
-
-$(obj)/frame.o: $(src)/frame.c
-	$(CC) $(CFLAGS_$(notdir $@)) -c -o $@ $<
+## This has to be separate because it needs be compiled with frame pointers
+## regardless of how the rest of the kernel is built.
+#
+#$(obj)/frame.o: $(src)/frame.c
+#	$(CC) $(CFLAGS_$(notdir $@)) -c -o $@ $<
 
 QUOTE = 'my $$config=`cat $(TOPDIR)/.config`; $$config =~ s/"/\\"/g ; $$config =~ s/\n/\\n"\n"/g ; while(<STDIN>) { $$_ =~ s/CONFIG/$$config/; print $$_ }'
 
--- ./arch/um/Makefile.user_obj	2003-12-13 18:36:36.000000000 +0100
+++ ./arch/um/Makefile	2003-12-17 18:46:34.000000000 +0100
@@ -129,6 +129,17 @@
 USER_CFLAGS := $(patsubst -D__KERNEL__,,$(USER_CFLAGS)) $(ARCH_INCLUDE) \
 	$(MODE_INCLUDE)
 
+USER_SINGLE_OBJS = $(foreach f,$(patsubst %.o,%,$(obj-y) \ $(obj-m)),$($(f)-objs))
+user-objs = $(filter %_user.o,$(obj-y) $(obj-m) $(USER_SINGLE_OBJS))
+
+#define __set_user_cflag
+# $(1)_cflags = $$(USER_CFLAGS)
+#endef
+#
+#define set_user_cflags
+# $(foreach f, $(user-objs), $(eval $(call __set_user_cflag, $(f))))
+#endef
+
 # To get a definition of F_SETSIG
 USER_CFLAGS += -D_GNU_SOURCE
 
--- ./scripts/Makefile.lib.user_obj	2003-10-01 21:25:17.000000000 +0200
+++ ./scripts/Makefile.lib	2003-12-17 18:33:19.000000000 +0100
@@ -136,8 +136,12 @@
 basename_flags = -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F)))
 modname_flags  = $(if $(filter 1,$(words $(modname))),-DKBUILD_MODNAME=$(subst $(comma),_,$(subst -,_,$(modname))))
 
+#For UML
+is_user_obj    = $(find $(@F),$(user-objs))
+
+_c_flags       = $(if $(is_user_obj),$(USER_CFLAGS),$(CFLAGS) $(EXTRA_CFLAGS)) \
+  		 $(CFLAGS_$(*F).o)
 
-_c_flags       = $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o)
 _a_flags       = $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o)
 _hostc_flags   = $(HOSTCFLAGS)   $(HOST_EXTRACFLAGS)   $(HOSTCFLAGS_$(*F).o)
 _hostcxx_flags = $(HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) $(HOSTCXXFLAGS_$(*F).o)
@@ -165,10 +169,12 @@
 __hostcxx_flags	=                              $(call flags,_hostcxx_flags)
 endif
 
-c_flags        = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \
+kernelized_c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \
 		 $(__c_flags) $(modkern_cflags) \
 		 $(basename_flags) $(modname_flags)
 
+c_flags 	= $(if $(is_user_obj), __c_flags, kernelized_c_flags)
+
 a_flags        = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \
 		 $(__a_flags) $(modkern_aflags)
 

  parent reply	other threads:[~2003-12-17 17:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-13 17:28 [uml-devel] [PATCH]Modules support in 2.6: reaching the complete fix BlaisorBlade
2003-12-13 20:19 ` [uml-devel] " Jeff Dike
2003-12-14 15:04   ` BlaisorBlade
2003-12-17 17:51   ` BlaisorBlade [this message]
2003-12-18  1:19     ` Jeff Dike
2003-12-18 19:32       ` BlaisorBlade
2003-12-18 22:13         ` Jeff Dike
2003-12-19 19:51           ` BlaisorBlade
2003-12-23 19:31             ` BlaisorBlade

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200312171851.18353.blaisorblade_spam@yahoo.it \
    --to=blaisorblade_spam@yahoo.it \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox