Re: [kbuild-devel] [patch 01/03] kbuild, asm-values: infrastructure

2007-09-16 Thread Sam Ravnborg
Hi Oleg.

On Wed, Jun 13, 2007 at 01:36:51AM +0200, Oleg Verych wrote:
>   * header with widely used value definitions
>   * handle all asm-related things in one file (Makefile.asm)
>   * move some asm bits from Makefile.build there
> (rule %.s:%.c)
>   * add script to generate headers from assembles output
> (hopefully better output, MIPS testing/joining to all arch
>  probably needed)
> 

Took a look at this patch at last.
Your patch moves everything to Makefile.asm and uses a script
to generate the offset file.

Now where we go the step to use a script to generate the offset file
a much simpler approach would be to move both steps to the shell script.
So the script are called with the input file as one of the
arguments and it spits out the resulting file to stdout.

Doing it this way would allow the caller to have full control
on the filenames and the current call-site in top-level Kbuild
would still be much simpler than today.

Moving the bits from Makefile.build that is only used for asm-offset is
a nice cleanup and this should the script version support too.

I see no value in renaming from asm_offset to asm_value - please drop it.
Introducing the generic asm-values.h should wait and when you do
you should be preapred to update all architectures (ecasue otherwise it
will not happen).

Sorry for the late feedback.

Sam

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kbuild-devel mailing list
kbuild-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kbuild-devel


Re: [kbuild-devel] [patch 01/03] kbuild, asm-values: infrastructure

2007-06-14 Thread Sam Ravnborg
On Thu, Jun 14, 2007 at 09:41:43AM +0200, Oleg Verych wrote:
> Jun 13, 2007 at 01:36:51AM +0200, asm-values patch set:
> > * header with widely used value definitions
> > * handle all asm-related things in one file (Makefile.asm)
> > * move some asm bits from Makefile.build there
> >   (rule %.s:%.c)
> > * add script to generate headers from assembles output
> >   (hopefully better output, MIPS testing/joining to all arch
> >probably needed)
> > 
> > rfc-by: Oleg Verych
> > ---
> 
> So, is it another not so juicy lets-break-it-all stuff from me, or it just
> doesn't apply for you?

I have not yet looked at it. A few other items pending that I need to finish
off before next merge window has priority.

Sam

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
kbuild-devel mailing list
kbuild-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kbuild-devel


Re: [kbuild-devel] [patch 01/03] kbuild, asm-values: infrastructure

2007-06-14 Thread Oleg Verych
Jun 13, 2007 at 01:36:51AM +0200, asm-values patch set:
>   * header with widely used value definitions
>   * handle all asm-related things in one file (Makefile.asm)
>   * move some asm bits from Makefile.build there
> (rule %.s:%.c)
>   * add script to generate headers from assembles output
> (hopefully better output, MIPS testing/joining to all arch
>  probably needed)
> 
> rfc-by: Oleg Verych
> ---

So, is it another not so juicy lets-break-it-all stuff from me, or it just
doesn't apply for you?

I thought update all that asm-offsets stuff just like that. I want to
know, why it does not fit.

Thanks.


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
kbuild-devel mailing list
kbuild-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kbuild-devel


[kbuild-devel] [patch 01/03] kbuild, asm-values: infrastructure

2007-06-12 Thread Oleg Verych
* header with widely used value definitions
* handle all asm-related things in one file (Makefile.asm)
* move some asm bits from Makefile.build there
  (rule %.s:%.c)
* add script to generate headers from assembles output
  (hopefully better output, MIPS testing/joining to all arch
   probably needed)

rfc-by: Oleg Verych
---
 See next patches, to know how to use it

 include/asm-generic/asm-values.h |7 
 scripts/Makefile.asm |   26 ++
 scripts/Makefile.build   |6 
 scripts/mkasm-values.sh  |   55 +
 4 files changed, 88 insertions(+), 6 deletions(-)

