[kbuild-devel] kbuild update

2007-06-03 Thread Sam Ravnborg
Short intro to content of kbuild.git at the moment.
See http://git.kernel.org/?p=linux/kernel/git/sam/kbuild.git;a=summary

Everything are targeted for next merge window.

section mismatch
  kbuild: make better section mismatch reports on i386, arm and mips
  kbuild: The .paravirtprobe section is obsolete, so modpost doesn't need 
to handle it
  kbuild: ignore section mismatch warnings originating from .note section
  kbuild: refactor code in modpost to improve maintainability
  kbuild: warn about references from .init.text to .exit.text
  kbuild: remove hardcoded apic_es7000 from modpost
  kbuild: refactor code in modpost
  kbuild: remove hardcoded _logo names from modpost
  kbuild: suppress modpost warnings for references from the .toc section as 
used by powerpc
  kbuild: whitelist references from variables named _timer to .init.text

Several changes to either improve reporting - or to ignore false positives.
In particular modpost now check for and warn about references from .init.text 
to .exit.text
This check caugth several real bugs - which for the most part are already fixed 
in upstream.
modpost now does a better job finding the symbols using addend - this works for 
me
but had caused troubles in the past. If modpost suddenly bails out with a 
segmentation
violation this may the the culprint.
In addition some trivial code refactoring was done to improve maintainability 
of modpost.


  kconfig: use POSIX equality test in check-lxdialog.sh
Bugfix.


  scripts: Make cleanfile/cleanpatch warn about long lines
Improved so we all adhere to 80 lines (in)sanity


  kbuild: avoid environment to set variables used by kbuild
I had a report that a user tried to do:
EXTRA_CFLAGS=FOO make fs/nfs/
This is not supposed to impact the build so make sure it does not.


  kbuild: add support for reading stdin with gen_init_cpio
  kbuild: add support for squashing uid/gid in gen_initramfs_list.sh
initramfs improvements


  kbuild: asm-offsets.h is now cleaned with O=.. builds
Bugfix


  kbuild: document cc-fullversion
  kbuild: New 'cc-fullversion' macro
  powerpc: Refuse to build 64-bit with GCC-4.2.0 and CONFIG_MODULES
Add and use cc-fullversion to obtain exact gcc version
See documentation in Documentation/kbuild/makefiles.txt


What's next?
- davem has requested to add a new section used for code modifying support.
   The actual section name to use needs to be sorted out.
- A few cygwin specific changes may hit kbuild - to allow the kernel to be 
built
   using cygwin on a windoze box.
- A few trivial kconfig changes are pending. Needs to review them before they 
are ready.
- A speed-up of headers_check is in the works. Got stalled but will look into 
it soon.
   The check goes down to ~3 sec on my not-so-fast machine
- If I get really bored I may start a 'cleaning up all vmlinux.lds files' 
round.
   If someone would help out here it would be appreciated.
   These change will then be merged via the arch-maintaines and not really 
kbuild stuff..

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


[kbuild-devel] [PATCH 01/19] kbuild: asm-offsets.h is now cleaned with O=.. builds

2007-06-03 Thread Sam Ravnborg
Subject: [PATCH 01/19] kbuild: asm-offsets.h is now cleaned with O=.. builds
From: Sam Ravnborg [EMAIL PROTECTED]
Date: Mon, 28 May 2007 22:14:37 +0200

Reported by: Robert P. J. Day [EMAIL PROTECTED]

Signed-off-by: Sam Ravnborg [EMAIL PROTECTED]
Cc: Robert P. J. Day [EMAIL PROTECTED]
---
 Kbuild |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/Kbuild b/Kbuild
index 163f8cb..56b8edf 100644
--- a/Kbuild
+++ b/Kbuild
@@ -13,6 +13,7 @@ offsets-file := include/asm-$(ARCH)/asm-offsets.h
 always  := $(offsets-file)
 targets := $(offsets-file)
 targets += arch/$(ARCH)/kernel/asm-offsets.s
+clean-files := $(addprefix $(objtree)/,$(targets))
 
 # Default sed regexp - multiline due to syntax constraints
 define sed-y
-- 
1.5.1.rc3.1544.g8a923

-
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 02/19] kbuild: make better section mismatch reports on i386, arm and mips

2007-06-03 Thread Sam Ravnborg
Subject: [PATCH 02/19] kbuild: make better section mismatch reports on i386, 
arm and mips
From: Atsushi Nemoto [EMAIL PROTECTED]
Date: Tue, 22 May 2007 18:27:39 +0900

On i386, ARM and MIPS, warn_sec_mismatch() sometimes fails to show
usefull symbol name.  This is because empty 'refsym' due to 0 r_addend
value.  This patch is to adjust r_addend value, consulting with
apply_relocate() routine in kernel code.

Signed-off-by: Atsushi Nemoto [EMAIL PROTECTED]
Signed-off-by: Sam Ravnborg [EMAIL PROTECTED]
---
 scripts/mod/modpost.c |   85 +
 scripts/mod/modpost.h |3 ++
 2 files changed, 88 insertions(+), 0 deletions(-)

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 8e5610d..760b2b3 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -374,6 +374,7 @@ static int parse_elf(struct elf_info *info, const char 
*filename)
hdr-e_shstrndx = TO_NATIVE(hdr-e_shstrndx);
hdr-e_shnum= TO_NATIVE(hdr-e_shnum);
hdr-e_machine  = TO_NATIVE(hdr-e_machine);
+   hdr-e_type = TO_NATIVE(hdr-e_type);
sechdrs = (void *)hdr + hdr-e_shoff;
info-sechdrs = sechdrs;
 
