Skip to contentSkip to conversation

kbuild updates for merge window

GIT PATCES In review Sam Ravnborg 8 participants 51 messages Jul 17, 2007 – Jul 21, 2007 2 messages not in the archive

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

Hi Linus.

First kbuild push for the merge window. A bit late since I have been on vacation. The most noteworthy are quite some refactoring to produce better section mismatch warnings.
The rest is basically just small changes with no major impact.

The optimised header-check was not ready - it will be pushed later.

Half of this or more has been in -mm but there is also a few patches that did not appear in -mm due to me being late.

Sam

Please pull from:
git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild.git

Adrian Bunk (1):
kbuild: use -fno-optimize-sibling-calls unconditionally

Aneesh Kumar K.V (1):
kbuild: fix the warning when running make tags

Atsushi Nemoto (1):
kbuild: make better section mismatch reports on i386 and mips

Bernhard Walle (1):
kconfig: strip 'CONFIG_' automatically in kernel configuration search

H. Peter Anvin (1):
scripts: Make cleanfile/cleanpatch warn about long lines

Jan Beulich (1):
modpost white list pattern adjustment

Jeremy Fitzhardinge (1):
kbuild: .paravirtprobe section is obsolete, so modpost doesn't need to handle it

Mathieu Desnoyers (3):
cris: use DATA_DATA in cris
powerpc: add missing DATA_DATA to powerpc
xtensa: use DATA_DATA in xtensa

Mike Frysinger (4):
kconfig: use POSIX equality test in check-lxdialog.sh
kbuild: add support for reading stdin with gen_init_cpio
kbuild: add support for squashing uid/gid in gen_initramfs_list.sh
kbuild: use POSIX BRE in headers install target

Paulo Marques (1):
kallsyms: remove usage of memmem and _GNU_SOURCE from scripts/kallsyms.c

Ralf Baechle (1):
Whitelist references from __dbe_table to .init

Roman Zippel (1):
kconfig: reset generated values only if Kconfig and .config agree.

Sam Ravnborg (13):
kbuild: asm-offsets.h is now cleaned with O=.. builds
kbuild: document cc-fullversion
kbuild: avoid environment to set variables used by kbuild
kconfig: fix update-po-config
kbuild: make better section mismatch reports on arm
kbuild: ignore section mismatch warnings originating from .note section
kbuild: refactor code in modpost to improve maintainability
kbuild: consolidate section checks
kbuild: warn about references from .init.text to .exit.text
kbuild: remove hardcoded apic_es7000 from modpost
kbuild: remove hardcoded _logo names from modpost
kbuild: whitelist references from variables named _timer to .init.text
kbuild: do section mismatch check on full vmlinux

Segher Boessenkool (2):
kbuild: New 'cc-fullversion' macro
powerpc: Refuse to build 64-bit with GCC-4.2.0 and CONFIG_MODULES

Stephen Rothwell (1):
kbuild: suppress modpost warnings for references from the .toc section as used by powerpc

 Documentation/kbuild/makefiles.txt         |   14 ++
 Kbuild                                     |    1 +
 Makefile                                   |   26 ++-
 arch/cris/arch-v10/vmlinux.lds.S           |    2 +-
 arch/cris/arch-v32/vmlinux.lds.S           |    2 +-
 arch/i386/mach-generic/es7000.c            |    2 +-
 arch/powerpc/Makefile                      |    8 +
 arch/powerpc/kernel/vmlinux.lds.S          |    4 +-
 arch/xtensa/kernel/vmlinux.lds.S           |    3 +-
 drivers/video/logo/logo.c                  |    7 +-
 scripts/Kbuild.include                     |    7 +-
 scripts/Makefile.build                     |   16 ++
 scripts/Makefile.headersinst               |   14 +-
 scripts/Makefile.modpost                   |    4 +-
 scripts/cleanfile                          |   54 +++++-
 scripts/cleanpatch                         |   58 +++++-
 scripts/gcc-version.sh                     |   15 +-
 scripts/gen_initramfs_list.sh              |   12 +-
 scripts/kallsyms.c                         |   17 ++-
 scripts/kconfig/Makefile                   |   35 ++--
 scripts/kconfig/confdata.c                 |   37 +++-
 scripts/kconfig/kxgettext.c                |    4 +-
 scripts/kconfig/lxdialog/check-lxdialog.sh |    2 +-
 scripts/kconfig/mconf.c                    |   11 +-
 scripts/mod/modpost.c                      |  312 ++++++++++++++++-----------
 scripts/mod/modpost.h                      |    3 +
 usr/gen_init_cpio.c                        |    4 +-
 27 files changed, 474 insertions(+), 200 deletions(-)
#1 lore raw

PATCH 1/33 kbuild: asm-offsets.h is now cleaned with O=.. builds

Reported by: "Robert P. J. Day" <[email protected]>

Cc "Robert P. J. Day" <[email protected]>
---
 Kbuild |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
Kbuild +1 -0
index 163f8cb..56b8edf 100644
@@ -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
Signature · 1 line
1.5.0.6
#2 lore raw

PATCH 2/33 kbuild: New 'cc-fullversion' macro

From: Segher Boessenkool <[email protected]>

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

---
 scripts/Kbuild.include |    7 ++++++-
 scripts/gcc-version.sh |   15 ++++++++++++---
 2 files changed, 18 insertions(+), 4 deletions(-)
scripts/Kbuild.include +6 -1
index 06c1a37..677bc6c 100644
@@ -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))
scripts/gcc-version.sh +12 -3
index bb4fbea..8a1d187 100644
@@ -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
Signature · 1 line
1.5.0.6
#3 lore raw

PATCH 3/33 powerpc: Refuse to build 64-bit with GCC-4.2.0 and CONFIG_MODULES

From: Segher Boessenkool <[email protected]>

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

---
 arch/powerpc/Makefile |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
arch/powerpc/Makefile +8 -0
index fbafd96..85be605 100644
@@ -201,6 +201,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 2>&1 ; then \
 		echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build ' ; \
 		echo 'correctly with old versions of binutils.' ; \
Signature · 1 line
1.5.0.6
#4 lore raw

PATCH 4/33 kbuild: document cc-fullversion

---
 Documentation/kbuild/makefiles.txt |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
Documentation/kbuild/makefiles.txt +14 -0
index bb5306e..e08ef87 100644
@@ -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 useful 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
+	to the user why it stops.
 
 === 4 Host Program support
 
Signature · 1 line
1.5.0.6
#5 lore raw

PATCH 5/33 kbuild: avoid environment to set variables used by kbuild

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

---
 scripts/Makefile.build |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
scripts/Makefile.build +16 -0
index a525112..3f7b451 100644
@@ -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
 
Signature · 1 line
1.5.0.6

A message that is not in the archive (sent off-list or not yet received): [email protected]

#7 lore raw

PATCH 7/33 kconfig: use POSIX equality test in check-lxdialog.sh

From: Mike Frysinger <[email protected]>

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

---
 scripts/kconfig/lxdialog/check-lxdialog.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
scripts/kconfig/lxdialog/check-lxdialog.sh +1 -1
index cdca738..9681476 100644
@@ -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
Signature · 1 line
1.5.0.6
#8 lore raw

PATCH 8/33 kbuild: add support for reading stdin with gen_init_cpio

From: Mike Frysinger <[email protected]>

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

---
 usr/gen_init_cpio.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
usr/gen_init_cpio.c +3 -1
index 8365db6..7abc07f 100644
@@ -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]);
Signature · 1 line
1.5.0.6
#9 lore raw

PATCH 9/33 kbuild: add support for squashing uid/gid in gen_initramfs_list.sh

From: Mike Frysinger <[email protected]>

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.

---
 scripts/gen_initramfs_list.sh |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
scripts/gen_initramfs_list.sh +6 -6
index 683eb12..684fb9c 100644
@@ -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
Signature · 1 line
1.5.0.6
#10 lore raw

PATCH 10/33 kconfig: fix update-po-config

Massimo Maiurana <[email protected]> reported that update-po-config was broken:
1) spelling errors in Makefile so arch/um failed
2) UTF-8 was not supported