Index: linux-2.6.22-rc4-mm2/scripts/Makefile.asm
===
--- /dev/null   1970-01-01 00:00:00.0 +
+++ linux-2.6.22-rc4-mm2/scripts/Makefile.asm   2007-06-12 23:43:41.070624500 
+0200
@@ -0,0 +1,26 @@
+#
+# Help generate definitions needed by assembly language modules.
+#
+ifndef asm-values_h
+asm-values := $(shell test -e $(srctree)/$(src)/asm-values.c && echo ok)
+ifneq ($(asm-values),)
+   asm-values_h := asm-values.h
+   asm-values   := asm-values.s
+endif
+endif
+
+always += $(asm-values_h)
+targets+= $(asm-values_h) $(asm-values)
+mkasm-values   := $(srctree)/scripts/mkasm-values.sh
+
+quiet_cmd_mkasm-values = GEN $@
+  cmd_mkasm-values = $(CONFIG_SHELL) $(mkasm-values) $< $@ $(2)
+
+quiet_cmd_cc_s_c = CC $(quiet_modtag)  $@
+  cmd_cc_s_c = $(CC) $(c_flags) -fverbose-asm -S -o $@ $<
+
+$(obj)/asm-values.h: $(obj)/asm-values.s
+   $(call cmd,mkasm-values,$(ASM_NS))
+
+$(obj)/%.s: $(src)/%.c FORCE
+   $(call if_changed_dep,cc_s_c)
Index: linux-2.6.22-rc4-mm2/scripts/Makefile.build
===
--- linux-2.6.22-rc4-mm2.orig/scripts/Makefile.build2007-06-13 
00:45:54.195930250 +0200
+++ linux-2.6.22-rc4-mm2/scripts/Makefile.build 2007-06-12 22:10:31.481297000 
+0200
@@ -145,10 +145,4 @@ $(multi-objs-y:.o=.s)   : modname = $(mo
 $(multi-objs-y:.o=.lst) : modname = $(modname-multi)
 
-quiet_cmd_cc_s_c = CC $(quiet_modtag)  $@
-cmd_cc_s_c   = $(CC) $(c_flags) -fverbose-asm -S -o $@ $<
-
-$(obj)/%.s: $(src)/%.c FORCE
-   $(call if_changed_dep,cc_s_c)
-
 quiet_cmd_cc_i_c = CPP $(quiet_modtag) $@
 cmd_cc_i_c   = $(CPP) $(c_flags)   -o $@ $<
Index: linux-2.6.22-rc4-mm2/scripts/mkasm-values.sh
===
--- /dev/null   1970-01-01 00:00:00.0 +
+++ linux-2.6.22-rc4-mm2/scripts/mkasm-values.sh2007-06-12 
21:49:05.096903000 +0200
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+# Input file "*.s", made by Kbuild from a "*.c" source, where values of
+# interest are calculated, is processed in a suitable output header file.
+#
+# $1 - input filename;
+# $2 - output filename;
+# $3 - generate (private) file with given namespace (optional)
+
+set -e
+
+[ -z "$1" ] || [ -z "$2" ] && {
+   echo "$0:
+
+Two parameters needed. Exiting.
+"
+   exit 1
+}
+
+NS=`echo $3 | tr a-z A-Z`
+case $NS in
+   MIPS)
+SED_SCRIPT='
+/^@@@/{
+s|^@@@||;
+s| #.*$||;
+p;
+}' ;;
+   *)
+TAB="`printf '\t'`"
+SED_SCRIPT="
+/^->/{
+s|^->||;
+s|^\([^ ]*\) [\$#]*\([^ ]*\) \([^$TAB]*\).*|#define \1 \2$TAB/* \3 */|;
+p;
+}" ;;
+esac
+
+NS=__ASM_VALUES_${NS:=H}__
+
+exec 1>$2
+echo "\
+#if !defined($NS)
+#define $NS
+
+/*
+ * $2
+ * was generated from
+ * $1
+ */
+"
+sed -ne "$SED_SCRIPT" $1
+
+echo "
+#endif"
Index: linux-2.6.22-rc4-mm2/include/asm-generic/asm-values.h
===
--- /dev/null   1970-01-01 00:00:00.0 +
+++ linux-2.6.22-rc4-mm2/include/asm-generic/asm-values.h   2007-06-12 
23:33:34.176696000 +0200
@@ -0,0 +1,7 @@
+#define DEFINE(sym, val) \
+   asm volatile("\n->" #sym " %0 " #val : : "i" (val))
+
+#define BLANK() asm volatile("\n->" : : )
+
+#define OFFSET(sym, str, mem) \
+   DEFINE(sym, offsetof(struct str, mem));

--


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
kbuild-devel mailing list
kbuild-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kbuild-devel