@@ -384,6 +385,8 @@ static int parse_elf(struct elf_info *info, const char 
*filename)
sechdrs[i].sh_size   = TO_NATIVE(sechdrs[i].sh_size);
sechdrs[i].sh_link   = TO_NATIVE(sechdrs[i].sh_link);
sechdrs[i].sh_name   = TO_NATIVE(sechdrs[i].sh_name);
+   sechdrs[i].sh_info   = TO_NATIVE(sechdrs[i].sh_info);
+   sechdrs[i].sh_addr   = TO_NATIVE(sechdrs[i].sh_addr);
}
/* Find symbol table. */
for (i = 1; i  hdr-e_shnum; i++) {
@@ -753,6 +756,8 @@ static Elf_Sym *find_elf_symbol(struct elf_info *elf, 
Elf_Addr addr,
for (sym = elf-symtab_start; sym  elf-symtab_stop; sym++) {
if (sym-st_shndx != relsym-st_shndx)
continue;
+   if (ELF_ST_TYPE(sym-st_info) == STT_SECTION)
+   continue;
if (sym-st_value == addr)
return sym;
}
@@ -895,6 +900,72 @@ static void warn_sec_mismatch(const char *modname, const 
char *fromsec,
}
 }
 
+static inline unsigned int *reloc_location(struct elf_info *elf,
+  int rsection, Elf_Rela *r)
+{
+   Elf_Shdr *sechdrs = elf-sechdrs;
+   int section = sechdrs[rsection].sh_info;
+
+   return (void *)elf-hdr + sechdrs[section].sh_offset +
+   (r-r_offset - sechdrs[section].sh_addr);
+}
+
+static void addend_386_rel(struct elf_info *elf, int rsection, Elf_Rela *r)
+{
+   unsigned int r_typ = ELF_R_TYPE(r-r_info);
+   unsigned int *location = reloc_location(elf, rsection, r);
+
+   switch (r_typ) {
+   case R_386_32:
+   r-r_addend = TO_NATIVE(*location);
+   break;
+   case R_386_PC32:
+   r-r_addend = TO_NATIVE(*location) + 4;
+   /* For CONFIG_RELOCATABLE=y */
+   if (elf-hdr-e_type == ET_EXEC)
+   r-r_addend += r-r_offset;
+   break;
+   }
+}
+
+static void addend_arm_rel(struct elf_info *elf, int rsection, Elf_Rela *r)
+{
+   unsigned int r_typ = ELF_R_TYPE(r-r_info);
+   unsigned int *location = reloc_location(elf, rsection, r);
+
+   switch (r_typ) {
+   case R_ARM_ABS32:
+   r-r_addend = TO_NATIVE(*location);
+   break;
+   case R_ARM_PC24:
+   r-r_addend = ((TO_NATIVE(*location)  0x00ff)  2) + 8;
+   break;
+   }
+}
+
+static int addend_mips_rel(struct elf_info *elf, int rsection, Elf_Rela *r)
+{
+   unsigned int r_typ = ELF_R_TYPE(r-r_info);
+   unsigned int *location = reloc_location(elf, rsection, r);
+   unsigned int inst;
+
+   if (r_typ == R_MIPS_HI16)
+   return 1;   /* skip this */
+   inst = TO_NATIVE(*location);
+   switch (r_typ) {
+   case R_MIPS_LO16:
+   r-r_addend = inst  0x;
+   break;
+   case R_MIPS_26:
+   r-r_addend = (inst  0x03ff)  2;
+   break;
+   case R_MIPS_32:
+   r-r_addend = inst;
+   break;
+   }
+   return 0;
+}
+
 /**
  * A module includes a number of sections that are discarded
  * either when loaded or when used as built-in.
@@ -938,8 +1009,11 @@ static void check_sec_ref(struct module *mod, const char 
*modname,
r.r_offset = TO_NATIVE(rela-r_offset);
 #if KERNEL_ELFCLASS == ELFCLASS64
if (hdr-e_machine == EM_MIPS) {
+   unsigned int r_typ;
r_sym = ELF64_MIPS_R_SYM(rela-r_info);
r_sym = TO_NATIVE(r_sym);
+   r_typ = ELF64_MIPS_R_TYPE(rela-r_info);
+

[kbuild-devel] [PATCH 03/19] kbuild: New 'cc-fullversion' macro

2007-06-03 Thread Sam Ravnborg
Subject: [PATCH 03/19] kbuild: New 'cc-fullversion' macro
From: Segher Boessenkool [EMAIL PROTECTED]
Date: Sat, 19 May 2007 18:49:07 +0200

Prints a six-digit string including the GCC patchlevel.  Also fix
the 'usage' comment for cc-version.

Signed-off-by: Segher Boessenkool [EMAIL PROTECTED]
Signed-off-by: Sam Ravnborg [EMAIL PROTECTED]
---
 scripts/Kbuild.include |7 ++-
 scripts/gcc-version.sh |   15 ---
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 06c1a37..677bc6c 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -100,9 +100,14 @@ cc-option-align = $(subst -functions=0,,\
$(call cc-option,-falign-functions=0,-malign-functions=0))
 
 # cc-version
-# Usage gcc-ver := $(call cc-version,$(CC))
+# Usage gcc-ver := $(call cc-version)
 cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC))
 
+# cc-fullversion
+# Usage gcc-ver := $(call cc-fullversion)
+cc-fullversion = $(shell $(CONFIG_SHELL) \
+   $(srctree)/scripts/gcc-version.sh -p $(CC))
+
 # cc-ifversion
 # Usage:  EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1)
 cc-ifversion = $(shell [ $(call cc-version, $(CC)) $(1) $(2) ]  echo $(3))
diff --git a/scripts/gcc-version.sh b/scripts/gcc-version.sh
index bb4fbea..8a1d187 100644
--- a/scripts/gcc-version.sh
+++ b/scripts/gcc-version.sh
@@ -1,14 +1,23 @@
 #!/bin/sh
 #
-# gcc-version gcc-command
+# gcc-version [-p] gcc-command
 #
 # Prints the gcc version of `gcc-command' in a canonical 4-digit form
 # such as `0295' for gcc-2.95, `0303' for gcc-3.3, etc.
 #
+# With the -p option, prints the patchlevel as well, for example `029503' for
+# gcc-2.95.3, `030301' for gcc-3.3.1, etc.
+#
+
+if [ $1 = -p ] ; then with_patchlevel=1; shift; fi
 
 compiler=$*
 
 MAJOR=$(echo __GNUC__ | $compiler -E -xc - | tail -n 1)
 MINOR=$(echo __GNUC_MINOR__ | $compiler -E -xc - | tail -n 1)
-printf %02d%02d\\n $MAJOR $MINOR
-
+if [ x$with_patchlevel != x ] ; then
+   PATCHLEVEL=$(echo __GNUC_PATCHLEVEL__ | $compiler -E -xc - | tail -n 1)
+   printf %02d%02d%02d\\n $MAJOR $MINOR $PATCHLEVEL
+else
+   printf %02d%02d\\n $MAJOR $MINOR
+fi
-- 
1.5.1.rc3.1544.g8a923


- End forwarded message -

-
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 04/19] powerpc: Refuse to build 64-bit with GCC-4.2.0 and CONFIG_MODULES

2007-06-03 Thread Sam Ravnborg
Subject: [PATCH 04/19] powerpc: Refuse to build 64-bit with GCC-4.2.0 and 
CONFIG_MODULES
From: Segher Boessenkool [EMAIL PROTECTED]
Date: Sat, 19 May 2007 18:49:08 +0200

...since this won't work (compiler bug, see http://gcc.gnu.org/PR31490).

Signed-off-by: Segher Boessenkool [EMAIL PROTECTED]
Signed-off-by: Sam Ravnborg [EMAIL PROTECTED]
---
 arch/powerpc/Makefile |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 6238b58..1447c83 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -202,6 +202,14 @@ checkbin:
false; \
fi ; \
fi
+   @if test $(call cc-fullversion) = 040200 \
+test x${CONFIG_MODULES}${CONFIG_PPC64} = xyy ; then \
+   echo -n '*** GCC-4.2.0 cannot compile the 64-bit powerpc ' ; \
+   echo 'kernel with modules enabled.' ; \
+   echo -n '*** Please use a different GCC version or ' ; \
+   echo 'disable kernel modules' ; \
+   false ; \
+   fi
@if ! /bin/echo dssall | $(AS) -many -o $(TOUT) /dev/null 21 ; then \
echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build ' 
; \
echo 'correctly with old versions of binutils.' ; \
-- 
1.5.1.rc3.1544.g8a923


- End forwarded message -

-
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 05/19] kbuild: document cc-fullversion

2007-06-03 Thread Sam Ravnborg
Subject: [PATCH 05/19] kbuild: document cc-fullversion
From: Sam Ravnborg [EMAIL PROTECTED]
Date: Mon, 28 May 2007 22:26:55 +0200

Signed-off-by: Sam Ravnborg [EMAIL PROTECTED]
---
 Documentation/kbuild/makefiles.txt |   14 ++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/Documentation/kbuild/makefiles.txt 
b/Documentation/kbuild/makefiles.txt
index bb5306e..c6d9a35 100644
--- a/Documentation/kbuild/makefiles.txt
+++ b/Documentation/kbuild/makefiles.txt
@@ -501,6 +501,20 @@ more details, with real examples.
The third parameter may be a text as in this example, but it may also
be an expanded variable or a macro.
 
+cc-fullversion
+   cc-fullversion is usefull when the exact version of gcc is needed.
+   One typical use-case is when a specific GCC version is broken.
+   cc-fullversion points out a more specific version than cc-version does.
+
+   Example:
+   #arch/powerpc/Makefile
+   $(Q)if test $(call cc-fullversion) = 040200 ; then \
+   echo -n '*** GCC-4.2.0 cannot compile the 64-bit 
powerpc ' ; \
+   false ; \
+   fi
+
+   In this example for a specific GCC version the build will error out 
explaining
+   the user why it stops.
 
 === 4 Host Program support
 
-- 
1.5.1.rc3.1544.g8a923


- End forwarded message -

-
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 06/19] kbuild: suppress modpost warnings for references from the .toc section as used by powerpc

2007-06-03 Thread Sam Ravnborg
Subject: [PATCH 06/19] kbuild: suppress modpost warnings for references from 
the .toc section as used by powerpc
From: Stephen Rothwell [EMAIL PROTECTED]
Date: Thu, 24 May 2007 14:16:13 +1000

We should do better here by effetively dereferencing references to
the .toc (or the .got2) section, but that is much harder.

Signed-off-by: Stephen Rothwell [EMAIL PROTECTED]
Signed-off-by: Sam Ravnborg [EMAIL PROTECTED]
---
 scripts/mod/modpost.c |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 760b2b3..f6bae03 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -870,9 +870,12 @@ static void warn_sec_mismatch(const char *modname, const 
char *fromsec,
return;
 
/* fromsec whitelist - without a valid 'before'
-* powerpc has a GOT table in .got2 section */
+* powerpc has a GOT table in .got2 section
+* and also a .toc section */
if (strcmp(fromsec, .got2) == 0)
return;
+   if (strcmp(fromsec, .toc) == 0)
+   return;
 
if (before  after) {
warn(%s(%s+0x%llx): Section mismatch: reference to %s:%s 
-- 
1.5.1.rc3.1544.g8a923


- End forwarded message -

-
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 07/19] kbuild: avoid environment to set variables used by kbuild

2007-06-03 Thread Sam Ravnborg
Subject: [PATCH 07/19] kbuild: avoid environment to set variables used by kbuild
From: Sam Ravnborg [EMAIL PROTECTED]
Date: Mon, 28 May 2007 22:47:48 +0200

A few of the variables used by kbuild has fixed naming.
Make sure we do not pick up random values from the environment.

Signed-off-by: Sam Ravnborg [EMAIL PROTECTED]
---
 scripts/Makefile.build |   16 
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index a525112..3f7b451 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -7,6 +7,22 @@ src := $(obj)
 PHONY := __build
 __build:
 
+# Init all relevant variables used in kbuild files so
+# 1) they have correct type
+# 2) they do not inherit any value from the environment
+obj-y :=
+obj-m :=
+lib-y :=
+lib-m :=
+always :=
+targets :=
+subdir-y :=
+subdir-m :=
+EXTRA_AFLAGS   :=
+EXTRA_CFLAGS   :=
+EXTRA_CPPFLAGS :=
+EXTRA_LDFLAGS  :=
+
 # Read .config if it exist, otherwise ignore
 -include include/config/auto.conf
 
-- 
1.5.1.rc3.1544.g8a923


- End forwarded message -

-
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 08/19] scripts: Make cleanfile/cleanpatch warn about long lines

2007-06-03 Thread Sam Ravnborg
Subject: [PATCH 08/19] scripts: Make cleanfile/cleanpatch warn about long lines
From: H. Peter Anvin [EMAIL PROTECTED]
Date: Fri, 25 May 2007 17:58:26 -0700

Make the cleanfile and cleanpatch script warn about long lines,
by default lines whose visual width exceeds 79 characters.

Per suggestion from Auke Kok.

Signed-off-by: H. Peter Anvin [EMAIL PROTECTED]
Signed-off-by: Sam Ravnborg [EMAIL PROTECTED]
---
 scripts/cleanfile  |   54 ++-
 scripts/cleanpatch |   58 +--
 2 files changed, 107 insertions(+), 5 deletions(-)

diff --git a/scripts/cleanfile b/scripts/cleanfile
index f1ba8aa..cefd29e 100755
--- a/scripts/cleanfile
+++ b/scripts/cleanfile
@@ -7,7 +7,9 @@
 use bytes;
 use File::Basename;
 
-#
+# Default options
+$max_width = 79;
+
 # Clean up space-tab sequences, either by removing spaces or
 # replacing them with tabs.
 sub clean_space_tabs($)
@@ -48,9 +50,49 @@ sub clean_space_tabs($)
 return $lo;
 }
 