The following patch address the above problems. kxgettext now append the output to the .pot file generated by xgettext - so we have a header. In all places UFT-8 is specifed so we now flawlessly support UTF-8.
The Kconfig files had an empty string in a few cases - these are now supressed in kxgettext.

With this the translators can now pick up where they left and get it all translated.
There are ~11000 strings to be translated...

Cc Massimo Maiurana <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
---
 scripts/kconfig/Makefile    |   35 ++++++++++++++++++-----------------
 scripts/kconfig/kxgettext.c |    4 +++-
 2 files changed, 21 insertions(+), 18 deletions(-)
scripts/kconfig/Makefile +18 -17
index fb2bb30..8986a48 100644
@@ -22,24 +22,25 @@ oldconfig: $(obj)/conf
 silentoldconfig: $(obj)/conf
 	$< -s arch/$(ARCH)/Kconfig
 
+# Create new linux.po file
+# Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files
+# The symlink is used to repair a deficiency in arch/um
 update-po-config: $(obj)/kxgettext
-	xgettext --default-domain=linux \
-          --add-comments --keyword=_ --keyword=N_ \
-          --files-from=scripts/kconfig/POTFILES.in \
-          --output scripts/kconfig/config.pot
-	$(Q)ln -fs Kconfig_i386 arch/um/Kconfig_arch
-	$(Q)for i in `ls arch/`; \
-	do \
-	  scripts/kconfig/kxgettext arch/$$i/Kconfig \
-	    | msguniq -o scripts/kconfig/linux_$${i}.pot; \
-	done
-	$(Q)msgcat scripts/kconfig/config.pot \
-	  `find scripts/kconfig/ -type f -name linux_*.pot` \
-	  --output scripts/kconfig/linux_raw.pot
-	$(Q)msguniq --sort-by-file scripts/kconfig/linux_raw.pot \
-	    --output scripts/kconfig/linux.pot
-	$(Q)rm -f arch/um/Kconfig_arch
-	$(Q)rm -f scripts/kconfig/linux_*.pot scripts/kconfig/config.pot
+	xgettext --default-domain=linux                  \
+	    --add-comments --keyword=_ --keyword=N_      \
+	    --from-code=UTF-8                            \
+	    --files-from=scripts/kconfig/POTFILES.in     \
+	    --output $(obj)/config.pot
+	$(Q)sed -i s/CHARSET/UTF-8/ $(obj)/config.pot
+	$(Q)ln -fs Kconfig.i386 arch/um/Kconfig.arch
+	(for i in `ls arch/`;                            \
+	do                                               \
+	    $(obj)/kxgettext arch/$$i/Kconfig;           \
+	done ) >> $(obj)/config.pot
+	msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \
+	    --output $(obj)/linux.pot
+	$(Q)rm -f arch/um/Kconfig.arch
+	$(Q)rm -f $(obj)/config.pot
 
 PHONY += randconfig allyesconfig allnoconfig allmodconfig defconfig
 
scripts/kconfig/kxgettext.c +3 -1
index abee55c..11f7dab 100644
@@ -212,7 +212,9 @@ void menu__xgettext(void)
 	struct message *m = message__list;
 
 	while (m != NULL) {
-		message__print_gettext_msgid_msgstr(m);
+		/* skip empty lines ("") */
+		if (strlen(m->msg) > sizeof("\"\""))
+			message__print_gettext_msgid_msgstr(m);
 		m = m->next;
 	}
 }
Signature · 1 line
1.5.0.6
#11 lore raw

PATCH 11/33 kbuild: make better section mismatch reports on i386 and mips

From: Atsushi Nemoto <[email protected]>

On i386 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.

---
 scripts/mod/modpost.c |   73 +++++++++++++++++++++++++++++++++++++++++++++++++
 scripts/mod/modpost.h |    3 ++
 2 files changed, 76 insertions(+), 0 deletions(-)
scripts/mod/modpost.c +73 -0
index 3645e98..b83cddb 100644
@@ -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,58 @@ static void warn_sec_mismatch(const char *modname, const char *fromsec,
 	}
 }
 
