public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lai Jiangshan <laijs@cn.fujitsu.com>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Ingo Molnar <mingo@elte.hu>,
	Peter Zijlstra <peterz@infradead.org>,
	Dipankar Sarma <dipankar@in.ibm.com>,
	Jan Beulich <jbeulich@novell.com>,
	David Howells <dhowells@redhat.com>,
	Alexander van Heukelum <heukelum@fastmail.fm>,
	"H. Peter Anvin" <hpa@linux.intel.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Roland McGrath <roland@redhat.com>,
	Oleg Nesterov <oleg@redhat.com>, Serge Hallyn <serue@us.ibm.com>,
	linux-kernel@vger.kernel.org,
	Christoph Lameter <clameter@sgi.com>,
	Sam Ravnborg <sam@ravnborg.org>
Subject: [RFC PATCH 3/5] kbuild: add kernel-offset file
Date: Mon, 28 Mar 2011 10:59:31 +0800	[thread overview]
Message-ID: <4D8FF993.3070207@cn.fujitsu.com> (raw)
In-Reply-To: <4D8FF8AD.5080607@cn.fujitsu.com>


Add kernel/kernel-offset.c, include/generated/kernel-offsets.h will
be generated from this file and some difines need by kernel
is generated in this file.

This generating is assigned as the last step of the kbuild generating,
it would require the other earier generated files.

__KBUILD_GENARATING__ is defined when generating, it will be
used to avoid compiling errror when generating.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
 Kbuild                  |   41 ++++++++++++++++++++++++++++++++---------
 kernel/kernel-offsets.c |   14 ++++++++++++++
 2 files changed, 46 insertions(+), 9 deletions(-)

diff --git a/Kbuild b/Kbuild
index 5c2ee83..fdfde56 100644
--- a/Kbuild
+++ b/Kbuild
@@ -3,7 +3,8 @@
 # This file takes care of the following:
 # 1) Generate bounds.h
 # 2) Generate asm-offsets.h (may need bounds.h)
-# 3) Check for missing system calls
+# 3) Generate kernel-offsets.h (may need bounds.h and asm-offsets.h)
+# 4) Check for missing system calls
 
 # Default sed regexp - multiline due to syntax constraints
 define sed-y
@@ -30,6 +31,10 @@ define cmd_kbuild_gen
 	 echo "#endif" ) > $@
 endef
 
+quiet_cmd_gen_cc_s_c = CC $(quiet_modtag)  $@
+cmd_gen_cc_s_c       = $(CC) -D__KBUILD_GENARATING__		\
+                       $(c_flags) -fverbose-asm -S -o $@ $<
+
 #####
 # 1) Generate bounds.h
 
@@ -41,7 +46,7 @@ targets := $(bounds-file) kernel/bounds.s
 # We use internal kbuild rules to avoid the "is up to date" message from make
 kernel/bounds.s: kernel/bounds.c FORCE
 	$(Q)mkdir -p $(dir $@)
-	$(call if_changed_dep,cc_s_c)
+	$(call if_changed_dep,gen_cc_s_c)
 
 $(obj)/$(bounds-file): kernel/bounds.s Kbuild
 	$(Q)mkdir -p $(dir $@)
@@ -51,23 +56,41 @@ $(obj)/$(bounds-file): kernel/bounds.s Kbuild
 # 2) Generate asm-offsets.h
 #
 
-offsets-file := include/generated/asm-offsets.h
+asm-offsets-file := include/generated/asm-offsets.h
 
-always  += $(offsets-file)
-targets += $(offsets-file)
+always  += $(asm-offsets-file)
+targets += $(asm-offsets-file)
 targets += arch/$(SRCARCH)/kernel/asm-offsets.s
 
 # We use internal kbuild rules to avoid the "is up to date" message from make
 arch/$(SRCARCH)/kernel/asm-offsets.s: arch/$(SRCARCH)/kernel/asm-offsets.c \
                                       $(obj)/$(bounds-file) FORCE
 	$(Q)mkdir -p $(dir $@)