+# Compute the visual width of a string
+sub strwidth($) {
+no bytes;  # Tab alignment depends on characters
+
+my($li) = @_;
+my($c, $i);
+my $pos = 0;
+my $mlen = 0;
+
+for ($i = 0; $i  length($li); $i++) {
+   $c = substr($li,$i,1);
+   if ($c eq \t) {
+   $pos = ($pos+8)  ~7;
+   } elsif ($c eq \n) {
+   $mlen = $pos if ($pos  $mlen);
+   $pos = 0;
+   } else {
+   $pos++;
+   }
+}
+
+$mlen = $pos if ($pos  $mlen);
+return $mlen;
+}
+
 $name = basename($0);
 
-foreach $f ( @ARGV ) {
[EMAIL PROTECTED] = ();
+
+while (defined($a = shift(@ARGV))) {
+if ($a =~ /^-/) {
+   if ($a eq '-width' || $a eq '-w') {
+   $max_width = shift(@ARGV)+0;
+   } else {
+   print STDERR Usage: $name [-width #] files...\n;
+   exit 1;
+   }
+} else {
+   push(@files, $a);
+}
+}
+
+foreach $f ( @files ) {
 print STDERR $name: $f\n;
 
 if (! -f $f) {
@@ -90,8 +132,10 @@ foreach $f ( @ARGV ) {
 
 @blanks = ();
 @lines  = ();
+$lineno = 0;
 
 while ( defined($line = FILE) ) {
+   $lineno++;
$in_bytes += length($line);
$line =~ s/[ \t\r]*$//; # Remove trailing spaces
$line = clean_space_tabs($line);
@@ -107,6 +151,12 @@ foreach $f ( @ARGV ) {
@blanks = ();
$blank_bytes = 0;
}
+
+   $l_width = strwidth($line);
+   if ($max_width  $l_width  $max_width) {
+   print STDERR
+   $f:$lineno: line exceeds $max_width characters ($l_width)\n;
+   }
 }
 
 # Any blanks at the end of the file are discarded
diff --git a/scripts/cleanpatch b/scripts/cleanpatch
index a53f987..9680d03 100755
--- a/scripts/cleanpatch
+++ b/scripts/cleanpatch
@@ -7,7 +7,9 @@
 use bytes;
 use File::Basename;
 
-#
+# Default options
+$max_width = 79;
+
 # Clean up space-tab sequences, either by removing spaces or
 # replacing them with tabs.
 sub clean_space_tabs($)
@@ -48,9 +50,49 @@ sub clean_space_tabs($)
 return $lo;
 }
 
+# Compute the visual width of a string
+sub strwidth($) {
+no bytes;  # Tab alignment depends on characters
+
+my($li) = @_;
+my($c, $i);
+my $pos = 0;
+my $mlen = 0;
+
+for ($i = 0; $i  length($li); $i++) {
+   $c = substr($li,$i,1);
+   if ($c eq \t) {
+   $pos = ($pos+8)  ~7;
+   } elsif ($c eq \n) {
+   $mlen = $pos if ($pos  $mlen);
+   $pos = 0;
+   } else {
+   $pos++;
+   }
+}
+
+$mlen = $pos if ($pos  $mlen);
+return $mlen;
+}
+
 $name = basename($0);
 
-foreach $f ( @ARGV ) {
[EMAIL PROTECTED] = ();
+
+while (defined($a = shift(@ARGV))) {
+if ($a =~ /^-/) {
+   if ($a eq '-width' || $a eq '-w') {
+   $max_width = shift(@ARGV)+0;
+   } else {
+   print STDERR Usage: $name [-width #] files...\n;
+   exit 1;
+   }
+} else {
+   push(@files, $a);
+}
+}
+
+foreach $f ( @files ) {
 print STDERR $name: $f\n;
 
 if (! -f $f) {
@@ -86,6 +128,7 @@ foreach $f ( @ARGV ) {
 
 $in_bytes = 0;
 $out_bytes = 0;
+$lineno = 0;
 
 @lines  = ();
 
@@ -93,10 +136,12 @@ foreach $f ( @ARGV ) {
 $err = 0;
 
 while ( defined($line = FILE) ) {
+   $lineno++;
$in_bytes += length($line);
 
if (!$in_hunk) {
-   if ($line =~ /[EMAIL 
PROTECTED]@\s+\-([0-9]+),([0-9]+)\s+\+([0-9]+),([0-9]+)[EMAIL PROTECTED]@/) {
+   if ($line =~
+   /[EMAIL 
PROTECTED]@\s+\-([0-9]+),([0-9]+)\s+\+([0-9]+),([0-9]+)[EMAIL PROTECTED]@/) {
$minus_lines = $2;
$plus_lines = $4;
if ($minus_lines || $plus_lines) {
@@ -117,6 +162,13 @@ foreach $f ( @ARGV ) {
$text =~ s/[ \t\r]*$//; # Remove trailing spaces
$text = clean_space_tabs($text);
 
+   $l_width = strwidth($text);
+   

[kbuild-devel] [PATCH 09/19] kconfig: use POSIX equality test in check-lxdialog.sh

2007-06-03 Thread Sam Ravnborg
Subject: [PATCH 09/19] kconfig: use POSIX equality test in check-lxdialog.sh
From: Mike Frysinger [EMAIL PROTECTED]
Date: Wed, 23 May 2007 21:37:45 -0400

The == operator is not in POSIX, so use -eq instead.

Signed-off-by: Mike Frysinger [EMAIL PROTECTED]
Signed-off-by: Sam Ravnborg [EMAIL PROTECTED]
---
 scripts/kconfig/lxdialog/check-lxdialog.sh |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh 
b/scripts/kconfig/lxdialog/check-lxdialog.sh
index cdca738..9681476 100644
--- a/scripts/kconfig/lxdialog/check-lxdialog.sh
+++ b/scripts/kconfig/lxdialog/check-lxdialog.sh
@@ -51,7 +51,7 @@ usage() {
printf Usage: $0 [-check compiler options|-header|-library]\n
 }
 
-if [ $# == 0 ]; then
+if [ $# -eq 0 ]; then
usage
exit 1
 fi
-- 
1.5.1.rc3.1544.g8a923


- End forwarded message -

-
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 10/19] kbuild: add support for reading stdin with gen_init_cpio

2007-06-03 Thread Sam Ravnborg
Subject: [PATCH 10/19] kbuild: add support for reading stdin with gen_init_cpio
From: Mike Frysinger [EMAIL PROTECTED]
Date: Thu, 10 May 2007 22:44:28 -0700

Treat an argument of - as meaning read stdin for cpio files so
gen_init_cpio can be piped into.

Signed-off-by: Mike Frysinger [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Sam Ravnborg [EMAIL PROTECTED]
---
 usr/gen_init_cpio.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/usr/gen_init_cpio.c b/usr/gen_init_cpio.c
index 8365db6..7abc07f 100644
--- a/usr/gen_init_cpio.c
+++ b/usr/gen_init_cpio.c
@@ -498,7 +498,9 @@ int main (int argc, char *argv[])
exit(1);
}
 
-   if (! (cpio_list = fopen(argv[1], r))) {
+   if (!strcmp(argv[1], -))
+   cpio_list = stdin;
+   else if (! (cpio_list = fopen(argv[1], r))) {
fprintf(stderr, ERROR: unable to open '%s': %s\n\n,
argv[1], strerror(errno));
usage(argv[0]);
-- 
1.5.1.rc3.1544.g8a923


- End forwarded message -

-
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 10/19] kbuild: add support for reading stdin with gen_init_cpio

2007-06-03 Thread Sam Ravnborg
Subject: [PATCH 10/19] kbuild: add support for reading stdin with gen_init_cpio
From: Mike Frysinger [EMAIL PROTECTED]
Date: Thu, 10 May 2007 22:44:28 -0700

Treat an argument of - as meaning read stdin for cpio files so
gen_init_cpio can be piped into.

Signed-off-by: Mike Frysinger [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
Signed-off-by: Sam Ravnborg [EMAIL PROTECTED]
---
 usr/gen_init_cpio.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/usr/gen_init_cpio.c b/usr/gen_init_cpio.c
index 8365db6..7abc07f 100644
--- a/usr/gen_init_cpio.c
+++ b/usr/gen_init_cpio.c
@@ -498,7 +498,9 @@ int main (int argc, char *argv[])
exit(1);
}
 
-   if (! (cpio_list = fopen(argv[1], r))) {
+   if (!strcmp(argv[1], -))
+   cpio_list = stdin;
+   else if (! (cpio_list = fopen(argv[1], r))) {
fprintf(stderr, ERROR: unable to open '%s': %s\n\n,
argv[1], strerror(errno));
usage(argv[0]);
-- 
1.5.1.rc3.1544.g8a923


- End forwarded message -

-
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 11/19] kbuild: add support for squashing uid/gid in gen_initramfs_list.sh

2007-06-03 Thread Sam Ravnborg
Subject: [PATCH 11/19] kbuild: add support for squashing uid/gid in 
gen_initramfs_list.sh
From: Mike Frysinger [EMAIL PROTECTED]
Date: Thu, 10 May 2007 22:44:28 -0700

Sometimes it is useful to squash all uid's/gid's to 0:0 regardless of
current owner.  For example, in build systems that get run as arbitrary
users (uClinux-dist).  This adds a special squash keyword so you can do
'-g squash -u squash' and have ownership squashed to root.

Signed-off-by: Mike Frysinger [EMAIL PROTECTED]
Cc: Sam Ravnborg [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---
 scripts/gen_initramfs_list.sh |   12 ++--
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh
index 683eb12..684fb9c 100644
--- a/scripts/gen_initramfs_list.sh
+++ b/scripts/gen_initramfs_list.sh
@@ -19,11 +19,11 @@ $0 [-o file] [-u uid] [-g gid] {-d | cpio_source} 
...
-o file  Create gzipped initramfs file named file using
   gen_init_cpio and gzip
-u uid   User ID to map to user ID 0 (root).
-  uid is only meaningful if cpio_source
-  is a directory.
+  uid is only meaningful if cpio_source is a
+  directory.  squash forces all files to uid 0.
-g gid   Group ID to map to group ID 0 (root).
-  gid is only meaningful if cpio_source
-  is a directory.
+  gid is only meaningful if cpio_source is a
+  directory.  squash forces all files to gid 0.
cpio_source  File list or directory for cpio archive.
   If cpio_source is a .cpio file it will be used
   as direct input to initramfs.
@@ -113,8 +113,8 @@ parse() {
local gid=$4
local ftype=$(filetype ${location})
# remap uid/gid to 0 if necessary
-   [ $uid -eq $root_uid ]  uid=0
-   [ $gid -eq $root_gid ]  gid=0
+   [ $root_uid = squash ]  uid=0 || [ $uid -eq $root_uid ]  
uid=0
+   [ $root_gid = squash ]  gid=0 || [ $gid -eq $root_gid ]  
gid=0
local str=${mode} ${uid} ${gid}
 
[ ${ftype} == invalid ]  return 0
-- 
1.5.1.rc3.1544.g8a923


- End forwarded message -

-
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 12/19] kbuild: The .paravirtprobe section is obsolete, so modpost doesn't need to handle it

2007-06-03 Thread Sam Ravnborg
Subject: [PATCH 12/19] kbuild: The .paravirtprobe section is obsolete, so 
modpost doesn't need to handle it
From: Jeremy Fitzhardinge [EMAIL PROTECTED]
Date: Tue, 29 May 2007 13:33:01 -0700

The .paravirtprobe section is obsolete, so modpost doesn't need to handle it.

Signed-off-by: Jeremy Fitzhardinge [EMAIL PROTECTED]
Cc: Rusty Russell [EMAIL PROTECTED]
Signed-off-by: Sam Ravnborg [EMAIL PROTECTED]
---
 scripts/mod/modpost.c |   11 ---
 1 files changed, 0 insertions(+), 11 deletions(-)

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index f6bae03..662deba 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -637,12 +637,6 @@ static int strrcmp(const char *s, const char *sub)
  *  fromsec= .text*
  *  refsymname = logo_
  *
- * Pattern 8:
- *  Symbols contained in .paravirtprobe may safely reference .init.text.
- *  The pattern is:
- *  tosec   = .init.text
- *  fromsec  = .paravirtprobe
- *
  * Pattern 10:
  *  ia64 has machvec table for each platform and
  *  powerpc has a machine desc table for each platform.
@@ -726,11 +720,6 @@ static int secref_whitelist(const char *modname, const 
char *tosec,
(strncmp(refsymname, logo_, strlen(logo_)) == 0))
return 1;
 
-   /* Check for pattern 8 */
-   if ((strcmp(tosec, .init.text) == 0) 
-   (strcmp(fromsec, .paravirtprobe) == 0))
-   return 1;
-
/* Check for pattern 10 */
if ((strcmp(fromsec, .machvec) == 0) ||
(strcmp(fromsec, .machine.desc) == 0))
-- 
1.5.1.rc3.1544.g8a923


- End forwarded message -

-
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 13/19] kbuild: ignore section mismatch warnings originating from .note section

2007-06-03 Thread Sam Ravnborg
Subject: [PATCH 13/19] kbuild: ignore section mismatch warnings originating 
from .note section
From: Sam Ravnborg [EMAIL PROTECTED]
Date: Tue, 29 May 2007 23:09:35 +0200

.note* sections are ELF notes, which are typically used by external
tools to examine the kernel image.  Since this is removed from any
runtime consideration, it's OK to reference any section from a .note*
section.

Signed-off-by: Jeremy Fitzhardinge [EMAIL PROTECTED]
Cc: Eric W. Biederman [EMAIL PROTECTED]
Signed-off-by: Sam Ravnborg [EMAIL PROTECTED]
---
 scripts/mod/modpost.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 662deba..b824198 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1139,6 +1139,7 @@ static int init_section_ref_ok(const char *name)
.debug,
.parainstructions,
.rodata,
+   .note,/* ignore ELF notes - may contain 
anything */
NULL
};
/* part of section name */
@@ -1214,6 +1215,7 @@ static int exit_section_ref_ok(const char *name)
/* Start of section names */
const char *namelist2[] = {
.debug,
+   .note,/* ignore ELF notes - may contain 
anything */
NULL
};
/* part of section name */
-- 
1.5.1.rc3.1544.g8a923


- End forwarded message -

-
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 14/19] kbuild: refactor code in modpost to improve maintainability

2007-06-03 Thread Sam Ravnborg
Subject: [PATCH 14/19] kbuild: refactor code in modpost to improve 
maintainability
From: Sam Ravnborg [EMAIL PROTECTED]
Date: Sat, 2 Jun 2007 21:18:51 +0200

There were a great deal of overlap between the two functions
that check which sections may reference .init.text and .exit.text.
Factor out common check to a separate function and
sort entries in the original functions.

Signed-off-by: Sam Ravnborg [EMAIL PROTECTED]
---
 scripts/mod/modpost.c |  140 +++-
 1 files changed, 67 insertions(+), 73 deletions(-)

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index b824198..2b881c2 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -858,14 +858,6 @@ static void warn_sec_mismatch(const char *modname, const 
char *fromsec,
 elf-strtab + before-st_name, refsymname))
return;
 
-   /* fromsec whitelist - without a valid 'before'
-* powerpc has a GOT table in .got2 section
-* and also a .toc section */
-   if (strcmp(fromsec, .got2) == 0)
-   return;
-   if (strcmp(fromsec, .toc) == 0)
-   return;
-
if (before  after) {
warn(%s(%s+0x%llx): Section mismatch: reference to %s:%s 
 (between '%s' and '%s')\n,
@@ -1075,6 +1067,60 @@ static void check_sec_ref(struct module *mod, const char 
*modname,
}
 }
 
+/*
+ * Identify sections from which references to either a
+ * .init or a .exit section is OK.
+ *
+ * [OPD] Keith Ownes [EMAIL PROTECTED] commented:
+ * For our future {in}sanity, add a comment that this is the ppc .opd
+ * section, not the ia64 .opd section.
+ * ia64 .opd should not point to discarded sections.
+ * [.rodata] like for .init.text we ignore .rodata references -same reason
+ **/
+static int initexit_section_ref_ok(const char *name)
+{
+   const char **s;
+   /* Absolute section names */
+   const char *namelist1[] = {
+   __bug_table,  /* used by powerpc for BUG() */
+   __ex_table,
+   .altinstructions,
+   .fixup,
+   .opd, /* See comment [OPD] */
+   .parainstructions,
+   .pdr,
+   .plt, /* seen on ARCH=um build on x86_64. 
Harmless */
+   .smp_locks,
+   .stab,
+   NULL
+   };
+   /* Start of section names */
+   const char *namelist2[] = {
+   .debug,
+   .eh_frame,
+   .note,/* ignore ELF notes - may contain 
anything */
+   .got, /* powerpc - global offset table */
+   .toc, /* powerpc - table of contents */
+   NULL
+   };
+   /* part of section name */
+   const char *namelist3 [] = {
+   .unwind,  /* Sample: IA_64.unwind.exit.text */
+   NULL
+   };
+
+   for (s = namelist1; *s; s++)
+   if (strcmp(*s, name) == 0)
+   return 1;
+   for (s = namelist2; *s; s++)
+   if (strncmp(*s, name, strlen(*s)) == 0)
+   return 1;
+   for (s = namelist3; *s; s++)
+   if (strstr(name, *s) != NULL)
+   return 1;
+   return 0;
+}
+
 /**
  * Functions used only during module init is marked __init and is stored in
  * a .init.text section. Likewise data is marked __initdata and stored in
@@ -,52 +1157,32 @@ static int init_section_ref_ok(const char *name)
const char **s;
/* Absolute section names */
const char *namelist1[] = {
+   __ftr_fixup,  /* powerpc cpu feature fixup */
+   __fw_ftr_fixup,   /* powerpc firmware feature fixup */
+   __param,
+   .data.rel.ro, /* used by parisc64 */
.init,
-   .opd,   /* see comment [OPD] at exit_section_ref_ok() */
-   .toc1,  /* used by ppc64 */
-   .stab,
-   .data.rel.ro, /* used by parisc64 */
-   .parainstructions,
-   .text.lock,
-   __bug_table, /* used by powerpc for BUG() */
.pci_fixup_header,
.pci_fixup_final,
-   .pdr,
-   __param,
-   __ex_table,
-   .fixup,
-   .smp_locks,
-   .plt,  /* seen on ARCH=um build on x86_64. Harmless */
-   __ftr_fixup,  /* powerpc cpu feature fixup */
-   __fw_ftr_fixup,   /* powerpc firmware feature fixup */
+   .text.lock,
NULL
};
/* Start of section names */
const char *namelist2[] = {
.init.,
-   .altinstructions,
-   .eh_frame,
-   .debug,
-   .parainstructions,
.rodata,
-   

[kbuild-devel] [PATCH 15/19] kbuild: warn about references from .init.text to .exit.text

2007-06-03 Thread Sam Ravnborg
Subject: [PATCH 15/19] kbuild: warn about references from .init.text to 
.exit.text
From: Sam Ravnborg [EMAIL PROTECTED]
Date: Sat, 2 Jun 2007 21:29:20 +0200

The .exit.text section may be discarded either at build or at runtime.
So let modpost warn if this situation is detected.

Signed-off-by: Sam Ravnborg [EMAIL PROTECTED]
---
 scripts/mod/modpost.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 2b881c2..0f9130f 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1216,7 +1216,6 @@ static int exit_section_ref_ok(const char *name)
.exit.data,
.exit.text,
.exitcall.exit,
-   .init.text,
.rodata,
NULL
};
-- 
1.5.1.rc3.1544.g8a923


- End forwarded message -

-
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 16/19] kbuild: remove hardcoded apic_es7000 from modpost

2007-06-03 Thread Sam Ravnborg
Subject: [PATCH 16/19] kbuild: remove hardcoded apic_es7000 from modpost
From: Sam Ravnborg [EMAIL PROTECTED]
Date: Sun, 3 Jun 2007 00:05:10 +0200

Replace the hardcoded variable name apic_es7000 in modpost
with a __initdata_refok marker.

Signed-off-by: Sam Ravnborg [EMAIL PROTECTED]
---
 arch/i386/mach-generic/es7000.c |2 +-
 scripts/mod/modpost.c   |1 -
 2 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/arch/i386/mach-generic/es7000.c b/arch/i386/mach-generic/es7000.c
index b47f951..4742626 100644
--- a/arch/i386/mach-generic/es7000.c
+++ b/arch/i386/mach-generic/es7000.c
@@ -66,4 +66,4 @@ static int __init acpi_madt_oem_check(char *oem_id, char 
*oem_table_id)
 }
 #endif
 
-struct genapic apic_es7000 = APIC_INIT(es7000, probe_es7000);
+struct genapic __initdata_refok apic_es7000 = APIC_INIT(es7000, 
probe_es7000);
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 0f9130f..877ed0c 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -657,7 +657,6 @@ static int secref_whitelist(const char *modname, const char 
*tosec,
_probe,
_probe_one,
_console,
-   apic_es7000,
NULL
};
 
-- 
1.5.1.rc3.1544.g8a923


- End forwarded message -

-
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 17/19] kbuild: refactor code in modpost

2007-06-03 Thread Sam Ravnborg
Subject: [PATCH 17/19] kbuild: refactor code in modpost
From: Sam Ravnborg [EMAIL PROTECTED]
Date: Sun, 3 Jun 2007 00:41:22 +0200

Move more checks from whitelist to the section check functions
Renumber the patterns.
No functional changes.
Signed-off-by: Sam Ravnborg [EMAIL PROTECTED]
---
 scripts/mod/modpost.c |   33 +++--
 1 files changed, 7 insertions(+), 26 deletions(-)

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 877ed0c..f0474a9 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -612,14 +612,10 @@ static int strrcmp(const char *s, const char *sub)
  *   atsym = *driver, *_template, *_sht, *_ops, *_probe, *probe_one, *_console
  *
  * Pattern 3:
- *   Whitelist all references from .pci_fixup* section to .init.text
- *   This is part of the PCI init when built-in
- *
- * Pattern 4:
  *   Whitelist all refereces from .text.head to .init.data
  *   Whitelist all refereces from .text.head to .init.text
  *
- * Pattern 5:
+ * Pattern 4:
  *   Some symbols belong to init section but still it is ok to reference
  *   these from non-init sections as these symbols don't have any memory
  *   allocated for them and symbol address and value are same. So even
@@ -628,7 +624,7 @@ static int strrcmp(const char *s, const char *sub)
  *   This pattern is identified by
  *   refsymname = __init_begin, _sinittext, _einittext
  *
- * Pattern 7:
+ * Pattern 5:
  *  Logos used in drivers/video/logo reside in __initdata but the
  *  funtion that references them are EXPORT_SYMBOL() so cannot be
  *  marker __init. So we whitelist them here.
@@ -636,12 +632,6 @@ static int strrcmp(const char *s, const char *sub)
  *  tosec  = .init.data
  *  fromsec= .text*
  *  refsymname = logo_
- *
- * Pattern 10:
- *  ia64 has machvec table for each platform and
- *  powerpc has a machine desc table for each platform.
- *  It is mixture of function pointers of .init.text and .text.
- *  fromsec  = .machvec | .machine.desc
  **/
 static int secref_whitelist(const char *modname, const char *tosec,
const char *fromsec, const char *atsym,
@@ -698,32 +688,22 @@ static int secref_whitelist(const char *modname, const 
char *tosec,
return 1;
 
/* Check for pattern 3 */
-   if ((strncmp(fromsec, .pci_fixup, strlen(.pci_fixup)) == 0) 
-   (strcmp(tosec, .init.text) == 0))
-   return 1;
-
-   /* Check for pattern 4 */
if ((strcmp(fromsec, .text.head) == 0) 
((strcmp(tosec, .init.data) == 0) ||
(strcmp(tosec, .init.text) == 0)))
return 1;
 
-   /* Check for pattern 5 */
+   /* Check for pattern 4 */
for (s = pat3refsym; *s; s++)
if (strcmp(refsymname, *s) == 0)
return 1;
 
-   /* Check for pattern 7 */
+   /* Check for pattern 5 */
if ((strcmp(tosec, .init.data) == 0) 
(strncmp(fromsec, .text, strlen(.text)) == 0) 
(strncmp(refsymname, logo_, strlen(logo_)) == 0))
return 1;
 
-   /* Check for pattern 10 */
-   if ((strcmp(fromsec, .machvec) == 0) ||
-   (strcmp(fromsec, .machine.desc) == 0))
-   return 1;
-
return 0;
 }
 
@@ -1085,6 +1065,8 @@ static int initexit_section_ref_ok(const char *name)
__ex_table,
.altinstructions,
.fixup,
+   .machvec, /* ia64 + powerpc uses these */
+   .machine.desc,
.opd, /* See comment [OPD] */
.parainstructions,
.pdr,
@@ -1161,14 +1143,13 @@ static int init_section_ref_ok(const char *name)
__param,
.data.rel.ro, /* used by parisc64 */
.init,
-   .pci_fixup_header,
-   .pci_fixup_final,
.text.lock,
NULL
};
/* Start of section names */
const char *namelist2[] = {
.init.,
+   .pci_fixup,
.rodata,
NULL
};
-- 
1.5.1.rc3.1544.g8a923


- End forwarded message -

-
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 18/19] kbuild: remove hardcoded _logo names from modpost

2007-06-03 Thread Sam Ravnborg
Subject: [PATCH 18/19] kbuild: remove hardcoded _logo names from modpost
From: Sam Ravnborg [EMAIL PROTECTED]
Date: Sun, 3 Jun 2007 00:47:53 +0200

Replaced this with a __init_refok marker
in front of fb_find_logo().

I think that the __initdata marker for the logo's are
wrong but I have not justified this so I did not remove it.

Signed-off-by: Sam Ravnborg [EMAIL PROTECTED]
---
 drivers/video/logo/logo.c |7 +--
 scripts/mod/modpost.c |   14 --
 2 files changed, 5 insertions(+), 16 deletions(-)

diff --git a/drivers/video/logo/logo.c b/drivers/video/logo/logo.c
index 80c0361..2b0f799 100644
--- a/drivers/video/logo/logo.c
+++ b/drivers/video/logo/logo.c
@@ -34,8 +34,11 @@ extern const struct linux_logo logo_superh_vga16;
 extern const struct linux_logo logo_superh_clut224;
 extern const struct linux_logo logo_m32r_clut224;
 
-
-const struct linux_logo *fb_find_logo(int depth)
+/* logo's are marked __initdata. Use __init_refok to tell
+ * modpost that it is intended that this function uses data
+ * marked __initdata.
+ */
+const struct linux_logo * __init_refok fb_find_logo(int depth)
 {
const struct linux_logo *logo = NULL;
 
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index f0474a9..96078bb 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -624,14 +624,6 @@ static int strrcmp(const char *s, const char *sub)
  *   This pattern is identified by
  *   refsymname = __init_begin, _sinittext, _einittext
  *
- * Pattern 5:
- *  Logos used in drivers/video/logo reside in __initdata but the
- *  funtion that references them are EXPORT_SYMBOL() so cannot be
- *  marker __init. So we whitelist them here.
- *  The pattern is:
- *  tosec  = .init.data
- *  fromsec= .text*
- *  refsymname = logo_
  **/
 static int secref_whitelist(const char *modname, const char *tosec,
const char *fromsec, const char *atsym,
@@ -698,12 +690,6 @@ static int secref_whitelist(const char *modname, const 
char *tosec,
if (strcmp(refsymname, *s) == 0)
return 1;
 
-   /* Check for pattern 5 */
-   if ((strcmp(tosec, .init.data) == 0) 
-   (strncmp(fromsec, .text, strlen(.text)) == 0) 
-   (strncmp(refsymname, logo_, strlen(logo_)) == 0))
-   return 1;
-
return 0;
 }
 
-- 
1.5.1.rc3.1544.g8a923


- End forwarded message -

-
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 19/19] kbuild: whitelist references from variables named _timer to .init.text

2007-06-03 Thread Sam Ravnborg
Subject: [PATCH 19/19] kbuild: whitelist references from variables named _timer 
to .init.text
From: Sam Ravnborg [EMAIL PROTECTED]
Date: Sun, 3 Jun 2007 22:19:24 +0200

arm uses a lot of ops structures named *_timer that has legitimite
references to .init.text.
So let's add this variable to the list of variables that may reference
.init.text without causing any warning.

Signed-off-by: Sam Ravnborg [EMAIL PROTECTED]
---
 scripts/mod/modpost.c |7 ++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 96078bb..51921aa 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -609,7 +609,7 @@ static int strrcmp(const char *s, const char *sub)
  *   the pattern is identified by:
  *   tosec   = .init.text | .exit.text | .init.data
  *   fromsec = .data
- *   atsym = *driver, *_template, *_sht, *_ops, *_probe, *probe_one, *_console
+ *   atsym = *driver, *_template, *_sht, *_ops, *_probe, *probe_one, 
*_console, *_timer
  *
  * Pattern 3:
  *   Whitelist all refereces from .text.head to .init.data
@@ -634,6 +634,7 @@ static int secref_whitelist(const char *modname, const char 
*tosec,
const char *pat2sym[] = {
driver,
_template, /* scsi uses *_template a lot */
+   _timer,/* arm uses ops structures named _timer a lot */
_sht,  /* scsi also used *_sht to some extent */
_ops,
_probe,
@@ -1149,6 +1150,10 @@ static int init_section_ref_ok(const char *name)
for (s = namelist2; *s; s++)
if (strncmp(*s, name, strlen(*s)) == 0)
return 1;
+
+   /* If section name ends with .init we allow references
+* as is the case with .initcallN.init, .early_param.init, 
.taglist.init etc
+*/
if (strrcmp(name, .init) == 0)
return 1;
return 0;
-- 
1.5.1.rc3.1544.g8a923

- End forwarded message -

-
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] kbuild update

2007-06-03 Thread Sam Ravnborg
Hmm, the patch serie should have been chained.

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