+static 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 int 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;
+	}
+	return 0;
+}
+
+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 & 0xffff;
+		break;
+	case R_MIPS_26:
+		r->r_addend = (inst & 0x03ffffff) << 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 +995,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);
+					r.r_info = ELF64_R_INFO(r_sym, r_typ);
 				} else {
 					r.r_info = TO_NATIVE(rela->r_info);
 					r_sym = ELF_R_SYM(r.r_info);
@@ -972,8 +1032,11 @@ static void check_sec_ref(struct module *mod, const char *modname,
 				r.r_offset = TO_NATIVE(rel->r_offset);
 #if KERNEL_ELFCLASS == ELFCLASS64
 				if (hdr->e_machine == EM_MIPS) {
+					unsigned int r_typ;
 					r_sym = ELF64_MIPS_R_SYM(rel->r_info);
 					r_sym = TO_NATIVE(r_sym);
+					r_typ = ELF64_MIPS_R_TYPE(rel->r_info);
+					r.r_info = ELF64_R_INFO(r_sym, r_typ);
 				} else {
 					r.r_info = TO_NATIVE(rel->r_info);
 					r_sym = ELF_R_SYM(r.r_info);
@@ -983,6 +1046,16 @@ static void check_sec_ref(struct module *mod, const char *modname,
 				r_sym = ELF_R_SYM(r.r_info);
 #endif
 				r.r_addend = 0;
+				switch (hdr->e_machine) {
+				case EM_386:
+					if (addend_386_rel(elf, i, &r))
+						continue;
+					break;
+				case EM_MIPS:
+					if (addend_mips_rel(elf, i, &r))
+						continue;
+					break;
+				}
 				sym = elf->symtab_start + r_sym;
 				/* Skip special sections */
 				if (sym->st_shndx >= SHN_LORESERVE)
scripts/mod/modpost.h +3 -0
index 0858caa..4156dd3 100644
@@ -60,6 +60,9 @@ typedef union
 #define ELF64_MIPS_R_SYM(i) \
   ((__extension__ (_Elf64_Mips_R_Info_union)(i)).r_info_fields.r_sym)
 
+#define ELF64_MIPS_R_TYPE(i) \
+  ((__extension__ (_Elf64_Mips_R_Info_union)(i)).r_info_fields.r_type1)
+
 #if KERNEL_ELFDATA != HOST_ELFDATA
 
 static inline void __endian(const void *src, void *dest, unsigned int size)
Signature · 1 line
1.5.0.6
#12 lore raw

PATCH 12/33 kbuild: make better section mismatch reports on arm

With this change we can find more symbols hereby improving the readability of the warnings.

---
 scripts/mod/modpost.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)
scripts/mod/modpost.c +24 -0
index b83cddb..256b3d2 100644
@@ -929,6 +929,26 @@ static int addend_386_rel(struct elf_info *elf, int rsection, Elf_Rela *r)
 	return 0;
 }
 
+static int addend_arm_rel(struct elf_info *elf, int rsection, Elf_Rela *r)
+{
+	unsigned int r_typ = ELF_R_TYPE(r->r_info);
+
+	switch (r_typ) {
+	case R_ARM_ABS32:
+		/* From ARM ABI: (S + A) | T */
+		r->r_addend = (int)(long)(elf->symtab_start + ELF_R_SYM(r->r_info));
+		break;
+	case R_ARM_PC24:
+		/* From ARM ABI: ((S + A) | T) - P */
+		r->r_addend = (int)(long)(elf->hdr + elf->sechdrs[rsection].sh_offset +
+		                          (r->r_offset - elf->sechdrs[rsection].sh_addr));
+		break;
+	default:
+		return 1;
+	}
+	return 0;
+}
+
 static int addend_mips_rel(struct elf_info *elf, int rsection, Elf_Rela *r)
 {
 	unsigned int r_typ = ELF_R_TYPE(r->r_info);
@@ -1051,6 +1071,10 @@ static void check_sec_ref(struct module *mod, const char *modname,
 					if (addend_386_rel(elf, i, &r))
 						continue;
 					break;
+				case EM_ARM:
+					if(addend_arm_rel(elf, i, &r))
+						continue;
+					break;
 				case EM_MIPS:
 					if (addend_mips_rel(elf, i, &r))
 						continue;
Signature · 1 line
1.5.0.6
#13 lore raw

PATCH 13/33 kbuild: suppress modpost warnings for references from the .toc section as used by powerpc

From: Stephen Rothwell <[email protected]>

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

---
 scripts/mod/modpost.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
scripts/mod/modpost.c +4 -1
index 256b3d2..fa33a6b 100644
@@ -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 "
Signature · 1 line
1.5.0.6
#14 lore raw

PATCH 14/33 kbuild: .paravirtprobe section is obsolete, so modpost doesn't need to handle it

From: Jeremy Fitzhardinge <[email protected]>

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

---
 scripts/mod/modpost.c |   11 -----------
 1 files changed, 0 insertions(+), 11 deletions(-)
scripts/mod/modpost.c +0 -11
index fa33a6b..ece09c5 100644
@@ -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))
Signature · 1 line
1.5.0.6
#15 lore raw

PATCH 15/33 kbuild: ignore section mismatch warnings originating from .note section

.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.

---
 scripts/mod/modpost.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
scripts/mod/modpost.c +2 -0
index ece09c5..9c35f30 100644
@@ -1152,6 +1152,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 */
@@ -1228,6 +1229,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 */
Signature · 1 line
1.5.0.6
#16 lore raw

PATCH 16/33 kbuild: refactor code in modpost to improve maintainability

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.

---
 scripts/mod/modpost.c |  154 ++++++++++++++++++++++++-------------------------
 1 files changed, 75 insertions(+), 79 deletions(-)
scripts/mod/modpost.c +75 -79
index 9c35f30..f22c8b4 100644
@@ -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",
@@ -1087,6 +1079,61 @@ 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",
+		".cranges",		/* used by sh64 */
+		".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
@@ -1103,7 +1150,7 @@ static int init_section(const char *name)
 	return 0;
 }
 
-/**
+/*
  * Identify sections from which references to a .init section is OK.
  *
  * Unfortunately references to read only data that referenced .init
@@ -1117,59 +1164,41 @@ static int init_section(const char *name)
  *
  * where vgacon_startup is __init.  If you want to wade through the false
  * positives, take out the check for rodata.
- **/
+ */
 static int init_section_ref_ok(const char *name)
 {
 	const char **s;
 	/* Absolute section names */
 	const char *namelist1[] = {
-		".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 */
-		".cranges",	/* used by sh64 */
+		"__param",
+		".data.rel.ro",		/* used by parisc64 */
+		".init",
+		".text.lock",
 		NULL
 	};
 	/* Start of section names */
 	const char *namelist2[] = {
 		".init.",
-		".altinstructions",
-		".eh_frame",
-		".debug",
-		".parainstructions",
+		".pci_fixup",
 		".rodata",
-		".note",		/* ignore ELF notes - may contain anything */
-		NULL
-	};
-	/* part of section name */
-	const char *namelist3 [] = {
-		".unwind",  /* sample: IA_64.unwind.init.text */
 		NULL
 	};
 
+	if (initexit_section_ref_ok(name))
+		return 1;
+
 	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;
+
+	/* 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;
@@ -1194,59 +1223,26 @@ static int exit_section(const char *name)
 
 /*
  * Identify sections from which references to 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 exit_section_ref_ok(const char *name)
 {
 	const char **s;
 	/* Absolute section names */
 	const char *namelist1[] = {
-		".exit.text",
 		".exit.data",
+		".exit.text",
+		".exitcall.exit",
 		".init.text",
 		".rodata",
-		".opd", /* See comment [OPD] */
-		".toc1",  /* used by ppc64 */
-		".altinstructions",
-		".pdr",
-		"__bug_table", /* used by powerpc for BUG() */
-		".exitcall.exit",
-		".eh_frame",
-		".parainstructions",
-		".stab",
-		"__ex_table",
-		".fixup",
-		".smp_locks",
-		".plt",  /* seen on ARCH=um build on x86_64. Harmless */
-		".cranges",	/* used by sh64 */
-		NULL
-	};
-	/* Start of section names */
-	const char *namelist2[] = {
-		".debug",
-		".note",		/* ignore ELF notes - may contain anything */
-		NULL
-	};
-	/* part of section name */
-	const char *namelist3 [] = {
-		".unwind",  /* Sample: IA_64.unwind.exit.text */
 		NULL
 	};
 
+	if (initexit_section_ref_ok(name))
+		return 1;
+
 	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;
 }
 
Signature · 1 line
1.5.0.6
#17 lore raw

PATCH 17/33 kbuild: consolidate section checks

Move more checks from whitelist to the section check functions. Remove the redundent pci_fixup check.
Renumber the patterns.
No functional changes.

---
 scripts/mod/modpost.c |   32 +++++++-------------------------
 1 files changed, 7 insertions(+), 25 deletions(-)
scripts/mod/modpost.c +7 -25
index f22c8b4..1ef7875 100644
@@ -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,
@@ -699,32 +689,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;
 }
 
@@ -1088,7 +1068,7 @@ static void check_sec_ref(struct module *mod, const char *modname,
  * 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;
@@ -1099,6 +1079,8 @@ static int initexit_section_ref_ok(const char *name)
 		".altinstructions",
 		".cranges",		/* used by sh64 */
 		".fixup",
+		".machvec",		/* ia64 + powerpc uses these */
+		".machine.desc",
 		".opd",			/* See comment [OPD] */
 		".parainstructions",
 		".pdr",
Signature · 1 line
1.5.0.6
#18 lore raw

PATCH 18/33 kbuild: warn about references from .init.text to .exit.text

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

---
 scripts/mod/modpost.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
scripts/mod/modpost.c +0 -1
index 1ef7875..7f5ff7e 100644
@@ -1214,7 +1214,6 @@ static int exit_section_ref_ok(const char *name)
 		".exit.data",
 		".exit.text",
 		".exitcall.exit",
-		".init.text",
 		".rodata",
 		NULL
 	};
Signature · 1 line
1.5.0.6
#19 lore raw

PATCH 19/33 kbuild: remove hardcoded apic_es7000 from modpost

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

---
 arch/i386/mach-generic/es7000.c |    2 +-
 scripts/mod/modpost.c           |    1 -
 2 files changed, 1 insertions(+), 2 deletions(-)
arch/i386/mach-generic/es7000.c +1 -1
index b47f951..4742626 100644
@@ -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);
scripts/mod/modpost.c +0 -1
index 7f5ff7e..1921c43 100644
@@ -647,7 +647,6 @@ static int secref_whitelist(const char *modname, const char *tosec,
 		"_probe",
 		"_probe_one",
 		"_console",
-		"apic_es7000",
 		NULL
 	};
 
Signature · 1 line
1.5.0.6
#20 lore raw

PATCH 20/33 kbuild: remove hardcoded _logo names from modpost

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.

---
 drivers/video/logo/logo.c |    7 +++++--
 scripts/mod/modpost.c     |   14 --------------
 2 files changed, 5 insertions(+), 16 deletions(-)
drivers/video/logo/logo.c +5 -2
index 80c0361..2b0f799 100644
@@ -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;
 
scripts/mod/modpost.c +0 -14
index 1921c43..015c6b0 100644
@@ -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;
 }
 
Signature · 1 line
1.5.0.6
#21 lore raw

PATCH 21/33 kbuild: whitelist references from variables named _timer to .init.text

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.

---
 scripts/mod/modpost.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
scripts/mod/modpost.c +2 -1
index 015c6b0..bb895b1 100644
@@ -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",
Signature · 1 line
1.5.0.6
#22 lore raw

PATCH 22/33 kbuild: do section mismatch check on full vmlinux

Previously we did do the check on the .o files used to link vmlinux but that failed to find questionable references across the .o files.
Create a dedicated vmlinux.o file used only for section mismatch checks that uses the defualt linker script so section does not get renamed.

The vmlinux.o may later be used as part of the the final link of vmlinux but for now it is used fo section mismatch only.
For a defconfig build this is instant but for an allyesconfig this add two minutes to a full build (that anyways takes ~2 hours).