-	$(call if_changed_dep,cc_s_c)
+	$(call if_changed_dep,gen_cc_s_c)
+
+$(obj)/$(asm-offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s Kbuild
+	$(call cmd,kbuild_gen)
+
+#####
+# 3) Generate kernel-offsets.h
+#
+
+kernel-offsets-file := include/generated/kernel-offsets.h
+
+always  += $(kernel-offsets-file)
+targets += $(kernel-offsets-file) kernel/kernel-offsets.s
+
+# We use internal kbuild rules to avoid the "is up to date" message from make
+kernel/kernel-offsets.s: kernel/kernel-offsets.c $(obj)/$(asm-offsets-file) \
+                         $(obj)/$(bounds-file) FORCE
+	$(Q)mkdir -p $(dir $@)
+	$(call if_changed_dep,gen_cc_s_c)
 
-$(obj)/$(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s Kbuild
+$(obj)/$(kernel-offsets-file): kernel/kernel-offsets.s Kbuild
 	$(call cmd,kbuild_gen)
 
 #####
-# 3) Check for missing system calls
+# 4) Check for missing system calls
 #
 
 quiet_cmd_syscalls = CALL    $<
@@ -78,4 +101,4 @@ missing-syscalls: scripts/checksyscalls.sh FORCE
 	$(call cmd,syscalls)
 
 # Keep these two files during make clean
-no-clean-files := $(bounds-file) $(offsets-file)
+no-clean-files := $(bounds-file) $(asm-offsets-file) $(kernel-offsets-file)
diff --git a/kernel/kernel-offsets.c b/kernel/kernel-offsets.c
new file mode 100644
index 0000000..fb73ccf
--- /dev/null
+++ b/kernel/kernel-offsets.c
@@ -0,0 +1,14 @@
+/*
+ * Generate definitions needed by assembly language modules.
+ *
+ * Copyright (C) 2010 Lai Jiangshan
+ */
+
+#include <linux/kbuild.h>
+
+void foo(void);
+
+void foo(void)
+{
+}
+
-- 
1.7.4


  parent reply	other threads:[~2011-03-28  2:57 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-28  2:55 [RFC PATCH 0/5] Add kernel-offset file and make rcu_read_[un]lock() included Lai Jiangshan
2011-03-28  2:58 ` [RFC PATCH 1/5] Move task's RCU code to rcupdate.h Lai Jiangshan
2011-03-31 11:31   ` Peter Zijlstra
2011-03-31 23:24     ` Paul E. McKenney
2011-03-28  2:58 ` [RFC PATCH 2/5] kbuild: dedumplicated the generating code Lai Jiangshan
2011-03-28  8:31   ` Jan Beulich
2011-03-31 18:26   ` David Howells
2011-03-28  2:59 ` Lai Jiangshan [this message]
2011-03-31 18:28   ` [RFC PATCH 3/5] kbuild: add kernel-offset file David Howells
2011-03-28  3:00 ` [RFC PATCH 4/5] RCU: Add TASK_RCU_OFFSET Lai Jiangshan
2011-03-28  8:35   ` Jan Beulich
2011-03-29  9:41     ` Lai Jiangshan
2011-03-29 21:14     ` H. Peter Anvin
2011-03-29 21:31       ` Paul E. McKenney
2011-03-29 21:32         ` H. Peter Anvin
2011-03-29 21:47           ` Paul E. McKenney
2011-03-29 22:01             ` H. Peter Anvin
2011-03-30  0:47               ` Paul E. McKenney
2011-03-30  5:25                 ` Lai Jiangshan
2011-03-30  7:22                   ` Lai Jiangshan
2011-03-30 10:55                     ` Michal Marek
2011-03-30 10:57                       ` Peter Zijlstra
2011-03-30 11:46                         ` Michal Marek
2011-03-31  1:02                           ` Lai Jiangshan
2011-03-31  1:21                             ` Paul E. McKenney
2011-03-31  1:53                               ` Lai Jiangshan
2011-03-31 23:30                                 ` Paul E. McKenney
2011-04-01  3:28                                   ` Paul E. McKenney
2011-03-31  8:04                             ` Peter Zijlstra
2011-03-31  9:50                               ` Lai Jiangshan
2011-03-31 11:18                                 ` Peter Zijlstra
2011-04-01  1:57                                   ` Lai Jiangshan
2011-04-01 11:35                                     ` Peter Zijlstra
2011-04-05 21:54                                       ` Paul E. McKenney
2011-04-05 23:07                                         ` Paul E. McKenney
2011-04-06  8:10                                           ` Peter Zijlstra
2011-04-06 19:21                                             ` Paul E. McKenney
2011-04-06 20:13                                               ` Paul E. McKenney
2011-04-06 21:06                                                 ` Peter Zijlstra
2011-04-06 21:27                                                   ` H. Peter Anvin
2011-04-07  0:30                                                     ` Paul E. McKenney
2011-04-07  5:49                                                       ` Lai Jiangshan
2011-04-07 15:47                                                         ` Paul E. McKenney
2011-04-07 16:26                                                           ` Paul E. McKenney
2011-04-08  1:26                                                             ` Lai Jiangshan
2011-04-08  5:13                                                               ` Paul E. McKenney
2011-04-11  3:08                                                                 ` Lai Jiangshan
2011-04-11  5:12                                                                   ` Paul E. McKenney
2011-04-11  6:01                                                                     ` Lai Jiangshan
2011-04-11  8:31                                                                     ` Lai Jiangshan
2011-04-11 21:02                                                                       ` Paul E. McKenney
2011-04-11 21:24                                                                         ` Peter Zijlstra
2011-04-22  7:19                                                                         ` Lai Jiangshan
2011-04-22  8:10                                                                           ` Peter Zijlstra
2011-04-25  7:21                                                                             ` Lai Jiangshan
2011-04-23 20:30                                                                           ` Paul E. McKenney
2011-04-11  8:33                                                                     ` Lai Jiangshan
2011-04-07  7:05                                                       ` [PATCH 1/4] rcu: split rcupdate.h Lai Jiangshan
2011-04-07  7:07                                                       ` [PATCH 2/4] rcu: make rcudpate.h can use struct task_struct Lai Jiangshan
2011-04-07  7:07                                                       ` [PATCH 3/4] rcu: introduce task_rcu_struct and move task's RCU code to rcupdate_defs.h Lai Jiangshan
2011-04-07 13:40                                                         ` Alexey Dobriyan
2011-04-07  7:08                                                       ` [PATCH 4/4] rcu: declare preemptible __rcu_read_[un]lock() as inline function Lai Jiangshan
2011-04-06 17:41                                           ` [RFC PATCH 4/5] RCU: Add TASK_RCU_OFFSET Paul E. McKenney
2011-03-31 19:28                                 ` H. Peter Anvin
2011-03-31 19:25                   ` H. Peter Anvin
2011-03-28  3:01 ` [RFC PATCH 5/5] RCU: declare preemptible __rcu_read_[un]lock() as inline function Lai Jiangshan
2011-03-28 22:17 ` [RFC PATCH 0/5] Add kernel-offset file and make rcu_read_[un]lock() included Paul E. McKenney

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=4D8FF993.3070207@cn.fujitsu.com \
    --to=laijs@cn.fujitsu.com \
    --cc=akpm@linux-foundation.org \
    --cc=clameter@sgi.com \
    --cc=dhowells@redhat.com \
    --cc=dipankar@in.ibm.com \
    --cc=heukelum@fastmail.fm \
    --cc=hpa@linux.intel.com \
    --cc=jbeulich@novell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@redhat.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=roland@redhat.com \
    --cc=sam@ravnborg.org \
    --cc=serue@us.ibm.com \
    /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