---
 Makefile                 |   22 +++++++++++++++++++---
 scripts/Makefile.modpost |    4 ++--
 scripts/mod/modpost.c    |    3 ++-
 3 files changed, 23 insertions(+), 6 deletions(-)
Makefile +19 -3
index ddbfcac..4f0bd65 100644
@@ -612,7 +612,7 @@ quiet_cmd_vmlinux__ ?= LD      $@
       cmd_vmlinux__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) -o $@ \
       -T $(vmlinux-lds) $(vmlinux-init)                          \
       --start-group $(vmlinux-main) --end-group                  \
-      $(filter-out $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) FORCE ,$^)
+      $(filter-out $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) vmlinux.o FORCE ,$^)
 
 # Generate new vmlinux version
 quiet_cmd_vmlinux_version = GEN     .version
@@ -736,15 +736,31 @@ debug_kallsyms: .tmp_map$(last_kallsyms)
 
 endif # ifdef CONFIG_KALLSYMS
 
+# Do modpost on a prelinked vmlinux. The finally linked vmlinux has
+# relevant sections renamed as per the linker script.
+quiet_cmd_vmlinux-modpost = LD      $@
+      cmd_vmlinux-modpost = $(LD) $(LDFLAGS) -r -o $@                          \
+	 $(vmlinux-init) --start-group $(vmlinux-main) --end-group             \
+	 $(filter-out $(vmlinux-init) $(vmlinux-main) $(vmlinux-lds) FORCE ,$^)
+define rule_vmlinux-modpost
+	:
+	+$(call cmd,vmlinux-modpost)
+	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost $@
+	$(Q)echo 'cmd_$@ := $(cmd_vmlinux-modpost)' > $(dot-target).cmd
+endef
+
 # vmlinux image - including updated kernel symbols
-vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCE
+vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) vmlinux.o FORCE
 ifdef CONFIG_HEADERS_CHECK
 	$(Q)$(MAKE) -f $(srctree)/Makefile headers_check
 endif
+	$(call vmlinux-modpost)
 	$(call if_changed_rule,vmlinux__)
-	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost $@
 	$(Q)rm -f .old_version
 
+vmlinux.o: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCE
+	$(call if_changed_rule,vmlinux-modpost)
+
 # The actual objects are generated when descending, 
 # make sure no implicit rule kicks in
 $(sort $(vmlinux-init) $(vmlinux-main)) $(vmlinux-lds): $(vmlinux-dirs) ;
scripts/Makefile.modpost +2 -2
index d5bbbcc..c6fcc59 100644
@@ -70,10 +70,10 @@ __modpost: $(modules:.ko=.o) FORCE
 	$(call cmd,modpost) $(wildcard vmlinux) $(filter-out FORCE,$^)
 
 quiet_cmd_kernel-mod = MODPOST $@
-      cmd_kernel-mod = $(cmd_modpost) $(KBUILD_VMLINUX_OBJS)
+      cmd_kernel-mod = $(cmd_modpost) $@
 
 PHONY += vmlinux
-vmlinux: FORCE
+vmlinux.o: FORCE
 	$(call cmd,kernel-mod)
 
 # Declare generated files as targets for modpost
scripts/mod/modpost.c +2 -1
index bb895b1..ec036c2 100644
@@ -75,7 +75,8 @@ static int is_vmlinux(const char *modname)
 	else
 		myname = modname;
 
-	return strcmp(myname, "vmlinux") == 0;
+	return (strcmp(myname, "vmlinux") == 0) ||
+	       (strcmp(myname, "vmlinux.o") == 0);
 }
 
 void *do_nofail(void *ptr, const char *expr)
Signature · 1 line
1.5.0.6
#23 lore raw

PATCH 23/33 modpost white list pattern adjustment

From: Jan Beulich <[email protected]>

gcc puts data into .data.rel or .data.rel.* on some architectures (e.g. ia64) or under certain conditions, so whatever is legal relative to .data should also be legal for those other sections. Fixes a few modpost warnings on ia64.

---
 scripts/mod/modpost.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
scripts/mod/modpost.c +4 -2
index ec036c2..3f3848f 100644
@@ -609,7 +609,7 @@ static int strrcmp(const char *s, const char *sub)
  *   warn here.
  *   the pattern is identified by:
  *   tosec   = .init.text | .exit.text | .init.data
- *   fromsec = .data
+ *   fromsec = .data | .data.rel | .data.rel.*
  *   atsym = *driver, *_template, *_sht, *_ops, *_probe, *probe_one, *_console, *_timer
  *
  * Pattern 3:
@@ -672,7 +672,9 @@ static int secref_whitelist(const char *modname, const char *tosec,
 	    (strcmp(tosec, ".exit.text") != 0) &&
 	    (strcmp(tosec, ".init.data") != 0))
 		f2 = 0;
-	if (strcmp(fromsec, ".data") != 0)
+	if ((strcmp(fromsec, ".data") != 0) &&
+	    (strcmp(fromsec, ".data.rel") != 0) &&
+	    (strncmp(fromsec, ".data.rel.", strlen(".data.rel.")) != 0))
 		f2 = 0;
 
 	for (s = pat2sym; *s; s++)
Signature · 1 line
1.5.0.6
#24 lore raw

PATCH 24/33 Whitelist references from __dbe_table to .init

From: Ralf Baechle <[email protected]>

This is needed on MIPS where the same mechanism as get_user() is used to intercept bus error exceptions for some hardware probes. Without this patch modpost will throw spurious warnings:

  LD      vmlinux
  SYSMAP  System.map
  SYSMAP  .tmp_System.map

MODPOST vmlinux
WARNING: arch/mips/sgi-ip22/built-in.o(__dbe_table+0x0): Section mismatch: reference to .init.text:

---
 scripts/mod/modpost.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
scripts/mod/modpost.c +1 -0
index 3f3848f..04579a5 100644
@@ -1141,6 +1141,7 @@ static int init_section_ref_ok(const char *name)
 	const char **s;
 	/* Absolute section names */
 	const char *namelist1[] = {
+		"__dbe_table",		/* MIPS generate these */
 		"__ftr_fixup",		/* powerpc cpu feature fixup */
 		"__fw_ftr_fixup",	/* powerpc firmware feature fixup */
 		"__param",
Signature · 1 line
1.5.0.6
#25 lore raw

PATCH 25/33 kbuild: use POSIX BRE in headers install target

From: Mike Frysinger <[email protected]>

The sed expression used at the moment in scripts/Makefile.headersinst relies on the (handy) GNU extension where you can escape ERE's in an otherwise BRE without using the GNU -r option. The following patch replaces this "\+" usage with a functionally equivalent POSIX BRE compliant "\{1,\}". Tested with make headers_install against blackfin/x86_64/i386 targets.

Stupid whiny OS X users and their crappy sed ;)

---
 scripts/Makefile.headersinst |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
scripts/Makefile.headersinst +7 -7
index f98d772..53dae3e 100644
@@ -11,13 +11,13 @@ UNIFDEF := scripts/unifdef -U__KERNEL__
 
 # Eliminate the contents of (and inclusions of) compiler.h
 HDRSED  := sed 	-e "s/ inline / __inline__ /g" \
-		-e "s/[[:space:]]__user[[:space:]]\+/ /g" \
-		-e "s/(__user[[:space:]]\+/ (/g" \
-		-e "s/[[:space:]]__force[[:space:]]\+/ /g" \
-		-e "s/(__force[[:space:]]\+/ (/g" \
-		-e "s/[[:space:]]__iomem[[:space:]]\+/ /g" \
-		-e "s/(__iomem[[:space:]]\+/ (/g" \
-		-e "s/[[:space:]]__attribute_const__[[:space:]]\+/\ /g" \
+		-e "s/[[:space:]]__user[[:space:]]\{1,\}/ /g" \
+		-e "s/(__user[[:space:]]\{1,\}/ (/g" \
+		-e "s/[[:space:]]__force[[:space:]]\{1,\}/ /g" \
+		-e "s/(__force[[:space:]]\{1,\}/ (/g" \
+		-e "s/[[:space:]]__iomem[[:space:]]\{1,\}/ /g" \
+		-e "s/(__iomem[[:space:]]\{1,\}/ (/g" \
+		-e "s/[[:space:]]__attribute_const__[[:space:]]\{1,\}/\ /g" \
 		-e "s/[[:space:]]__attribute_const__$$//" \
 		-e "/^\#include <linux\/compiler.h>/d"
 
Signature · 1 line
1.5.0.6
#26 lore raw

PATCH 26/33 kconfig: strip 'CONFIG_' automatically in kernel configuration search

From: Bernhard Walle <[email protected]>

Modify the ncurses configuration tool ('make menuconfig') in a way that the user can enter the search string (/) both with or without the leading 'CONFIG_'.

This simplifies using copy & paste from .config files because you can select the whole word.

---
 scripts/kconfig/mconf.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
scripts/kconfig/mconf.c +9 -2
index d0e4fa5..d2c2a42 100644
@@ -419,11 +419,13 @@ static void search_conf(void)
 {
 	struct symbol **sym_arr;
 	struct gstr res;
+	char *dialog_input;
 	int dres;
 again:
 	dialog_clear();
 	dres = dialog_inputbox(_("Search Configuration Parameter"),
-			      _("Enter CONFIG_ (sub)string to search for (omit CONFIG_)"),
+			      _("Enter CONFIG_ (sub)string to search for "
+				"(with or without \"CONFIG\")"),
 			      10, 75, "");
 	switch (dres) {
 	case 0:
@@ -435,7 +437,12 @@ again:
 		return;
 	}
 
-	sym_arr = sym_re_search(dialog_input_result);
+	/* strip CONFIG_ if necessary */
+	dialog_input = dialog_input_result;
+	if (strncasecmp(dialog_input_result, "CONFIG_", 7) == 0)
+		dialog_input += 7;
+
+	sym_arr = sym_re_search(dialog_input);
 	res = get_relations_str(sym_arr);
 	free(sym_arr);
 	show_textbox(_("Search Results"), str_get(&res), 0, 0);
Signature · 1 line
1.5.0.6

A message that is not in the archive (sent off-list or not yet received): [email protected]

#28 lore raw

PATCH 28/33 kconfig: reset generated values only if Kconfig and .config agree.

From: Roman Zippel <[email protected]>

Normally generated values (Kconfig entries without a prompt) are cleared as they are regenerated anyway and so they appear as new should they become visible and defaults work as expected (once a value is set defaults aren't used anymore).

The detection whether a value is generated or not is only based on its visibility status, which can quickly change for a lot of symbols by just removing a single line from .config or adding a dependency to Kconfig as you noticed.

The patch now suppresses this logic when .config and Kconfig aren't in sync and .config needs to be updated, so that you can remove now a random value from .config and oldconfig won't reask for many other values.

---
 scripts/kconfig/confdata.c |   37 ++++++++++++++++++++++++++-----------
 1 files changed, 26 insertions(+), 11 deletions(-)
scripts/kconfig/confdata.c +26 -11
index 664fe29..b2913e9 100644
@@ -341,27 +341,42 @@ int conf_read(const char *name)
 		conf_unsaved++;
 		/* maybe print value in verbose mode... */
 	sym_ok:
+		if (!sym_is_choice(sym))
+			continue;
+		/* The choice symbol only has a set value (and thus is not new)
+		 * if all its visible childs have values.
+		 */
+		prop = sym_get_choice_prop(sym);
+		flags = sym->flags;
+		for (e = prop->expr; e; e = e->left.expr)
+			if (e->right.sym->visible != no)
+				flags &= e->right.sym->flags;
+		sym->flags &= flags | ~SYMBOL_DEF_USER;
+	}
+
+	for_all_symbols(i, sym) {
 		if (sym_has_value(sym) && !sym_is_choice_value(sym)) {
-			if (sym->visible == no)
+			/* Reset values of generates values, so they'll appear
+			 * as new, if they should become visible, but that
+			 * doesn't quite work if the Kconfig and the saved
+			 * configuration disagree.
+			 */
+			if (sym->visible == no && !conf_unsaved)
 				sym->flags &= ~SYMBOL_DEF_USER;
 			switch (sym->type) {
 			case S_STRING:
 			case S_INT:
 			case S_HEX:
-				if (!sym_string_within_range(sym, sym->def[S_DEF_USER].val))
-					sym->flags &= ~(SYMBOL_VALID|SYMBOL_DEF_USER);
+				/* Reset a string value if it's out of range */
+				if (sym_string_within_range(sym, sym->def[S_DEF_USER].val))
+					break;
+				sym->flags &= ~(SYMBOL_VALID|SYMBOL_DEF_USER);
+				conf_unsaved++;
+				break;
 			default:
 				break;
 			}
 		}
-		if (!sym_is_choice(sym))
-			continue;
-		prop = sym_get_choice_prop(sym);
-		flags = sym->flags;
-		for (e = prop->expr; e; e = e->left.expr)
-			if (e->right.sym->visible != no)
-				flags &= e->right.sym->flags;
-		sym->flags &= flags | ~SYMBOL_DEF_USER;
 	}
 
 	sym_add_change_count(conf_warnings || conf_unsaved);
Signature · 1 line
1.5.0.6
#29 lore raw

PATCH 29/33 kbuild: use -fno-optimize-sibling-calls unconditionally

From: Adrian Bunk <[email protected]>

We don't have to check for -fno-optimize-sibling-calls since even gcc 3.2 supports it.

---
 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Makefile +1 -1
index b4de51d..7d25129 100644
@@ -492,7 +492,7 @@ endif
 include $(srctree)/arch/$(ARCH)/Makefile
 
 ifdef CONFIG_FRAME_POINTER
-CFLAGS		+= -fno-omit-frame-pointer $(call cc-option,-fno-optimize-sibling-calls,)
+CFLAGS		+= -fno-omit-frame-pointer -fno-optimize-sibling-calls
 else
 CFLAGS		+= -fomit-frame-pointer
 endif
Signature · 1 line
1.5.0.6
#30 lore raw

PATCH 30/33 kallsyms: remove usage of memmem and _GNU_SOURCE from scripts/kallsyms.c

From: Paulo Marques <[email protected]>

The only in-kernel user of "memmem" is scripts/kallsyms.c and it only uses it to find tokens that are 2 bytes in size. It is trivial to replace it with a simple function that finds 2-byte tokens.

This should help users from systems that don't have the memmem GNU extension available.

---
 scripts/kallsyms.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)
scripts/kallsyms.c +13 -4
index 8b809b2..caf4c86 100644
@@ -24,8 +24,6 @@
  *
  */
 
-#define _GNU_SOURCE
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -378,6 +376,17 @@ static void build_initial_tok_table(void)
 	table_cnt = pos;
 }
 
+static void *find_token(unsigned char *str, int len, unsigned char *token)
+{
+	int i;
+
+	for (i = 0; i < len - 1; i++) {
+		if (str[i] == token[0] && str[i+1] == token[1])
+			return &str[i];
+	}
+	return NULL;
+}
+
 /* replace a given token in all the valid symbols. Use the sampled symbols
  * to update the counts */
 static void compress_symbols(unsigned char *str, int idx)
@@ -391,7 +400,7 @@ static void compress_symbols(unsigned char *str, int idx)
 		p1 = table[i].sym;
 
 		/* find the token on the symbol */
-		p2 = memmem(p1, len, str, 2);
+		p2 = find_token(p1, len, str);
 		if (!p2) continue;
 
 		/* decrease the counts for this symbol's tokens */
@@ -410,7 +419,7 @@ static void compress_symbols(unsigned char *str, int idx)
 			if (size < 2) break;
 
 			/* find the token on the symbol */
-			p2 = memmem(p1, size, str, 2);
+			p2 = find_token(p1, size, str);
 
 		} while (p2);
 
Signature · 1 line
1.5.0.6
#31 lore raw

PATCH 31/33 cris: use DATA_DATA in cris

From: Mathieu Desnoyers <[email protected]>

Quoted 4 lines · * Sam Ravnborg ([email protected]) wrote:

From your patch it looks like I originally missed out powerpc + xtensa when introducing DATA_DATA - would be nice if you could fix that.

Use DATA_DATA in CRIS

---
 arch/cris/arch-v10/vmlinux.lds.S |    2 +-
 arch/cris/arch-v32/vmlinux.lds.S |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/cris/arch-v10/vmlinux.lds.S +1 -1
index 4b348b3..9859d49 100644
@@ -44,7 +44,7 @@ SECTIONS
 	___data_start = . ;
 	__Sdata = . ;
 	.data : {                     /* Data */
-		*(.data)
+		DATA_DATA
 	}
 	__edata = . ;                 /* End of data section */
 	_edata = . ;
arch/cris/arch-v32/vmlinux.lds.S +1 -1
index dfa25e1..e3a32ac 100644
@@ -49,7 +49,7 @@ SECTIONS
 	___data_start = . ;
 	__Sdata = . ;
 	.data : {                     /* Data */
-		*(.data)
+		DATA_DATA
 	}
 	__edata = . ;		/* End of data section. */
 	_edata = . ;
Signature · 1 line
1.5.0.6
#32 lore raw

PATCH 32/33 powerpc: add missing DATA_DATA to powerpc

From: Mathieu Desnoyers <[email protected]>

Quoted 5 lines · * Sam Ravnborg ([email protected]) wrote:

From your patch it looks like I originally missed out powerpc + xtensa when introducing DATA_DATA - would be nice if you could fix that.

Sam

Add missing DATA_DATA in powerpc

--

 arch/powerpc/kernel/vmlinux.lds.S |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
 arch/powerpc/kernel/vmlinux.lds.S |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
arch/powerpc/kernel/vmlinux.lds.S +3 -1
index 21c39ff..24ff7d9 100644
@@ -173,7 +173,9 @@ SECTIONS
 	}
 #else
 	.data : {
-		*(.data .data.rel* .toc1)
+		DATA_DATA
+		*(.data.rel*)
+		*(.toc1)
 		*(.branch_lt)
 	}
 
Signature · 1 line
1.5.0.6
#33 lore raw

PATCH 33/33 xtensa: use DATA_DATA in xtensa

From: Mathieu Desnoyers <[email protected]>

Quoted 5 lines · * Sam Ravnborg ([email protected]) wrote:

From your patch it looks like I originally missed out powerpc + xtensa when introducing DATA_DATA - would be nice if you could fix that.

Sam

Use DATA_DATA in xtensa

---
 arch/xtensa/kernel/vmlinux.lds.S |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
arch/xtensa/kernel/vmlinux.lds.S +2 -1
index b0582c3..bb3f1f3 100644
@@ -118,7 +118,8 @@ SECTIONS
   _fdata = .;
   .data :
   {
-    *(.data) CONSTRUCTORS
+    DATA_DATA
+    CONSTRUCTORS
     . = ALIGN(XCHAL_ICACHE_LINESIZE);
     *(.data.cacheline_aligned)
   }
Signature · 1 line
1.5.0.6
#34 lore raw

Re: [PATCH 25/33] kbuild: use POSIX BRE in headers install target

In reply to Sam Ravnborg

* Date: Tue, 17 Jul 2007 16:08:54 +0200

Quoted 8 lines

From: Mike Frysinger <[email protected]>

The sed expression used at the moment in scripts/Makefile.headersinst relies on the (handy) GNU extension where you can escape ERE's in an otherwise BRE without using the GNU -r option. The following patch replaces this "\+" usage with a functionally equivalent POSIX BRE compliant "\{1,\}".

Matching at least one occurrence, right?

Quoted 4 lines

Tested with make headers_install against blackfin/x86_64/i386 targets.

Stupid whiny OS X users and their crappy sed ;)

That may be. My games with strict POSIX sed syntax render busybox's sed as crap for example. So, you never know.

Quoted 1 line

# Eliminate the contents of (and inclusions of) compiler.h

OK, that means annotations and non ANSI 'inline' thing. Lets see.

Quoted 1 line

HDRSED := sed -e "s/ inline / __inline__ /g" \

[]

scripts/Makefile.headersinst UNIFDEF := scripts/unifdef -U__KERNEL__ · line 20

Quoted 1 line
scripts/Makefile.headersinst +0 -1
-		-e "s/[[:space:]]__attribute_const__[[:space:]]\+/\ /g" \

* [[:space:]] are more than tab and space isspace(3), is it more effective to use [[:blank:]] instead?

Quoted 2 lines
(quoted diff) +1 -0
+		-e 

"s/[[:space:]]__user[[:space:]]\{1,\}

substitute one or more ' __user '

Quoted 1 line

/ /g" \

with ' ', everywhere (flag 'g'). So, is it really needed that '\{' thing?

scripts/Makefile.headersinst UNIFDEF := scripts/unifdef -U__KERNEL__ · line 21

Quoted 7 lines
scripts/Makefile.headersinst +6 -0
+		-e "s/(__user[[:space:]]\{1,\}/ (/g" \
+		-e "s/[[:space:]]__force[[:space:]]\{1,\}/ /g" \
+		-e "s/(__force[[:space:]]\{1,\}/ (/g" \
+		-e "s/[[:space:]]__iomem[[:space:]]\{1,\}/ /g" \
+		-e "s/(__iomem[[:space:]]\{1,\}/ (/g" \
+		-e "s/[[:space:]]__attribute_const__[[:space:]]\{1,\}/\ /g" \
 		-e "s/[[:space:]]__attribute_const__$$//" \

Is it allowed to use identifiers like '__attribute_const__foo' or __attribute_const__[anything]? If it's not, last line is useless also.

Quoted 1 line

-e "/^\#include <linux\/compiler.h>/d"

whitespace is allowed ^ here and is used for better readability
sometimes.
____

#35 lore raw

Re: [PATCH 25/33] kbuild: use POSIX BRE in headers install target

Quoted 4 lines · Oleg Verych
Quoted 2 lines
(quoted diff) +1 -0
+		-e 

"s/[[:space:]]__user[[:space:]]\{1,\}

substitute one or more ' __user '

Substitute ' __user' followed by one or more ' '. \{\} applies only to the last RE atom.

Andreas.

Signature · 4 lines
Andreas Schwab, SuSE Labs, [email protected]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
#36 lore raw

Re: [PATCH 25/33] kbuild: use POSIX BRE in headers install target

Quoted 9 lines · Andreas Schwab
Quoted 4 lines · Oleg Verych
Quoted 2 lines
(quoted diff) +1 -0
+		-e 

"s/[[:space:]]__user[[:space:]]\{1,\}

substitute one or more ' __user '

Substitute ' __user' followed by one or more ' '. \{\} applies only to the last RE atom.

Uhm, would not it be easier to just use 's/\b__user\b//g' ?

Jan

#37 lore raw

Re: [PATCH 25/33] kbuild: use POSIX BRE in headers install target

Quoted 1 line · Jan Engelhardt

Uhm, would not it be easier to just use 's/\b__user\b//g' ?

\b is not POSIX.

Andreas.

Signature · 4 lines
Andreas Schwab, SuSE Labs, [email protected]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
#38 lore raw

Re: [PATCH 25/33] kbuild: use POSIX BRE in headers install target

In reply to Andreas Schwab
Quoted 9 lines · Andreas Schwab
Quoted 4 lines · Oleg Verych
Quoted 2 lines
(quoted diff) +1 -0
+		-e 

"s/[[:space:]]__user[[:space:]]\{1,\}

substitute one or more ' __user '

Substitute ' __user' followed by one or more ' '. \{\} applies only to the last RE atom.

Right, that's why i've used ' *' sometimes.

Thanks.

Quoted 2 lines

Andreas.

____

#39 lore raw

Re: [kbuild-devel] [PATCH 25/33] kbuild: use POSIX BRE in headers install target

In reply to Oleg Verych
Quoted 11 lines · Oleg Verych

* Date: Tue, 17 Jul 2007 16:08:54 +0200

Quoted 8 lines

From: Mike Frysinger <[email protected]>

The sed expression used at the moment in scripts/Makefile.headersinst relies on the (handy) GNU extension where you can escape ERE's in an otherwise BRE without using the GNU -r option. The following patch replaces this "\+" usage with a functionally equivalent POSIX BRE compliant "\{1,\}".

Matching at least one occurrence, right?

that is the definition of both + and \{1,\}

Quoted 10 lines
Quoted 1 line

# Eliminate the contents of (and inclusions of) compiler.h

OK, that means annotations and non ANSI 'inline' thing. Lets see.

Quoted 1 line

HDRSED := sed -e "s/ inline / __inline__ /g" \

[]

Quoted 1 line

- -e "s/[[:space:]]__attribute_const__[[:space:]]\+/\ /g" \

* [[:space:]] are more than tab and space isspace(3), is it more effective to use [[:blank:]] instead?

if you want to make some micro optimization in the build install step, sure ... but functionally, the difference is irrelevant considering sed operates only on individual lines

Quoted 8 lines
Quoted 2 lines

+ -e
"s/[[:space:]]__user[[:space:]]\{1,\}

substitute one or more ' __user '

Quoted 1 line

/ /g" \

with ' ', everywhere (flag 'g'). So, is it really needed that '\{' thing?

no, there is no grouping marker anywhere, so the match always applies to just the whitespace

Quoted 10 lines

scripts/Makefile.headersinst UNIFDEF := scripts/unifdef -U__KERNEL__ · line 21

Quoted 7 lines
scripts/Makefile.headersinst +6 -0
+             -e "s/(__user[[:space:]]\{1,\}/ (/g" \
+             -e "s/[[:space:]]__force[[:space:]]\{1,\}/ /g" \
+             -e "s/(__force[[:space:]]\{1,\}/ (/g" \
+             -e "s/[[:space:]]__iomem[[:space:]]\{1,\}/ /g" \
+             -e "s/(__iomem[[:space:]]\{1,\}/ (/g" \
+             -e "s/[[:space:]]__attribute_const__[[:space:]]\{1,\}/\ /g" \
              -e "s/[[:space:]]__attribute_const__$$//" \

Is it allowed to use identifiers like '__attribute_const__foo' or __attribute_const__[anything]? If it's not, last line is useless also.

a question that i think is really only relevant if it actually occurs in the source code

Quoted 3 lines
Quoted 1 line
              -e "/^\#include <linux\/compiler.h>/d"

whitespace is allowed ^ here and is used for better readability
sometimes.

so post a patch for inclusion ... not that it's been an actual problem [yet] though
-mike

#40 lore raw

Re: [kbuild-devel] [PATCH 25/33] kbuild: use POSIX BRE in headers install target

On Sat, Jul 21, 2007 at 04:27:31AM -0400, Mike Frysinger wrote:
[]

Quoted 3 lines

if you want to make some micro optimization in the build install step, sure ... but functionally, the difference is irrelevant considering sed operates only on individual lines

That was an attempt to support less sucking userspace in the kernel development. More readable, more memory/cpu effective, more portable.
____

#41 lore raw

Re: [kbuild-devel] [PATCH 25/33] kbuild: use POSIX BRE in headers install target

Quoted 8 lines · Oleg Verych

On Sat, Jul 21, 2007 at 04:27:31AM -0400, Mike Frysinger wrote:
[]

Quoted 3 lines

if you want to make some micro optimization in the build install step, sure ... but functionally, the difference is irrelevant considering sed operates only on individual lines

That was an attempt to support less sucking userspace in the kernel development. More readable, more memory/cpu effective, more portable.

while you could try and make a claim against memory/cpu effeciency, i fail to see how the first or last claims could possibly be backed up

but again, if you feel that strongly about it, you're certainly free to post a patch
-mike

#42 lore raw

Re: [kbuild-devel] [PATCH 25/33] kbuild: use POSIX BRE in headers install target

Quoted 7 lines · Mike Frysinger
Quoted 6 lines · Oleg Verych

On Sat, Jul 21, 2007 at 04:27:31AM -0400, Mike Frysinger wrote:
[]

Quoted 3 lines

if you want to make some micro optimization in the build install step, sure ... but functionally, the difference is irrelevant considering sed operates only on individual lines

Quoted 8 lines
Quoted 2 lines

That was an attempt to support less sucking userspace in the kernel development. More readable, more memory/cpu effective, more portable.

while you could try and make a claim against memory/cpu effeciency, i fail to see how the first or last claims could possibly be backed up

but again, if you feel that strongly about it, you're certainly free to post a patch

I would much more prefer this functionality to be integrated into unifdef. There is no good reason to have two different preprocesisng methonds, one being the sed based one and the other the unidef one.

A sinlge dedicated program that contian the sum of the functionality would be faster too.

Sam

#43 lore raw

More effective processing (Re: [PATCH 25/33] kbuild: use POSIX BRE in headers install target)

Quoted 1 line · Sam Ravnborg

On Sat, Jul 21, 2007 at 03:21:43PM -0400, Mike Frysinger wrote:

[]

Quoted 2 lines
Quoted 2 lines

while you could try and make a claim against memory/cpu effeciency, i fail to see how the first or last claims could possibly be backed up

Less \{\(\\n\t\+\)\} [0] stuff make readings regex much easier. My confusion shows that i didn't used \{ much, because have another ways so far. And even after my quick testing i didn't realize that there was unrelated to main task whitespace cleanup.

[0] http://sed.sf.net/grabbag/tutorials/lookup_tables.txt

Quoted 6 lines
Quoted 2 lines

but again, if you feel that strongly about it, you're certainly free to post a patch

I would much more prefer this functionality to be integrated into unifdef. There is no good reason to have two different preprocesisng methonds, one being the sed based one and the other the unidef one.

Clear definition of the task will help to design a solution. I can do the job, but figuring out all possible corner cases from current solutions, mixed in Makefiles or everywhere else is not option.

Quoted 2 lines

A sinlge dedicated program that contian the sum of the functionality would be faster too.

What do you think about this one? I want to propose to remove scripts/unifdef.c but to make clear policy about how to mark __KERNEL__ sections in header files. We know how obfuscated C can be, and this also applies to preprocessing. There's known CodingStyle about some points. The thing is to specify rules, that will be easy for sed to do cleaup job.

./linux/soundcard.h:#if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL)

                      && !defined(_KERNEL)) || defined(USE_SEQ_MACROS)

./linux/stat.h:#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)

Split __KERNEL__ check, make only positive, i.e.

#if defined(__KERNEL__)
#ifdef __KERNEL__

./linux/stat.h:#ifdef __KERNEL__

No #else and ending part to contain comment:

./linux/smb_fs_sb.h:#endif /* __KERNEL__ */

Simple enough:

sed '/^#if[^_]*__KERNEL__/,/^#end[^_]*__KERNEL__/d'
____

#44 lore raw

Re: More effective processing (Re: [PATCH 25/33] kbuild: use POSIX BRE in headers install target)

Quoted 19 lines · Oleg Verych

What do you think about this one? I want to propose to remove scripts/unifdef.c but to make clear policy about how to mark __KERNEL__ sections in header files. We know how obfuscated C can be, and this also applies to preprocessing. There's known CodingStyle about some points. The thing is to specify rules, that will be easy for sed to do cleaup job.

./linux/soundcard.h:#if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL)

                      && !defined(_KERNEL)) || defined(USE_SEQ_MACROS)

./linux/stat.h:#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)

Split __KERNEL__ check, make only positive, i.e.

#if defined(__KERNEL__)
#ifdef __KERNEL__

./linux/stat.h:#ifdef __KERNEL__

Quoted 7 lines

No #else and ending part to contain comment:

./linux/smb_fs_sb.h:#endif /* __KERNEL__ */

Simple enough:

sed '/^#if[^_]*__KERNEL__/,/^#end[^_]*__KERNEL__/d'

What are you trying to say with the above?
Sorry but I lost track of part of the discussion but you seems to havea point here?

Sam

#45 lore raw

Re: More effective processing (Re: [PATCH 25/33] kbuild: use POSIX BRE in headers install target)

Quoted 22 lines · Sam Ravnborg
Quoted 21 lines · Oleg Verych

What do you think about this one? I want to propose to remove scripts/unifdef.c but to make clear policy about how to mark __KERNEL__ sections in header files. We know how obfuscated C can be, and this also applies to preprocessing. There's known CodingStyle about some points. The thing is to specify rules, that will be easy for sed to do cleaup job.

./linux/soundcard.h:#if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL)

                      && !defined(_KERNEL)) || defined(USE_SEQ_MACROS)

./linux/stat.h:#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)

Split __KERNEL__ check, make only positive, i.e.

#if defined(__KERNEL__)
#ifdef __KERNEL__

./linux/stat.h:#ifdef __KERNEL__

No #else and ending part to contain comment:

Quoted 8 lines
Quoted 5 lines

./linux/smb_fs_sb.h:#endif /* __KERNEL__ */

Simple enough:

sed '/^#if[^_]*__KERNEL__/,/^#end[^_]*__KERNEL__/d'

What are you trying to say with the above?
Sorry but I lost track of part of the discussion but you seems to havea point here?

I want to suggest more easy and tools-friendly way of processing header files in the headrer_install target. One line above, one paragraph in CodingStyle, one tree revision from KJ group.
____

#46 lore raw

Re: More effective processing (Re: [PATCH 25/33] kbuild: use POSIX BRE in headers install target)

In reply to Oleg Verych
Quoted 10 lines · Oleg Verych
Quoted 1 line · Sam Ravnborg

On Sat, Jul 21, 2007 at 03:21:43PM -0400, Mike Frysinger wrote:

[]

Quoted 2 lines
Quoted 2 lines

while you could try and make a claim against memory/cpu effeciency, i fail to see how the first or last claims could possibly be backed up

Less \{\(\\n\t\+\)\} [0] stuff make readings regex much easier. My confusion shows that i didn't used \{ much, because have another ways so far. And even after my quick testing i didn't realize that there was unrelated to main task whitespace cleanup.

the e-mail text you were quoting was [[:blank:]] vs [[:space:]], not + vs \{1,\}

Quoted 1 line

./linux/stat.h:#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)

__GLIBC__ cruft should be cleansed rather than looked at for anything else -mike

#47 lore raw

Re: [kbuild-devel] [PATCH 25/33] kbuild: use POSIX BRE in headers install target

In reply to Sam Ravnborg
Quoted 17 lines · Sam Ravnborg
Quoted 7 lines · Mike Frysinger
Quoted 6 lines · Oleg Verych

On Sat, Jul 21, 2007 at 04:27:31AM -0400, Mike Frysinger wrote:
[]

Quoted 3 lines

if you want to make some micro optimization in the build install step, sure ... but functionally, the difference is irrelevant considering sed operates only on individual lines

Quoted 8 lines
Quoted 2 lines

That was an attempt to support less sucking userspace in the kernel development. More readable, more memory/cpu effective, more portable.

while you could try and make a claim against memory/cpu effeciency, i fail to see how the first or last claims could possibly be backed up

but again, if you feel that strongly about it, you're certainly free to post a patch

Quoted 6 lines

I would much more prefer this functionality to be integrated into unifdef. There is no good reason to have two different preprocesisng methonds, one being the sed based one and the other the unidef one.

A sinlge dedicated program that contian the sum of the functionality would be faster too.

which functionality ? normalizing of whitespace or all these linux-specific hacks ? unifdef serves one specific function which is stated in its manpage: remove preprocessor conditionals from code. -mike

#48 lore raw

Re: [kbuild-devel] [PATCH 25/33] kbuild: use POSIX BRE in headers install target

Quoted 22 lines · Mike Frysinger
Quoted 21 lines · Sam Ravnborg
Quoted 7 lines · Mike Frysinger
Quoted 6 lines · Oleg Verych

On Sat, Jul 21, 2007 at 04:27:31AM -0400, Mike Frysinger wrote:
[]

Quoted 3 lines

if you want to make some micro optimization in the build install step, sure ... but functionally, the difference is irrelevant considering sed operates only on individual lines

Quoted 8 lines
Quoted 2 lines

That was an attempt to support less sucking userspace in the kernel development. More readable, more memory/cpu effective, more portable.

while you could try and make a claim against memory/cpu effeciency, i fail to see how the first or last claims could possibly be backed up

but again, if you feel that strongly about it, you're certainly free to post a patch

I would much more prefer this functionality to be integrated into unifdef. There is no good reason to have two different preprocesisng methonds, one being the sed based one and the other the unidef one.

Quoted 6 lines
Quoted 2 lines

A sinlge dedicated program that contian the sum of the functionality would be faster too.

which functionality ? normalizing of whitespace or all these linux-specific hacks ? unifdef serves one specific function which is stated in its manpage: remove preprocessor conditionals from code.

At present the kernel has a private copy of unidef. So adjusting the private copy for the needs of the kernels seems like a god plan. We could even make it an extension so we do not break current functionality.

Sam

#49 lore raw

Re: [kbuild-devel] [PATCH 25/33] kbuild: use POSIX BRE in headers install target

Quoted 9 lines · Sam Ravnborg
Quoted 8 lines · Mike Frysinger
Quoted 6 lines · Sam Ravnborg

I would much more prefer this functionality to be integrated into unifdef. There is no good reason to have two different preprocesisng methonds, one being the sed based one and the other the unidef one.

A sinlge dedicated program that contian the sum of the functionality would be faster too.

Quoted 6 lines
Quoted 3 lines

which functionality ? normalizing of whitespace or all these linux-specific hacks ? unifdef serves one specific function which is stated in its manpage: remove preprocessor conditionals from code.

At present the kernel has a private copy of unidef. So adjusting the private copy for the needs of the kernels seems like a god plan.

didnt realize the kernel had integrated it since it didnt at first ... so yeah, extending it however we see fit should be fine -mike

#50 lore raw

Re: [kbuild-devel] [PATCH 25/33] kbuild: use POSIX BRE in headers install target

Quoted 14 lines · Mike Frysinger
Quoted 13 lines · Sam Ravnborg
Quoted 11 lines · Mike Frysinger
Quoted 6 lines · Sam Ravnborg

I would much more prefer this functionality to be integrated into unifdef. There is no good reason to have two different preprocesisng methonds, one being the sed based one and the other the unidef one.

A sinlge dedicated program that contian the sum of the functionality would be faster too.

which functionality ? normalizing of whitespace or all these linux-specific hacks ? unifdef serves one specific function which is stated in its manpage: remove preprocessor conditionals from code.

Quoted 6 lines
Quoted 2 lines

At present the kernel has a private copy of unidef. So adjusting the private copy for the needs of the kernels seems like a god plan.

didnt realize the kernel had integrated it since it didnt at first ... so yeah, extending it however we see fit should be fine -mike

just for the entertainment value:

https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=217840

rday

Signature · 7 lines
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

http://fsdev.net/wiki/index.php?title=Main_Page
========================================================================
#51 lore raw

Re: [PATCH 03/33] powerpc: Refuse to build 64-bit with GCC-4.2.0 and CONFIG_MODULES

In reply to Sam Ravnborg
Quoted 3 lines · Sam Ravnborg

From: Segher Boessenkool <[email protected]>

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

The bug report says IA64 is broken, too. Please verify and extend the patch if possible...

gcc-4.2.1 will be released soon.

Regards,

Signature · 10 lines
Clemens Koller
__________________________________
R&D Imaging Devices
Anagramm GmbH
Rupert-Mayer-Straße 45/1
Linhof Werksgelände
D-81379 München
Tel.089-741518-50
Fax 089-741518-19
http://www.anagramm-technology.com
#52 lore raw

Re: [PATCH 03/33] powerpc: Refuse to build 64-bit with GCC-4.2.0 and CONFIG_MODULES

Quoted 5 lines
Quoted 2 lines

From: Segher Boessenkool <[email protected]>
...since this won't work (compiler bug, see <http://gcc.gnu.org/PR31490>).

The bug report says IA64 is broken, too. Please verify and extend the patch if possible...

The GCC bug exists on all architectures. Linux build is only affected on PowerPC, and only when modules are enabled, as far as I know. I have no way to build IA64 kernels right now, someone else will have to check and create a similar patch if necessary.

Quoted 1 line

gcc-4.2.1 will be released soon.

For some value of "soon". Likely this bug will be fixed in 4.2.1, and if not, I'll just update the range check in here.

Segher