2007-05-18 06:40:38

by Sam Ravnborg

[permalink] [raw]
Subject: kbuild fixes for -rc1 (touches all arch .lds files)

I have following set of fixes queued for -rc1.
I no major comments are raised I will request for
inclusion tomorrow.


This patchset include the discussed infrastructure to silence
section mismatch warnings in the legitimite cases.
Included are also a few section mismatch fixes so my x86_64
and i386 defconfig builds are with no section mismatchs warnings.
modpost saw various improvements too.

Mike Frysinger have improved gen_initramfs.list and made the
source in scripts/ a tad more portable.

The most important bugfix is the MODALIAS fix for powerpc.


Patches will follow.

Sam


Git repository:
git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild.git


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

Li Yang (1):
kbuild: add "Section mismatch" warning whitelist for powerpc

Mike Frysinger (4):
kbuild: add support for reading stdin with gen_init_cpio
kbuild: add support for squashing uid/gid in gen_initramfs_list.sh
kbuild: include limits.h in sumversion.c for PATH_MAX
kconfig: search harder for curses library in check-lxdialog.sh

Russell King (1):
kbuild: make modpost section warnings clearer

Sam Ravnborg (6):
all-archs: consolidate .text section definition in asm-generic
all-archs: consolidate .data section definition in asm-generic
kbuild: introduce __init_refok/__initdata_refok to supress section mismatch warnings
init/main: use __init_refok to fix section mismatch
mm: fix section mismatch warnings
mm/slab: fix section mismatch warning

Sylvain Munaut (1):
powerpc: Fix the MODALIAS generation in modpost for of devices

arch/alpha/kernel/vmlinux.lds.S | 4 +-
arch/arm/kernel/vmlinux.lds.S | 4 +-
arch/arm26/kernel/vmlinux-arm26-xip.lds.in | 4 +-
arch/arm26/kernel/vmlinux-arm26.lds.in | 4 +-
arch/avr32/kernel/vmlinux.lds.c | 4 +-
arch/blackfin/kernel/vmlinux.lds.S | 4 +-
arch/frv/kernel/vmlinux.lds.S | 6 +-
arch/h8300/kernel/vmlinux.lds.S | 4 +-
arch/i386/kernel/vmlinux.lds.S | 4 +-
arch/ia64/kernel/vmlinux.lds.S | 9 +-
arch/m32r/kernel/vmlinux.lds.S | 4 +-
arch/m68k/kernel/vmlinux-std.lds | 4 +-
arch/m68k/kernel/vmlinux-sun3.lds | 4 +-
arch/m68knommu/kernel/vmlinux.lds.S | 4 +-
arch/mips/kernel/vmlinux.lds.S | 4 +-
arch/parisc/kernel/vmlinux.lds.S | 4 +-
arch/powerpc/kernel/vmlinux.lds.S | 5 +-
arch/ppc/kernel/vmlinux.lds.S | 4 +-
arch/s390/kernel/vmlinux.lds.S | 4 +-
arch/sh/kernel/vmlinux.lds.S | 4 +-
arch/sh64/kernel/vmlinux.lds.S | 4 +-
arch/sparc/kernel/vmlinux.lds.S | 4 +-
arch/sparc64/kernel/vmlinux.lds.S | 4 +-
arch/um/kernel/dyn.lds.S | 5 +-
arch/um/kernel/uml.lds.S | 4 +-
arch/v850/kernel/vmlinux.lds.S | 4 +-
arch/x86_64/kernel/vmlinux.lds.S | 4 +-
arch/xtensa/kernel/vmlinux.lds.S | 6 +-
include/asm-generic/vmlinux.lds.h | 12 ++
include/linux/init.h | 13 ++
init/main.c | 2 +-
mm/page_alloc.c | 4 +-
mm/slab.c | 2 +-
mm/sparse.c | 2 +-
scripts/gen_initramfs_list.sh | 12 +-
scripts/kconfig/lxdialog/check-lxdialog.sh | 24 ++---
scripts/mod/file2alias.c | 11 ++-
scripts/mod/modpost.c | 169 +++++++++++++++++++---------
scripts/mod/modpost.h | 3 +
scripts/mod/sumversion.c | 1 +
usr/gen_init_cpio.c | 4 +-
41 files changed, 243 insertions(+), 139 deletions(-)


2007-05-18 06:48:32

by Sam Ravnborg

[permalink] [raw]
Subject: [PATCH 01/14] kbuild: make modpost section warnings clearer

>From 4dba30ccfdb911b0810f6527de66b1515349d8c4 Mon Sep 17 00:00:00 2001
From: Russell King <[email protected]>
Date: Thu, 10 May 2007 23:03:25 +0100
Subject: [PATCH 01/14] kbuild: make modpost section warnings clearer

Change modpost section mismatch warnings to be less confusing;
model them on the binutils linker warnings which we all know how
to interpret.

Also, fix the wrong ordering of arguments for the final case -
fromsec and refsymname were reversed.

Signed-off-by: Russell King <[email protected]>
Signed-off-by: Sam Ravnborg <[email protected]>
---
scripts/mod/modpost.c | 33 ++++++++++++++++-----------------
1 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 113dc77..acd28ab 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -885,29 +885,28 @@ static void warn_sec_mismatch(const char *modname, const char *fromsec,
return;

if (before && after) {
- warn("%s - Section mismatch: reference to %s:%s from %s "
- "between '%s' (at offset 0x%llx) and '%s'\n",
- modname, secname, refsymname, fromsec,
+ warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s "
+ "(between '%s' and '%s')\n",
+ modname, fromsec, (long long)r.r_offset,
+ secname, refsymname,
elf->strtab + before->st_name,
- (long long)r.r_offset,
elf->strtab + after->st_name);
} else if (before) {
- warn("%s - Section mismatch: reference to %s:%s from %s "
- "after '%s' (at offset 0x%llx)\n",
- modname, secname, refsymname, fromsec,
- elf->strtab + before->st_name,
- (long long)r.r_offset);
+ warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s "
+ "(after '%s')\n",
+ modname, fromsec, (long long)r.r_offset,
+ secname, refsymname,
+ elf->strtab + before->st_name);
} else if (after) {
- warn("%s - Section mismatch: reference to %s:%s from %s "
+ warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s "
"before '%s' (at offset -0x%llx)\n",
- modname, secname, refsymname, fromsec,
- elf->strtab + after->st_name,
- (long long)r.r_offset);
+ modname, fromsec, (long long)r.r_offset,
+ secname, refsymname,
+ elf->strtab + after->st_name);
} else {
- warn("%s - Section mismatch: reference to %s:%s from %s "
- "(offset 0x%llx)\n",
- modname, secname, fromsec, refsymname,
- (long long)r.r_offset);
+ warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s\n",
+ modname, fromsec, (long long)r.r_offset,
+ secname, refsymname);
}
}

--
1.5.1.rc3.20.gaa453

2007-05-18 06:49:35

by Sam Ravnborg

[permalink] [raw]
Subject: [PATCH 02/14] kbuild: make better section mismatch reports on i386, arm and mips

>From 41fa40aeb2314458b25dd2227dc71fdecb504e5e Mon Sep 17 00:00:00 2001
From: Atsushi Nemoto <[email protected]>
Date: Thu, 17 May 2007 01:14:38 +0900
Subject: [PATCH 02/14] kbuild: make better section mismatch reports on i386, arm and mips

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.

Without this patch:
MODPOST vmlinux
WARNING: init/built-in.o - Section mismatch: reference to .init.text: from .text between 'rest_init' (at offset 0xf4) and 'try_name'
WARNING: mm/built-in.o - Section mismatch: reference to .init.text: from .text between 'kmem_cache_create' (at offset 0x18a39) and 'cache_reap'
WARNING: mm/built-in.o - Section mismatch: reference to .init.text: from .text between 'kmem_cache_create' (at offset 0x18a6b) and 'cache_reap'

With this patch:
MODPOST vmlinux
WARNING: mm/built-in.o - Section mismatch: reference to .init.text:set_up_list3s from .text between 'kmem_cache_create' (at offset 0x18a39) and 'cache_reap'
WARNING: mm/built-in.o - Section mismatch: reference to .init.text:set_up_list3s from .text between 'kmem_cache_create' (at offset 0x18a6b) and 'cache_reap'

Now modpost can detect "kernel_init" name (and whitelist it) and show
"set_up_list3s" name.

Signed-off-by: Atsushi Nemoto <[email protected]>
Signed-off-by: Sam Ravnborg <[email protected]>
---
scripts/mod/modpost.c | 79 +++++++++++++++++++++++++++++++++++++++++++++++++
scripts/mod/modpost.h | 3 ++
2 files changed, 82 insertions(+), 0 deletions(-)

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index acd28ab..ecb0a15 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -384,6 +384,7 @@ 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);
}
/* Find symbol table. */
for (i = 1; i < hdr->e_shnum; i++) {
@@ -773,6 +774,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;
}
@@ -910,6 +913,68 @@ static void warn_sec_mismatch(const char *modname, const char *fromsec,
}
}

+static void addend_386_rel(struct elf_info *elf, int section, Elf_Rela *r)
+{
+ Elf_Shdr *sechdrs = elf->sechdrs;
+ unsigned int r_typ;
+ unsigned int *location;
+
+ r_typ = ELF_R_TYPE(r->r_info);
+ location = (void *)elf->hdr +
+ sechdrs[sechdrs[section].sh_info].sh_offset + r->r_offset;
+ 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;
+ break;
+ }
+}
+
+static void addend_arm_rel(struct elf_info *elf, int section, Elf_Rela *r)
+{
+ Elf_Shdr *sechdrs = elf->sechdrs;
+ unsigned int r_typ;
+ unsigned int *location;
+
+ r_typ = ELF_R_TYPE(r->r_info);
+ location = (void *)elf->hdr +
+ sechdrs[sechdrs[section].sh_info].sh_offset + r->r_offset;
+ switch (r_typ) {
+ case R_ARM_ABS32:
+ r->r_addend = TO_NATIVE(*location);
+ break;
+ case R_ARM_PC24:
+ r->r_addend = ((TO_NATIVE(*location) & 0x00ffffff) << 2) + 8;
+ break;
+ }
+}
+
+static int addend_mips_rel(struct elf_info *elf, int section, Elf_Rela *r)
+{
+ Elf_Shdr *sechdrs = elf->sechdrs;
+ unsigned int r_typ;
+ unsigned int *location;
+ unsigned int inst;
+
+ r_typ = ELF_R_TYPE(r->r_info);
+ if (r_typ == R_MIPS_HI16)
+ return 1; /* skip this */
+ location = (void *)elf->hdr +
+ sechdrs[sechdrs[section].sh_info].sh_offset + r->r_offset;
+ inst = TO_NATIVE(*location);
+ switch (r_typ) {
+ case R_MIPS_LO16:
+ r->r_addend = ((inst & 0xffff) ^ 0x8000) - 0x8000;
+ break;
+ case R_MIPS_26:
+ r->r_addend = (inst & 0x03ffffff) << 2;
+ break;
+ }
+ return 0;
+}
+
/**
* A module includes a number of sections that are discarded
* either when loaded or when used as built-in.
@@ -953,8 +1018,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);
@@ -987,8 +1055,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);
@@ -998,6 +1069,14 @@ static void check_sec_ref(struct module *mod, const char *modname,
r_sym = ELF_R_SYM(r.r_info);
#endif
r.r_addend = 0;
+ if (hdr->e_machine == EM_386)
+ addend_386_rel(elf, i, &r);
+ else if (hdr->e_machine == EM_ARM)
+ addend_arm_rel(elf, i, &r);
+ else if (hdr->e_machine == EM_MIPS) {
+ if (addend_mips_rel(elf, i, &r))
+ continue;
+ }
sym = elf->symtab_start + r_sym;
/* Skip special sections */
if (sym->st_shndx >= SHN_LORESERVE)
diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h
index 0858caa..4156dd3 100644
--- a/scripts/mod/modpost.h
+++ b/scripts/mod/modpost.h
@@ -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)
--
1.5.1.rc3.20.gaa453

2007-05-18 06:50:28

by Sam Ravnborg

[permalink] [raw]
Subject: [PATCH 03/14] kbuild: add "Section mismatch" warning whitelist for powerpc

>From bdfeed222963cadd30cbfcad799c89f3a7b94e02 Mon Sep 17 00:00:00 2001
From: Li Yang <[email protected]>
Date: Mon, 14 May 2007 18:04:28 +0800
Subject: [PATCH 03/14] kbuild: add "Section mismatch" warning whitelist for powerpc

This patch fixes the following class of "Section mismatch" warnings when
building powerpc platforms.

WARNING: arch/powerpc/kernel/built-in.o - Section mismatch: reference to .init.data:.got2 from prom_entry (offset 0x0)
WARNING: arch/powerpc/platforms/built-in.o - Section mismatch: reference to .init.text:mpc8313_rdb_probe from .machine.desc after 'mach_mpc8313_rdb' (at offset 0x4)
....

Signed-off-by: Li Yang <[email protected]>
Signed-off-by: Sam Ravnborg <[email protected]>
---
scripts/mod/modpost.c | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index ecb0a15..b394629 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -650,9 +650,10 @@ static int strrcmp(const char *s, const char *sub)
* tosec = .init.text
*
* Pattern 10:
- * ia64 has machvec table for each platform. It is mixture of function
- * pointer of .init.text and .text.
- * fromsec = .machvec
+ * 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,
@@ -751,7 +752,8 @@ static int secref_whitelist(const char *modname, const char *tosec,
return 1;

/* Check for pattern 10 */
- if (strcmp(fromsec, ".machvec") == 0)
+ if ((strcmp(fromsec, ".machvec") == 0) ||
+ (strcmp(fromsec, ".machine.desc") == 0))
return 1;

return 0;
@@ -887,6 +889,11 @@ 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 */
+ if (strcmp(fromsec, ".got2") == 0)
+ return;
+
if (before && after) {
warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s "
"(between '%s' and '%s')\n",
--
1.5.1.rc3.20.gaa453

2007-05-18 06:50:57

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 01/14] kbuild: make modpost section warnings clearer

From: Sam Ravnborg <[email protected]>
Date: Fri, 18 May 2007 08:49:18 +0200

> >From 4dba30ccfdb911b0810f6527de66b1515349d8c4 Mon Sep 17 00:00:00 2001
> From: Russell King <[email protected]>
> Date: Thu, 10 May 2007 23:03:25 +0100
> Subject: [PATCH 01/14] kbuild: make modpost section warnings clearer
>
> Change modpost section mismatch warnings to be less confusing;
> model them on the binutils linker warnings which we all know how
> to interpret.
>
> Also, fix the wrong ordering of arguments for the final case -
> fromsec and refsymname were reversed.
>
> Signed-off-by: Russell King <[email protected]>
> Signed-off-by: Sam Ravnborg <[email protected]>

Acked-by: David S. Miller <[email protected]>

2007-05-18 06:51:25

by Sam Ravnborg

[permalink] [raw]
Subject: [PATCH 04/14] all-archs: consolidate .text section definition in asm-generic

>From abe82ff8e73db114634b38ef1cd24e121643a2e9 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <[email protected]>
Date: Sun, 13 May 2007 00:31:33 +0200
Subject: [PATCH 04/14] all-archs: consolidate .text section definition in asm-generic

Move definition of .text section to asm-generic.

Signed-off-by: Sam Ravnborg <[email protected]>
---
arch/alpha/kernel/vmlinux.lds.S | 2 +-
arch/arm/kernel/vmlinux.lds.S | 2 +-
arch/arm26/kernel/vmlinux-arm26-xip.lds.in | 2 +-
arch/arm26/kernel/vmlinux-arm26.lds.in | 2 +-
arch/avr32/kernel/vmlinux.lds.c | 2 +-
arch/blackfin/kernel/vmlinux.lds.S | 2 +-
arch/frv/kernel/vmlinux.lds.S | 3 ++-
arch/h8300/kernel/vmlinux.lds.S | 2 +-
arch/i386/kernel/vmlinux.lds.S | 2 +-
arch/ia64/kernel/vmlinux.lds.S | 2 +-
arch/m32r/kernel/vmlinux.lds.S | 2 +-
arch/m68k/kernel/vmlinux-std.lds | 2 +-
arch/m68k/kernel/vmlinux-sun3.lds | 2 +-
arch/m68knommu/kernel/vmlinux.lds.S | 2 +-
arch/mips/kernel/vmlinux.lds.S | 2 +-
arch/parisc/kernel/vmlinux.lds.S | 2 +-
arch/powerpc/kernel/vmlinux.lds.S | 3 ++-
arch/ppc/kernel/vmlinux.lds.S | 2 +-
arch/s390/kernel/vmlinux.lds.S | 2 +-
arch/sh/kernel/vmlinux.lds.S | 2 +-
arch/sh64/kernel/vmlinux.lds.S | 2 +-
arch/sparc/kernel/vmlinux.lds.S | 2 +-
arch/sparc64/kernel/vmlinux.lds.S | 2 +-
arch/um/kernel/dyn.lds.S | 2 +-
arch/um/kernel/uml.lds.S | 2 +-
arch/v850/kernel/vmlinux.lds.S | 2 +-
arch/x86_64/kernel/vmlinux.lds.S | 2 +-
arch/xtensa/kernel/vmlinux.lds.S | 3 ++-
include/asm-generic/vmlinux.lds.h | 6 ++++++
29 files changed, 37 insertions(+), 28 deletions(-)

diff --git a/arch/alpha/kernel/vmlinux.lds.S b/arch/alpha/kernel/vmlinux.lds.S
index cf1e6fc..ab60e81 100644
--- a/arch/alpha/kernel/vmlinux.lds.S
+++ b/arch/alpha/kernel/vmlinux.lds.S
@@ -15,7 +15,7 @@ SECTIONS

_text = .; /* Text and read-only data */
.text : {
- *(.text)
+ TEXT_TEXT
SCHED_TEXT
LOCK_TEXT
*(.fixup)
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index e4156e7..8d4e248 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -90,7 +90,7 @@ SECTIONS
__exception_text_start = .;
*(.exception.text)
__exception_text_end = .;
- *(.text)
+ TEXT_TEXT
SCHED_TEXT
LOCK_TEXT
#ifdef CONFIG_MMU
diff --git a/arch/arm26/kernel/vmlinux-arm26-xip.lds.in b/arch/arm26/kernel/vmlinux-arm26-xip.lds.in
index 046a850..89c806a 100644
--- a/arch/arm26/kernel/vmlinux-arm26-xip.lds.in
+++ b/arch/arm26/kernel/vmlinux-arm26-xip.lds.in
@@ -64,7 +64,7 @@ SECTIONS

.text : { /* Real text segment */
_text = .; /* Text and read-only data */
- *(.text)
+ TEXT_TEXT
SCHED_TEXT
LOCK_TEXT /* FIXME - borrowed from arm32 - check*/
*(.fixup)
diff --git a/arch/arm26/kernel/vmlinux-arm26.lds.in b/arch/arm26/kernel/vmlinux-arm26.lds.in
index 1d2949e..e3f9b18 100644
--- a/arch/arm26/kernel/vmlinux-arm26.lds.in
+++ b/arch/arm26/kernel/vmlinux-arm26.lds.in
@@ -65,7 +65,7 @@ SECTIONS

.text : { /* Real text segment */
_text = .; /* Text and read-only data */
- *(.text)
+ TEXT_TEXT
SCHED_TEXT
LOCK_TEXT
*(.fixup)
diff --git a/arch/avr32/kernel/vmlinux.lds.c b/arch/avr32/kernel/vmlinux.lds.c
index e7f72c9..dbba391 100644
--- a/arch/avr32/kernel/vmlinux.lds.c
+++ b/arch/avr32/kernel/vmlinux.lds.c
@@ -76,7 +76,7 @@ SECTIONS
. = 0x100;
*(.scall.text)
*(.irq.text)
- *(.text)
+ TEXT_TEXT
SCHED_TEXT
LOCK_TEXT
KPROBES_TEXT
diff --git a/arch/blackfin/kernel/vmlinux.lds.S b/arch/blackfin/kernel/vmlinux.lds.S
index 6ae9ebb..36fcc77 100644
--- a/arch/blackfin/kernel/vmlinux.lds.S
+++ b/arch/blackfin/kernel/vmlinux.lds.S
@@ -54,7 +54,7 @@ SECTIONS
{
_text = .;
__stext = .;
- *(.text)
+ TEXT_TEXT
SCHED_TEXT
*(.text.lock)
. = ALIGN(16);
diff --git a/arch/frv/kernel/vmlinux.lds.S b/arch/frv/kernel/vmlinux.lds.S
index 28eae97..7e0998f 100644
--- a/arch/frv/kernel/vmlinux.lds.S
+++ b/arch/frv/kernel/vmlinux.lds.S
@@ -101,13 +101,14 @@ SECTIONS
_stext = .;
.text : {
*(
- .text.start .text .text.*
+ .text.start .text.*
#ifdef CONFIG_DEBUG_INFO
.init.text
.exit.text
.exitcall.exit
#endif
)
+ TEXT_TEXT
SCHED_TEXT
LOCK_TEXT
*(.fixup)
diff --git a/arch/h8300/kernel/vmlinux.lds.S b/arch/h8300/kernel/vmlinux.lds.S
index 65f1cdc..4365162 100644
--- a/arch/h8300/kernel/vmlinux.lds.S
+++ b/arch/h8300/kernel/vmlinux.lds.S
@@ -75,7 +75,7 @@ SECTIONS
*(.int_redirect)
#endif
__stext = . ;
- *(.text)
+ TEXT_TEXT
SCHED_TEXT
LOCK_TEXT
__etext = . ;
diff --git a/arch/i386/kernel/vmlinux.lds.S b/arch/i386/kernel/vmlinux.lds.S
index 80bec66..dfc439a 100644
--- a/arch/i386/kernel/vmlinux.lds.S
+++ b/arch/i386/kernel/vmlinux.lds.S
@@ -44,7 +44,7 @@ SECTIONS

/* read-only */
.text : AT(ADDR(.text) - LOAD_OFFSET) {
- *(.text)
+ TEXT_TEXT
SCHED_TEXT
LOCK_TEXT
KPROBES_TEXT
diff --git a/arch/ia64/kernel/vmlinux.lds.S b/arch/ia64/kernel/vmlinux.lds.S
index 6923826..19108d0 100644
--- a/arch/ia64/kernel/vmlinux.lds.S
+++ b/arch/ia64/kernel/vmlinux.lds.S
@@ -44,7 +44,7 @@ SECTIONS
.text : AT(ADDR(.text) - LOAD_OFFSET)
{
IVT_TEXT
- *(.text)
+ TEXT_TEXT
SCHED_TEXT
LOCK_TEXT
KPROBES_TEXT
diff --git a/arch/m32r/kernel/vmlinux.lds.S b/arch/m32r/kernel/vmlinux.lds.S
index 6c73bca..bb1a2f5 100644
--- a/arch/m32r/kernel/vmlinux.lds.S
+++ b/arch/m32r/kernel/vmlinux.lds.S
@@ -27,7 +27,7 @@ SECTIONS
_text = .; /* Text and read-only data */
.boot : { *(.boot) } = 0
.text : {
- *(.text)
+ TEXT_TEXT
SCHED_TEXT
LOCK_TEXT
*(.fixup)
diff --git a/arch/m68k/kernel/vmlinux-std.lds b/arch/m68k/kernel/vmlinux-std.lds
index 437b4f8..a65cef8 100644
--- a/arch/m68k/kernel/vmlinux-std.lds
+++ b/arch/m68k/kernel/vmlinux-std.lds
@@ -11,7 +11,7 @@ SECTIONS
. = 0x1000;
_text = .; /* Text and read-only data */
.text : {
- *(.text)
+ TEXT_TEXT
SCHED_TEXT
LOCK_TEXT
*(.fixup)
diff --git a/arch/m68k/kernel/vmlinux-sun3.lds b/arch/m68k/kernel/vmlinux-sun3.lds
index 2868e20..fa44d6c 100644
--- a/arch/m68k/kernel/vmlinux-sun3.lds
+++ b/arch/m68k/kernel/vmlinux-sun3.lds
@@ -12,7 +12,7 @@ SECTIONS
_text = .; /* Text and read-only data */
.text : {
*(.head)
- *(.text)
+ TEXT_TEXT
SCHED_TEXT
LOCK_TEXT
*(.fixup)
diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
index c86a1bf..6d4585e 100644
--- a/arch/m68knommu/kernel/vmlinux.lds.S
+++ b/arch/m68knommu/kernel/vmlinux.lds.S
@@ -62,7 +62,7 @@ SECTIONS {
.text : {
_text = .;
_stext = . ;
- *(.text)
+ TEXT_TEXT
SCHED_TEXT
*(.text.lock)

diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
index 043f637..cfe4b67 100644
--- a/arch/mips/kernel/vmlinux.lds.S
+++ b/arch/mips/kernel/vmlinux.lds.S
@@ -27,7 +27,7 @@ SECTIONS
/* read-only */
_text = .; /* Text and read-only data */
.text : {
- *(.text)
+ TEXT_TEXT
SCHED_TEXT
LOCK_TEXT
*(.fixup)
diff --git a/arch/parisc/kernel/vmlinux.lds.S b/arch/parisc/kernel/vmlinux.lds.S
index c745859..321de82 100644
--- a/arch/parisc/kernel/vmlinux.lds.S
+++ b/arch/parisc/kernel/vmlinux.lds.S
@@ -51,7 +51,7 @@ SECTIONS

_text = .; /* Text and read-only data */
.text ALIGN(16) : {
- *(.text)
+ TEXT_TEXT
SCHED_TEXT
LOCK_TEXT
*(.text.do_softirq)
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index 1320673..f266209 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -34,7 +34,8 @@ SECTIONS
/* Text and gots */
.text : {
_text = .;
- *(.text .text.*)
+ *(.text.*)
+ TEXT_TEXT
SCHED_TEXT
LOCK_TEXT
KPROBES_TEXT
diff --git a/arch/ppc/kernel/vmlinux.lds.S b/arch/ppc/kernel/vmlinux.lds.S
index 44cd128..419ef7e 100644
--- a/arch/ppc/kernel/vmlinux.lds.S
+++ b/arch/ppc/kernel/vmlinux.lds.S
@@ -32,7 +32,7 @@ SECTIONS
.text :
{
_text = .;
- *(.text)
+ TEXT_TEXT
SCHED_TEXT
LOCK_TEXT
*(.fixup)
diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S
index e9d3432..89c2ec5 100644
--- a/arch/s390/kernel/vmlinux.lds.S
+++ b/arch/s390/kernel/vmlinux.lds.S
@@ -21,7 +21,7 @@ SECTIONS
. = 0x00000000;
_text = .; /* Text and read-only data */
.text : {
- *(.text)
+ TEXT_TEXT
SCHED_TEXT
LOCK_TEXT
KPROBES_TEXT
diff --git a/arch/sh/kernel/vmlinux.lds.S b/arch/sh/kernel/vmlinux.lds.S
index d83143c..2367869 100644
--- a/arch/sh/kernel/vmlinux.lds.S
+++ b/arch/sh/kernel/vmlinux.lds.S
@@ -22,7 +22,7 @@ SECTIONS
*(.empty_zero_page)
} = 0
.text : {
- *(.text)
+ TEXT_TEXT
SCHED_TEXT
LOCK_TEXT
*(.fixup)
diff --git a/arch/sh64/kernel/vmlinux.lds.S b/arch/sh64/kernel/vmlinux.lds.S
index 4f9616f..fdf72ce 100644
--- a/arch/sh64/kernel/vmlinux.lds.S
+++ b/arch/sh64/kernel/vmlinux.lds.S
@@ -54,7 +54,7 @@ SECTIONS
} = 0

.text : C_PHYS(.text) {
- *(.text)
+ TEXT_TEXT
*(.text64)
*(.text..SHmedia32)
SCHED_TEXT
diff --git a/arch/sparc/kernel/vmlinux.lds.S b/arch/sparc/kernel/vmlinux.lds.S
index f0bb6e6..5cb600e 100644
--- a/arch/sparc/kernel/vmlinux.lds.S
+++ b/arch/sparc/kernel/vmlinux.lds.S
@@ -12,7 +12,7 @@ SECTIONS
.text 0xf0004000 :
{
_text = .;
- *(.text)
+ TEXT_TEXT
SCHED_TEXT
LOCK_TEXT
*(.gnu.warning)
diff --git a/arch/sparc64/kernel/vmlinux.lds.S b/arch/sparc64/kernel/vmlinux.lds.S
index 13fa2a2..f06da20 100644
--- a/arch/sparc64/kernel/vmlinux.lds.S
+++ b/arch/sparc64/kernel/vmlinux.lds.S
@@ -14,7 +14,7 @@ SECTIONS
.text 0x0000000000404000 :
{
_text = .;
- *(.text)
+ TEXT_TEXT
SCHED_TEXT
LOCK_TEXT
KPROBES_TEXT
diff --git a/arch/um/kernel/dyn.lds.S b/arch/um/kernel/dyn.lds.S
index 87a4e44..ec8477d 100644
--- a/arch/um/kernel/dyn.lds.S
+++ b/arch/um/kernel/dyn.lds.S
@@ -62,7 +62,7 @@ SECTIONS
} =0x90909090
.plt : { *(.plt) }
.text : {
- *(.text)
+ TEXT_TEXT
SCHED_TEXT
LOCK_TEXT
*(.fixup)
diff --git a/arch/um/kernel/uml.lds.S b/arch/um/kernel/uml.lds.S
index bc59f97..8435105 100644
--- a/arch/um/kernel/uml.lds.S
+++ b/arch/um/kernel/uml.lds.S
@@ -37,7 +37,7 @@ SECTIONS

.text :
{
- *(.text)
+ TEXT_TEXT
SCHED_TEXT
LOCK_TEXT
*(.fixup)
diff --git a/arch/v850/kernel/vmlinux.lds.S b/arch/v850/kernel/vmlinux.lds.S
index 3563082..9e2b4bc 100644
--- a/arch/v850/kernel/vmlinux.lds.S
+++ b/arch/v850/kernel/vmlinux.lds.S
@@ -92,7 +92,7 @@
#define TEXT_CONTENTS \
_text = .; \
__stext = . ; \
- *(.text) \
+ TEXT_TEXT \
SCHED_TEXT \
*(.exit.text) /* 2.5 convention */ \
*(.text.exit) /* 2.4 convention */ \
diff --git a/arch/x86_64/kernel/vmlinux.lds.S b/arch/x86_64/kernel/vmlinux.lds.S
index 88cfa50..c77142d 100644
--- a/arch/x86_64/kernel/vmlinux.lds.S
+++ b/arch/x86_64/kernel/vmlinux.lds.S
@@ -31,7 +31,7 @@ SECTIONS
*(.bootstrap.text)
_stext = .;
/* Then the rest */
- *(.text)
+ TEXT_TEXT
SCHED_TEXT
LOCK_TEXT
KPROBES_TEXT
diff --git a/arch/xtensa/kernel/vmlinux.lds.S b/arch/xtensa/kernel/vmlinux.lds.S
index 4fbd66a..7d2dfb2 100644
--- a/arch/xtensa/kernel/vmlinux.lds.S
+++ b/arch/xtensa/kernel/vmlinux.lds.S
@@ -84,7 +84,8 @@ SECTIONS
{
/* The .head.text section must be the first section! */
*(.head.text)
- *(.literal .text)
+ *(.literal)
+ TEXT_TEXT
*(.srom.text)
VMLINUX_SYMBOL(__sched_text_start) = .;
*(.sched.literal .sched.text)
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index f3806a7..a464227 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -139,6 +139,12 @@
VMLINUX_SYMBOL(__security_initcall_end) = .; \
}

+/* .text section. Map to function alignment to avoid address changes
+ * during second ld run in second ld pass when generating System.map */
+#define TEXT_TEXT \
+ ALIGN_FUNCTION(); \
+ *(.text)
+
/* sched.text is aling to function alignment to secure we have same
* address even at second ld pass when generating System.map */
#define SCHED_TEXT \
--
1.5.1.rc3.20.gaa453

2007-05-18 06:52:18

by Sam Ravnborg

[permalink] [raw]
Subject: [PATCH 05/14] all-archs: consolidate .data section definition in asm-generic

>From 653bc43c6c2c292e6abc98860fd241eb12e2c80f Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <[email protected]>
Date: Thu, 17 May 2007 13:38:44 +0200
Subject: [PATCH 05/14] all-archs: consolidate .data section definition in asm-generic

With this consolidation we can now modify the .data
section definition in one spot for all archs.

Signed-off-by: Sam Ravnborg <[email protected]>
---
arch/alpha/kernel/vmlinux.lds.S | 2 +-
arch/arm/kernel/vmlinux.lds.S | 2 +-
arch/arm26/kernel/vmlinux-arm26-xip.lds.in | 2 +-
arch/arm26/kernel/vmlinux-arm26.lds.in | 2 +-
arch/avr32/kernel/vmlinux.lds.c | 2 +-
arch/blackfin/kernel/vmlinux.lds.S | 2 +-
arch/frv/kernel/vmlinux.lds.S | 3 ++-
arch/h8300/kernel/vmlinux.lds.S | 2 +-
arch/i386/kernel/vmlinux.lds.S | 2 +-
arch/ia64/kernel/vmlinux.lds.S | 7 ++++++-
arch/m32r/kernel/vmlinux.lds.S | 2 +-
arch/m68k/kernel/vmlinux-std.lds | 2 +-
arch/m68k/kernel/vmlinux-sun3.lds | 2 +-
arch/m68knommu/kernel/vmlinux.lds.S | 2 +-
arch/mips/kernel/vmlinux.lds.S | 2 +-
arch/parisc/kernel/vmlinux.lds.S | 2 +-
arch/powerpc/kernel/vmlinux.lds.S | 2 +-
arch/ppc/kernel/vmlinux.lds.S | 2 +-
arch/s390/kernel/vmlinux.lds.S | 2 +-
arch/sh/kernel/vmlinux.lds.S | 2 +-
arch/sh64/kernel/vmlinux.lds.S | 2 +-
arch/sparc/kernel/vmlinux.lds.S | 2 +-
arch/sparc64/kernel/vmlinux.lds.S | 2 +-
arch/um/kernel/dyn.lds.S | 3 ++-
arch/um/kernel/uml.lds.S | 2 +-
arch/v850/kernel/vmlinux.lds.S | 2 +-
arch/x86_64/kernel/vmlinux.lds.S | 2 +-
arch/xtensa/kernel/vmlinux.lds.S | 3 ++-
include/asm-generic/vmlinux.lds.h | 4 ++++
29 files changed, 40 insertions(+), 28 deletions(-)

diff --git a/arch/alpha/kernel/vmlinux.lds.S b/arch/alpha/kernel/vmlinux.lds.S
index ab60e81..449e76f 100644
--- a/arch/alpha/kernel/vmlinux.lds.S
+++ b/arch/alpha/kernel/vmlinux.lds.S
@@ -89,7 +89,7 @@ SECTIONS

_data = .;
.data : { /* Data */
- *(.data)
+ DATA_DATA
CONSTRUCTORS
}

diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index 8d4e248..2b7a8f5 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -158,7 +158,7 @@ SECTIONS
/*
* and the usual data section
*/
- *(.data)
+ DATA_DATA
CONSTRUCTORS

_edata = .;
diff --git a/arch/arm26/kernel/vmlinux-arm26-xip.lds.in b/arch/arm26/kernel/vmlinux-arm26-xip.lds.in
index 89c806a..4ec715c 100644
--- a/arch/arm26/kernel/vmlinux-arm26-xip.lds.in
+++ b/arch/arm26/kernel/vmlinux-arm26-xip.lds.in
@@ -111,7 +111,7 @@ SECTIONS
/*
* and the usual data section
*/
- *(.data)
+ DATA_DATA
CONSTRUCTORS

*(.init.data)
diff --git a/arch/arm26/kernel/vmlinux-arm26.lds.in b/arch/arm26/kernel/vmlinux-arm26.lds.in
index e3f9b18..6c44f6a 100644
--- a/arch/arm26/kernel/vmlinux-arm26.lds.in
+++ b/arch/arm26/kernel/vmlinux-arm26.lds.in
@@ -106,7 +106,7 @@ SECTIONS
/*
* and the usual data section
*/
- *(.data)
+ DATA_DATA
CONSTRUCTORS

_edata = .;
diff --git a/arch/avr32/kernel/vmlinux.lds.c b/arch/avr32/kernel/vmlinux.lds.c
index dbba391..db0438f 100644
--- a/arch/avr32/kernel/vmlinux.lds.c
+++ b/arch/avr32/kernel/vmlinux.lds.c
@@ -112,7 +112,7 @@ SECTIONS

/* And the rest... */
*(.data.rel*)
- *(.data)
+ DATA_DATA
CONSTRUCTORS

_edata = .;
diff --git a/arch/blackfin/kernel/vmlinux.lds.S b/arch/blackfin/kernel/vmlinux.lds.S
index 36fcc77..86fe679 100644
--- a/arch/blackfin/kernel/vmlinux.lds.S
+++ b/arch/blackfin/kernel/vmlinux.lds.S
@@ -200,7 +200,7 @@ SECTIONS
__sdata = .;
. = ALIGN(0x2000);
*(.data.init_task)
- *(.data)
+ DATA_DATA

. = ALIGN(32);
*(.data.cacheline_aligned)
diff --git a/arch/frv/kernel/vmlinux.lds.S b/arch/frv/kernel/vmlinux.lds.S
index 7e0998f..481dc13 100644
--- a/arch/frv/kernel/vmlinux.lds.S
+++ b/arch/frv/kernel/vmlinux.lds.S
@@ -136,7 +136,8 @@ SECTIONS

_sdata = .;
.data : { /* Data */
- *(.data .data.*)
+ DATA_DATA
+ *(.data.*)
*(.exit.data)
CONSTRUCTORS
}
diff --git a/arch/h8300/kernel/vmlinux.lds.S b/arch/h8300/kernel/vmlinux.lds.S
index 4365162..a2e72d4 100644
--- a/arch/h8300/kernel/vmlinux.lds.S
+++ b/arch/h8300/kernel/vmlinux.lds.S
@@ -103,7 +103,7 @@ SECTIONS
. = ALIGN(0x2000) ;
*(.data.init_task)
. = ALIGN(0x4) ;
- *(.data)
+ DATA_DATA
. = ALIGN(0x4) ;
*(.data.*)

diff --git a/arch/i386/kernel/vmlinux.lds.S b/arch/i386/kernel/vmlinux.lds.S
index dfc439a..aa87b06 100644
--- a/arch/i386/kernel/vmlinux.lds.S
+++ b/arch/i386/kernel/vmlinux.lds.S
@@ -74,7 +74,7 @@ SECTIONS
/* writeable */
. = ALIGN(4096);
.data : AT(ADDR(.data) - LOAD_OFFSET) { /* Data */
- *(.data)
+ DATA_DATA
CONSTRUCTORS
} :data

diff --git a/arch/ia64/kernel/vmlinux.lds.S b/arch/ia64/kernel/vmlinux.lds.S
index 19108d0..5a65965 100644
--- a/arch/ia64/kernel/vmlinux.lds.S
+++ b/arch/ia64/kernel/vmlinux.lds.S
@@ -214,7 +214,12 @@ SECTIONS

data : { } :data
.data : AT(ADDR(.data) - LOAD_OFFSET)
- { *(.data) *(.data1) *(.gnu.linkonce.d*) CONSTRUCTORS }
+ {
+ DATA_DATA
+ *(.data1)
+ *(.gnu.linkonce.d*)
+ CONSTRUCTORS
+ }

. = ALIGN(16); /* gp must be 16-byte aligned for exc. table */
.got : AT(ADDR(.got) - LOAD_OFFSET)
diff --git a/arch/m32r/kernel/vmlinux.lds.S b/arch/m32r/kernel/vmlinux.lds.S
index bb1a2f5..4e2d5b9 100644
--- a/arch/m32r/kernel/vmlinux.lds.S
+++ b/arch/m32r/kernel/vmlinux.lds.S
@@ -50,7 +50,7 @@ SECTIONS
.data : { /* Data */
*(.spu)
*(.spi)
- *(.data)
+ DATA_DATA
CONSTRUCTORS
}

diff --git a/arch/m68k/kernel/vmlinux-std.lds b/arch/m68k/kernel/vmlinux-std.lds
index a65cef8..78f1392 100644
--- a/arch/m68k/kernel/vmlinux-std.lds
+++ b/arch/m68k/kernel/vmlinux-std.lds
@@ -28,7 +28,7 @@ SECTIONS
_etext = .; /* End of text section */

.data : { /* Data */
- *(.data)
+ DATA_DATA
CONSTRUCTORS
}

diff --git a/arch/m68k/kernel/vmlinux-sun3.lds b/arch/m68k/kernel/vmlinux-sun3.lds
index fa44d6c..c8999b2 100644
--- a/arch/m68k/kernel/vmlinux-sun3.lds
+++ b/arch/m68k/kernel/vmlinux-sun3.lds
@@ -23,7 +23,7 @@ SECTIONS
_etext = .; /* End of text section */

.data : { /* Data */
- *(.data)
+ DATA_DATA
CONSTRUCTORS
. = ALIGN(16); /* Exception table */
__start___ex_table = .;
diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
index 6d4585e..07a0055 100644
--- a/arch/m68knommu/kernel/vmlinux.lds.S
+++ b/arch/m68knommu/kernel/vmlinux.lds.S
@@ -133,7 +133,7 @@ SECTIONS {
.data DATA_ADDR : {
. = ALIGN(4);
_sdata = . ;
- *(.data)
+ DATA_DATA
. = ALIGN(8192) ;
*(.data.init_task)
_edata = . ;
diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
index cfe4b67..9b9992c 100644
--- a/arch/mips/kernel/vmlinux.lds.S
+++ b/arch/mips/kernel/vmlinux.lds.S
@@ -62,7 +62,7 @@ SECTIONS
. = ALIGN(_PAGE_SIZE);
*(.data.init_task)

- *(.data)
+ DATA_DATA

CONSTRUCTORS
}
diff --git a/arch/parisc/kernel/vmlinux.lds.S b/arch/parisc/kernel/vmlinux.lds.S
index 321de82..4d96ba4 100644
--- a/arch/parisc/kernel/vmlinux.lds.S
+++ b/arch/parisc/kernel/vmlinux.lds.S
@@ -91,7 +91,7 @@ SECTIONS

. = ALIGN(L1_CACHE_BYTES);
.data : { /* Data */
- *(.data)
+ DATA_DATA
CONSTRUCTORS
}

diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index f266209..f7d7bf1 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -168,7 +168,7 @@ SECTIONS
#ifdef CONFIG_PPC32
.data :
{
- *(.data)
+ DATA_DATA
*(.sdata)
*(.got.plt) *(.got)
}
diff --git a/arch/ppc/kernel/vmlinux.lds.S b/arch/ppc/kernel/vmlinux.lds.S
index 419ef7e..19db874 100644
--- a/arch/ppc/kernel/vmlinux.lds.S
+++ b/arch/ppc/kernel/vmlinux.lds.S
@@ -67,7 +67,7 @@ SECTIONS
. = ALIGN(4096);
.data :
{
- *(.data)
+ DATA_DATA
*(.data1)
*(.sdata)
*(.sdata2)
diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S
index 89c2ec5..7158a80 100644
--- a/arch/s390/kernel/vmlinux.lds.S
+++ b/arch/s390/kernel/vmlinux.lds.S
@@ -48,7 +48,7 @@ SECTIONS
BUG_TABLE

.data : { /* Data */
- *(.data)
+ DATA_DATA
CONSTRUCTORS
}

diff --git a/arch/sh/kernel/vmlinux.lds.S b/arch/sh/kernel/vmlinux.lds.S
index 2367869..4c5b57e 100644
--- a/arch/sh/kernel/vmlinux.lds.S
+++ b/arch/sh/kernel/vmlinux.lds.S
@@ -41,7 +41,7 @@ SECTIONS
BUG_TABLE

.data : { /* Data */
- *(.data)
+ DATA_DATA

/* Align the initial ramdisk image (INITRD) on page boundaries. */
. = ALIGN(PAGE_SIZE);
diff --git a/arch/sh64/kernel/vmlinux.lds.S b/arch/sh64/kernel/vmlinux.lds.S
index fdf72ce..02aea86 100644
--- a/arch/sh64/kernel/vmlinux.lds.S
+++ b/arch/sh64/kernel/vmlinux.lds.S
@@ -78,7 +78,7 @@ SECTIONS
_etext = .; /* End of text section */

.data : C_PHYS(.data) { /* Data */
- *(.data)
+ DATA_DATA
CONSTRUCTORS
}

diff --git a/arch/sparc/kernel/vmlinux.lds.S b/arch/sparc/kernel/vmlinux.lds.S
index 5cb600e..f75a1b8 100644
--- a/arch/sparc/kernel/vmlinux.lds.S
+++ b/arch/sparc/kernel/vmlinux.lds.S
@@ -22,7 +22,7 @@ SECTIONS
RODATA
.data :
{
- *(.data)
+ DATA_DATA
CONSTRUCTORS
}
.data1 : { *(.data1) }
diff --git a/arch/sparc64/kernel/vmlinux.lds.S b/arch/sparc64/kernel/vmlinux.lds.S
index f06da20..fb648de 100644
--- a/arch/sparc64/kernel/vmlinux.lds.S
+++ b/arch/sparc64/kernel/vmlinux.lds.S
@@ -27,7 +27,7 @@ SECTIONS

.data :
{
- *(.data)
+ DATA_DATA
CONSTRUCTORS
}
.data1 : { *(.data1) }
diff --git a/arch/um/kernel/dyn.lds.S b/arch/um/kernel/dyn.lds.S
index ec8477d..2454774 100644
--- a/arch/um/kernel/dyn.lds.S
+++ b/arch/um/kernel/dyn.lds.S
@@ -99,7 +99,8 @@ SECTIONS
*(.data.init_task)
. = ALIGN(KERNEL_STACK_SIZE);
*(.data.init_irqstack)
- *(.data .data.* .gnu.linkonce.d.*)
+ DATA_DATA
+ *(.data.* .gnu.linkonce.d.*)
SORT(CONSTRUCTORS)
}
.data1 : { *(.data1) }
diff --git a/arch/um/kernel/uml.lds.S b/arch/um/kernel/uml.lds.S
index 8435105..307b937 100644
--- a/arch/um/kernel/uml.lds.S
+++ b/arch/um/kernel/uml.lds.S
@@ -61,7 +61,7 @@ SECTIONS
*(.data.init_task)
. = ALIGN(KERNEL_STACK_SIZE);
*(.data.init_irqstack)
- *(.data)
+ DATA_DATA
*(.gnu.linkonce.d*)
CONSTRUCTORS
}
diff --git a/arch/v850/kernel/vmlinux.lds.S b/arch/v850/kernel/vmlinux.lds.S
index 9e2b4bc..6172599 100644
--- a/arch/v850/kernel/vmlinux.lds.S
+++ b/arch/v850/kernel/vmlinux.lds.S
@@ -113,7 +113,7 @@
/* Kernel data segment. */
#define DATA_CONTENTS \
__sdata = . ; \
- *(.data) \
+ DATA_DATA \
*(.exit.data) /* 2.5 convention */ \
*(.data.exit) /* 2.4 convention */ \
. = ALIGN (16) ; \
diff --git a/arch/x86_64/kernel/vmlinux.lds.S b/arch/x86_64/kernel/vmlinux.lds.S
index c77142d..dbccfda 100644
--- a/arch/x86_64/kernel/vmlinux.lds.S
+++ b/arch/x86_64/kernel/vmlinux.lds.S
@@ -55,7 +55,7 @@ SECTIONS
. = ALIGN(PAGE_SIZE); /* Align data segment to page size boundary */
/* Data */
.data : AT(ADDR(.data) - LOAD_OFFSET) {
- *(.data)
+ DATA_DATA
CONSTRUCTORS
} :data

diff --git a/arch/xtensa/kernel/vmlinux.lds.S b/arch/xtensa/kernel/vmlinux.lds.S
index 7d2dfb2..4b7b4ff 100644
--- a/arch/xtensa/kernel/vmlinux.lds.S
+++ b/arch/xtensa/kernel/vmlinux.lds.S
@@ -145,7 +145,8 @@ SECTIONS
_fdata = .;
.data :
{
- *(.data) CONSTRUCTORS
+ DATA_DATA
+ CONSTRUCTORS
. = ALIGN(XCHAL_ICACHE_LINESIZE);
*(.data.cacheline_aligned)
}
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index a464227..52e2d69 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -9,6 +9,10 @@
/* Align . to a 8 byte boundary equals to maximum function alignment. */
#define ALIGN_FUNCTION() . = ALIGN(8)

+/* .data section */
+#define DATA_DATA \
+ *(.data)
+
#define RODATA \
. = ALIGN(4096); \
.rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
--
1.5.1.rc3.20.gaa453

2007-05-18 06:53:10

by Sam Ravnborg

[permalink] [raw]
Subject: [PATCH 06/14] kbuild: introduce __init_refok/__initdata_refok to supress section mismatch warnings

>From 9ea9840b8258e81ea88548bc22b2cb2871e2b1c4 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <[email protected]>
Date: Thu, 17 May 2007 20:14:48 +0200
Subject: [PATCH 06/14] kbuild: introduce __init_refok/__initdata_refok to supress section mismatch warnings

Throughout the kernel there are a few legitimite references
to init or exit sections. Most of these are covered by the
patterns included in modpost but a few nees special attention.
To avoid hardcoding a lot of function names in modpost introduce
a marker so relevant function/data can be marked.
When modpost see a reference to a init/exit function from
a function/data marked no warning will be issued.

Idea from: Andrew Morton <[email protected]>

Signed-off-by: Sam Ravnborg <[email protected]>
Cc: Andrew Morton <[email protected]>
---
include/asm-generic/vmlinux.lds.h | 6 ++++--
include/linux/init.h | 13 +++++++++++++
scripts/mod/modpost.c | 11 +++++++++++
3 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 52e2d69..8307b1b 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -11,7 +11,8 @@

/* .data section */
#define DATA_DATA \
- *(.data)
+ *(.data) \
+ *(.data.init.refok)

#define RODATA \
. = ALIGN(4096); \
@@ -147,7 +148,8 @@
* during second ld run in second ld pass when generating System.map */
#define TEXT_TEXT \
ALIGN_FUNCTION(); \
- *(.text)
+ *(.text) \
+ *(.text.init.refok)

/* sched.text is aling to function alignment to secure we have same
* address even at second ld pass when generating System.map */
diff --git a/include/linux/init.h b/include/linux/init.h
index e007ae4..c39f3d3 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -45,6 +45,19 @@
#define __exitdata __attribute__ ((__section__(".exit.data")))
#define __exit_call __attribute_used__ __attribute__ ((__section__ (".exitcall.exit")))

+/* modpost check for section mismatches during the kernel build.
+ * A section mismatch happens when there are references from a
+ * code or data section to an init section (both code or data).
+ * The init sections are (for most archs) discarded by the kernel
+ * when early init has completed so all such references are potential bugs.
+ * For exit sections the same issue exists.
+ * The follwoing markers are used for the cases where the reference to
+ * the init/exit section (code or data) is valid and will teach modpost
+ * not to issue a warning.
+ * The markers follow same syntax rules as __init / __initdata. */
+#define __init_refok noinline __attribute__ ((__section__ (".text.init.refok")))
+#define __initdata_refok __attribute__ ((__section__ (".data.init.refok")))
+
#ifdef MODULE
#define __exit __attribute__ ((__section__(".exit.text")))
#else
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index b394629..f4d9edf 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -583,6 +583,12 @@ static int strrcmp(const char *s, const char *sub)

/**
* Whitelist to allow certain references to pass with no warning.
+ *
+ * Pattern 0:
+ * Do not warn if funtion/data are marked with __init_refok/__initdata_refok.
+ * The pattern is identified by:
+ * fromsec = .text.init.refok | .data.init.refok
+ *
* Pattern 1:
* If a module parameter is declared __initdata and permissions=0
* then this is legal despite the warning generated.
@@ -686,6 +692,11 @@ static int secref_whitelist(const char *modname, const char *tosec,
NULL
};

+ /* Check for pattern 0 */
+ if ((strcmp(fromsec, ".text.init.refok") == 0) ||
+ (strcmp(fromsec, ".data.init.refok") == 0))
+ return 1;
+
/* Check for pattern 1 */
if (strcmp(tosec, ".init.data") != 0)
f1 = 0;
--
1.5.1.rc3.20.gaa453

2007-05-18 06:53:39

by Sam Ravnborg

[permalink] [raw]
Subject: [PATCH 07/14] init/main: use __init_refok to fix section mismatch

>From 2f92cdcf9de22b1a18885919b323793f89a6ff94 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <[email protected]>
Date: Thu, 17 May 2007 20:43:54 +0200
Subject: [PATCH 07/14] init/main: use __init_refok to fix section mismatch

Kill a special case in modpost by introducing the
__init_refok marker.

Signed-off-by: Sam Ravnborg <[email protected]>
---
init/main.c | 2 +-
scripts/mod/modpost.c | 14 --------------
2 files changed, 1 insertions(+), 15 deletions(-)

diff --git a/init/main.c b/init/main.c
index 1940fa7..eb8bdba 100644
--- a/init/main.c
+++ b/init/main.c
@@ -423,7 +423,7 @@ static void __init setup_command_line(char *command_line)
* gcc-3.4 accidentally inlines this function, so use noinline.
*/

-static void noinline rest_init(void)
+static void noinline __init_refok rest_init(void)
__releases(kernel_lock)
{
int pid;
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index f4d9edf..ec056cf 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -626,14 +626,6 @@ static int strrcmp(const char *s, const char *sub)
* This pattern is identified by
* refsymname = __init_begin, _sinittext, _einittext
*
- * Pattern 6:
- * During the early init phase we have references from .init.text to
- * .text we have an intended section mismatch - do not warn about it.
- * See kernel_init() in init/main.c
- * tosec = .init.text
- * fromsec = .text
- * atsym = kernel_init
- *
* Pattern 7:
* Logos used in drivers/video/logo reside in __initdata but the
* funtion that references them are EXPORT_SYMBOL() so cannot be
@@ -738,12 +730,6 @@ static int secref_whitelist(const char *modname, const char *tosec,
if (strcmp(refsymname, *s) == 0)
return 1;

- /* Check for pattern 6 */
- if ((strcmp(tosec, ".init.text") == 0) &&
- (strcmp(fromsec, ".text") == 0) &&
- (strcmp(refsymname, "kernel_init") == 0))
- return 1;
-
/* Check for pattern 7 */
if ((strcmp(tosec, ".init.data") == 0) &&
(strncmp(fromsec, ".text", strlen(".text")) == 0) &&
--
1.5.1.rc3.20.gaa453

2007-05-18 06:54:20

by Sam Ravnborg

[permalink] [raw]
Subject: [PATCH 08/14] mm: fix section mismatch warnings

>From 90deffab03386508abfa1529fe4926a2fc7300f2 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <[email protected]>
Date: Thu, 17 May 2007 23:29:25 +0200
Subject: [PATCH 08/14] mm: fix section mismatch warnings

modpost had two cases hardcoded for mm/
Shift over to __init_refok and kill the
hardcoded function names in modpost.

This has the drawback that the functions
will always be kept no matter configuration.
With previous code the function were placed in
init section if configuration allowed it.

Signed-off-by: Sam Ravnborg <[email protected]>
---
mm/page_alloc.c | 4 ++--
mm/sparse.c | 2 +-
scripts/mod/modpost.c | 19 -------------------
3 files changed, 3 insertions(+), 22 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index ae96dd8..8b000d6 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2165,7 +2165,7 @@ void __init setup_per_cpu_pageset(void)

#endif

-static __meminit noinline
+static noinline __init_refok
int zone_wait_table_init(struct zone *zone, unsigned long zone_size_pages)
{
int i;
@@ -2678,7 +2678,7 @@ static void __meminit free_area_init_core(struct pglist_data *pgdat,
}
}

-static void __meminit alloc_node_mem_map(struct pglist_data *pgdat)
+static void __init_refok alloc_node_mem_map(struct pglist_data *pgdat)
{
/* Skip empty nodes */
if (!pgdat->node_spanned_pages)
diff --git a/mm/sparse.c b/mm/sparse.c
index 6f3fff9..1302f83 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -44,7 +44,7 @@ EXPORT_SYMBOL(page_to_nid);
#endif

#ifdef CONFIG_SPARSEMEM_EXTREME
-static struct mem_section noinline *sparse_index_alloc(int nid)
+static struct mem_section noinline __init_refok *sparse_index_alloc(int nid)
{
struct mem_section *section = NULL;
unsigned long array_size = SECTIONS_PER_ROOT *
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index ec056cf..4fc0ab8 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -641,12 +641,6 @@ static int strrcmp(const char *s, const char *sub)
* tosec = .init.text
* fromsec = .paravirtprobe
*
- * Pattern 9:
- * Some of functions are common code between boot time and hotplug
- * time. The bootmem allocater is called only boot time in its
- * functions. So it's ok to reference.
- * tosec = .init.text
- *
* Pattern 10:
* ia64 has machvec table for each platform and
* powerpc has a machine desc table for each platform.
@@ -678,12 +672,6 @@ static int secref_whitelist(const char *modname, const char *tosec,
NULL
};

- const char *pat4sym[] = {
- "sparse_index_alloc",
- "zone_wait_table_init",
- NULL
- };
-
/* Check for pattern 0 */
if ((strcmp(fromsec, ".text.init.refok") == 0) ||
(strcmp(fromsec, ".data.init.refok") == 0))
@@ -741,13 +729,6 @@ static int secref_whitelist(const char *modname, const char *tosec,
(strcmp(fromsec, ".paravirtprobe") == 0))
return 1;

- /* Check for pattern 9 */
- if ((strcmp(tosec, ".init.text") == 0) &&
- (strcmp(fromsec, ".text") == 0))
- for (s = pat4sym; *s; s++)
- if (strcmp(atsym, *s) == 0)
- return 1;
-
/* Check for pattern 10 */
if ((strcmp(fromsec, ".machvec") == 0) ||
(strcmp(fromsec, ".machine.desc") == 0))
--
1.5.1.rc3.20.gaa453

2007-05-18 06:54:34

by Jan Engelhardt

[permalink] [raw]
Subject: Re: [PATCH 01/14] kbuild: make modpost section warnings clearer


On May 18 2007 08:49, Sam Ravnborg wrote:
>index 113dc77..acd28ab 100644
>--- a/scripts/mod/modpost.c
>+++ b/scripts/mod/modpost.c
>@@ -885,29 +885,28 @@ static void warn_sec_mismatch(const char *modname, const char *fromsec,
> return;
>
> if (before && after) {
>- warn("%s - Section mismatch: reference to %s:%s from %s "
>- "between '%s' (at offset 0x%llx) and '%s'\n",
>- modname, secname, refsymname, fromsec,
>+ warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s "
>+ "(between '%s' and '%s')\n",
>+ modname, fromsec, (long long)r.r_offset,
>+ secname, refsymname,

%x always takes unsigned. %llx => (unsigned long long)r.r_offset.
Ditto below.

> elf->strtab + before->st_name,
>- (long long)r.r_offset,
> elf->strtab + after->st_name);
> } else if (before) {
>- warn("%s - Section mismatch: reference to %s:%s from %s "
>- "after '%s' (at offset 0x%llx)\n",
>- modname, secname, refsymname, fromsec,
>- elf->strtab + before->st_name,
>- (long long)r.r_offset);
>+ warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s "
>+ "(after '%s')\n",
>+ modname, fromsec, (long long)r.r_offset,
>+ secname, refsymname,
>+ elf->strtab + before->st_name);
[more occurences]


Jan
--

2007-05-18 06:55:23

by Sam Ravnborg

[permalink] [raw]
Subject: [PATCH 09/14] mm/slab: fix section mismatch warning

>From 8727055cf189053a0605919611cec5f3c725dc82 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <[email protected]>
Date: Thu, 17 May 2007 23:48:19 +0200
Subject: [PATCH 09/14] mm/slab: fix section mismatch warning

Use the new __init_refok marker to avoid the
section mismatch warning from slab.c

Signed-off-by: Sam Ravnborg <[email protected]>
---
mm/slab.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mm/slab.c b/mm/slab.c
index 528243e..2e71a32 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2037,7 +2037,7 @@ static size_t calculate_slab_order(struct kmem_cache *cachep,
return left_over;
}

-static int setup_cpu_cache(struct kmem_cache *cachep)
+static int __init_refok setup_cpu_cache(struct kmem_cache *cachep)
{
if (g_cpucache_up == FULL)
return enable_cpucache(cachep);
--
1.5.1.rc3.20.gaa453

2007-05-18 06:56:37

by Sam Ravnborg

[permalink] [raw]
Subject: [PATCH 10/14] powerpc: Fix the MODALIAS generation in modpost for of devices

>From 61f24a916b640ae1ac5f7bc783d3bb4d7d833c00 Mon Sep 17 00:00:00 2001
From: Sylvain Munaut <[email protected]>
Date: Tue, 8 May 2007 19:59:29 +1000
Subject: [PATCH 10/14] powerpc: Fix the MODALIAS generation in modpost for of devices

Since the devices may have multiple (or none) compatible properties,
the uevent generated internally by the kernel may have multiple
"C..." entries. So the MODALIAS stored in the module must have
wilcard before and after the compatible entry.
Also, if the 'compatible' field is not used for matching, there
will be no 'C' and that must handled as well.

The previous code handled all those case incorrectly and it
"mostly" worked ... but not always.

Signed-off-by: Sylvain Munaut <[email protected]>
Signed-off-by: Paul Mackerras <[email protected]>
Signed-off-by: Sam Ravnborg <[email protected]>
---
scripts/mod/file2alias.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index ed1244d..f646381 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -353,11 +353,16 @@ static int do_pcmcia_entry(const char *filename,

static int do_of_entry (const char *filename, struct of_device_id *of, char *alias)
{
+ int len;
char *tmp;
- sprintf (alias, "of:N%sT%sC%s",
+ len = sprintf (alias, "of:N%sT%s",
of->name[0] ? of->name : "*",
- of->type[0] ? of->type : "*",
- of->compatible[0] ? of->compatible : "*");
+ of->type[0] ? of->type : "*");
+
+ if (of->compatible[0])
+ sprintf (&alias[len], "%sC%s",
+ of->type[0] ? "*" : "",
+ of->compatible);

/* Replace all whitespace with underscores */
for (tmp = alias; tmp && *tmp; tmp++)
--
1.5.1.rc3.20.gaa453

2007-05-18 06:58:40

by Sam Ravnborg

[permalink] [raw]
Subject: [PATCH 11/14] kbuild: add support for reading stdin with gen_init_cpio

>From ad5409f51b70b12575a8b0dc07c897395311d13b Mon Sep 17 00:00:00 2001
From: Mike Frysinger <[email protected]>
Date: Thu, 10 May 2007 22:44:28 -0700
Subject: [PATCH 11/14] kbuild: add support for reading stdin with gen_init_cpio

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

2007-05-18 06:59:29

by Sam Ravnborg

[permalink] [raw]
Subject: [PATCH 12/14] kbuild: add support for squashing uid/gid in gen_initramfs_list.sh

>From 2ecaa761242e76780a35647f3d3749ee6d04d618 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <[email protected]>
Date: Thu, 10 May 2007 22:44:28 -0700
Subject: [PATCH 12/14] kbuild: add support for squashing uid/gid in gen_initramfs_list.sh

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

2007-05-18 07:00:31

by Sam Ravnborg

[permalink] [raw]
Subject: [PATCH 13/14] kbuild: include limits.h in sumversion.c for PATH_MAX

>From 72c04ee8e763e6acb3494be17c68b40ac3f699f4 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <[email protected]>
Date: Thu, 17 May 2007 14:57:20 -0400
Subject: [PATCH 13/14] kbuild: include limits.h in sumversion.c for PATH_MAX

POSIX says limits.h defines PATH_MAX so we should include it (which fixes
compiling on some systems like OS X).

Signed-off-by: Mike Frysinger <[email protected]>
Signed-off-by: Sam Ravnborg <[email protected]>
---
scripts/mod/sumversion.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/scripts/mod/sumversion.c b/scripts/mod/sumversion.c
index 6873d5a..d9cc690 100644
--- a/scripts/mod/sumversion.c
+++ b/scripts/mod/sumversion.c
@@ -7,6 +7,7 @@
#include <ctype.h>
#include <errno.h>
#include <string.h>
+#include <limits.h>
#include "modpost.h"

/*
--
1.5.1.rc3.20.gaa453

2007-05-18 07:01:12

by Sam Ravnborg

[permalink] [raw]
Subject: [PATCH 14/14] kconfig: search harder for curses library in check-lxdialog.sh

>From 329e3a972ce593015b1e9c0b91f18dcd80cfd4fa Mon Sep 17 00:00:00 2001
From: Mike Frysinger <[email protected]>
Date: Thu, 17 May 2007 15:06:31 -0400
Subject: [PATCH 14/14] kconfig: search harder for curses library in check-lxdialog.sh

The check-lxdialog.sh script searches for "libFOO.so" which fails on OS X, due
to their special naming of libraries like "libfoo.dylib". This patch turns
the curses lib search into extensible loops and adds dylib as a valid
extension.

Signed-off-by: Mike Frysinger <[email protected]>
Signed-off-by: Sam Ravnborg <[email protected]>
---
scripts/kconfig/lxdialog/check-lxdialog.sh | 24 +++++++++---------------
1 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh
index 120d624..cdca738 100644
--- a/scripts/kconfig/lxdialog/check-lxdialog.sh
+++ b/scripts/kconfig/lxdialog/check-lxdialog.sh
@@ -4,21 +4,15 @@
# What library to link
ldflags()
{
- $cc -print-file-name=libncursesw.so | grep -q /
- if [ $? -eq 0 ]; then
- echo '-lncursesw'
- exit
- fi
- $cc -print-file-name=libncurses.so | grep -q /
- if [ $? -eq 0 ]; then
- echo '-lncurses'
- exit
- fi
- $cc -print-file-name=libcurses.so | grep -q /
- if [ $? -eq 0 ]; then
- echo '-lcurses'
- exit
- fi
+ for ext in so a dylib ; do
+ for lib in ncursesw ncurses curses ; do
+ $cc -print-file-name=lib${lib}.${ext} | grep -q /
+ if [ $? -eq 0 ]; then
+ echo "-l${lib}"
+ exit
+ fi
+ done
+ done
exit 1
}

--
1.5.1.rc3.20.gaa453

2007-05-18 07:11:47

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH 01/14] kbuild: make modpost section warnings clearer

On Fri, May 18, 2007 at 08:52:31AM +0200, Jan Engelhardt wrote:
>
> On May 18 2007 08:49, Sam Ravnborg wrote:
> >index 113dc77..acd28ab 100644
> >--- a/scripts/mod/modpost.c
> >+++ b/scripts/mod/modpost.c
> >@@ -885,29 +885,28 @@ static void warn_sec_mismatch(const char *modname, const char *fromsec,
> > return;
> >
> > if (before && after) {
> >- warn("%s - Section mismatch: reference to %s:%s from %s "
> >- "between '%s' (at offset 0x%llx) and '%s'\n",
> >- modname, secname, refsymname, fromsec,
> >+ warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s "
> >+ "(between '%s' and '%s')\n",
> >+ modname, fromsec, (long long)r.r_offset,
> >+ secname, refsymname,
>
> %x always takes unsigned. %llx => (unsigned long long)r.r_offset.
> Ditto below.
>
> > elf->strtab + before->st_name,
> >- (long long)r.r_offset,
> > elf->strtab + after->st_name);
> > } else if (before) {
> >- warn("%s - Section mismatch: reference to %s:%s from %s "
> >- "after '%s' (at offset 0x%llx)\n",
> >- modname, secname, refsymname, fromsec,
> >- elf->strtab + before->st_name,
> >- (long long)r.r_offset);
> >+ warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s "
> >+ "(after '%s')\n",
> >+ modname, fromsec, (long long)r.r_offset,
> >+ secname, refsymname,
> >+ elf->strtab + before->st_name);
> [more occurences]

Thanks, updated patch below.

Sam

>From 4dba30ccfdb911b0810f6527de66b1515349d8c4 Mon Sep 17 00:00:00 2001
From: Russell King <[email protected]>
Date: Thu, 10 May 2007 23:03:25 +0100
Subject: [PATCH 01/14] kbuild: make modpost section warnings clearer

Change modpost section mismatch warnings to be less confusing;
model them on the binutils linker warnings which we all know how
to interpret.

Also, fix the wrong ordering of arguments for the final case -
fromsec and refsymname were reversed.

Signed-off-by: Russell King <[email protected]>
Acked-by: Acked-by: David S. Miller <[email protected]>
Signed-off-by: Sam Ravnborg <[email protected]>
---
scripts/mod/modpost.c | 33 ++++++++++++++++-----------------
1 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 113dc77..acd28ab 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -885,29 +885,28 @@ static void warn_sec_mismatch(const char *modname, const char *fromsec,
return;

if (before && after) {
- warn("%s - Section mismatch: reference to %s:%s from %s "
- "between '%s' (at offset 0x%llx) and '%s'\n",
- modname, secname, refsymname, fromsec,
+ warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s "
+ "(between '%s' and '%s')\n",
+ modname, fromsec, (unsigned long long)r.r_offset,
+ secname, refsymname,
elf->strtab + before->st_name,
- (long long)r.r_offset,
elf->strtab + after->st_name);
} else if (before) {
- warn("%s - Section mismatch: reference to %s:%s from %s "
- "after '%s' (at offset 0x%llx)\n",
- modname, secname, refsymname, fromsec,
- elf->strtab + before->st_name,
- (long long)r.r_offset);
+ warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s "
+ "(after '%s')\n",
+ modname, fromsec, (unsigned long long)r.r_offset,
+ secname, refsymname,
+ elf->strtab + before->st_name);
} else if (after) {
- warn("%s - Section mismatch: reference to %s:%s from %s "
+ warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s "
"before '%s' (at offset -0x%llx)\n",
- modname, secname, refsymname, fromsec,
- elf->strtab + after->st_name,
- (long long)r.r_offset);
+ modname, fromsec, (unsigned long long)r.r_offset,
+ secname, refsymname,
+ elf->strtab + after->st_name);
} else {
- warn("%s - Section mismatch: reference to %s:%s from %s "
- "(offset 0x%llx)\n",
- modname, secname, fromsec, refsymname,
- (long long)r.r_offset);
+ warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s\n",
+ modname, fromsec, (unsigned long long)r.r_offset,
+ secname, refsymname);
}
}

--
1.5.1.rc3.20.gaa453

2007-05-18 07:16:17

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 05/14] all-archs: consolidate .data section definition in asm-generic

From: Sam Ravnborg <[email protected]>
Date: Fri, 18 May 2007 08:52:57 +0200

> >From 653bc43c6c2c292e6abc98860fd241eb12e2c80f Mon Sep 17 00:00:00 2001
> From: Sam Ravnborg <[email protected]>
> Date: Thu, 17 May 2007 13:38:44 +0200
> Subject: [PATCH 05/14] all-archs: consolidate .data section definition in asm-generic
>
> With this consolidation we can now modify the .data
> section definition in one spot for all archs.
>
> Signed-off-by: Sam Ravnborg <[email protected]>

Thanks for doing these kinds of consolidations Sam, most of
us arch maintainers really appreciate it.

Looking at these patches reminds me of a quirk in the generic
RODATA definition:

> #define RODATA \
> . = ALIGN(4096); \
> .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \

It uses ALIGN(4096) which is likely supposed to be something
like ALIGN(PAGE_SIZE). Perhaps we should handle this by
definiting a LD_PAGE_SIZE at the top of vmlinux.ld.S files
that need a value other than 4096, and define the default of
4096 in asm-generic/vmlinux.lds.h?

If you could take care of this I'd really appreciate it.

2007-05-18 09:04:19

by Andreas Schwab

[permalink] [raw]
Subject: Re: [PATCH 06/14] kbuild: introduce __init_refok/__initdata_refok to supress section mismatch warnings

Sam Ravnborg <[email protected]> writes:

> + * The follwoing markers are used for the cases where the reference to

s/follwoing/following/

Andreas.

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

2007-05-18 09:21:11

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH 06/14] kbuild: introduce __init_refok/__initdata_refok to supress section mismatch warnings

On Fri, May 18, 2007 at 11:03:57AM +0200, Andreas Schwab wrote:
> Sam Ravnborg <[email protected]> writes:
>
> > + * The follwoing markers are used for the cases where the reference to
>
> s/follwoing/following/
>
> Andreas.

Thnaks, fixed locally.

Sam

2007-05-18 09:41:42

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH 05/14] all-archs: consolidate .data section definition in asm-generic

On Fri, May 18, 2007 at 12:16:04AM -0700, David Miller wrote:
>
> Looking at these patches reminds me of a quirk in the generic
> RODATA definition:
>
> > #define RODATA \
> > . = ALIGN(4096); \
> > .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
>
> It uses ALIGN(4096) which is likely supposed to be something
> like ALIGN(PAGE_SIZE). Perhaps we should handle this by
> definiting a LD_PAGE_SIZE at the top of vmlinux.ld.S files
> that need a value other than 4096, and define the default of
> 4096 in asm-generic/vmlinux.lds.h?

I would much rather use PAGE_SIZE direct since we have access to that symbol.
I would require a small modification in most asm-*/page.h files
so ld can parse them:

#define PAGE_SIZE (1UL << PAGE_SHIFT)
will become
#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)

This will allow the arch's to use that symbol in assembler too
which is a win.

Then we could do something like:

#define RODATA(alignment) \
ALIGN(alignment) \

And on the call site we will most likely use

RODATA(PAGE_SIZE)

But the architecture can override it.
Full flexibility and acceptable documentation.

>
> If you could take care of this I'd really appreciate it.
Will do.
And may expend the effort a bit further when attacking the .lds files.

It will be a week or two before I get at it.

Sam

2007-05-18 10:21:32

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 05/14] all-archs: consolidate .data section definition in asm-generic

From: Sam Ravnborg <[email protected]>
Date: Fri, 18 May 2007 11:42:31 +0200

> On Fri, May 18, 2007 at 12:16:04AM -0700, David Miller wrote:
> >
> > Looking at these patches reminds me of a quirk in the generic
> > RODATA definition:
> >
> > > #define RODATA \
> > > . = ALIGN(4096); \
> > > .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
> >
> > It uses ALIGN(4096) which is likely supposed to be something
> > like ALIGN(PAGE_SIZE). Perhaps we should handle this by
> > definiting a LD_PAGE_SIZE at the top of vmlinux.ld.S files
> > that need a value other than 4096, and define the default of
> > 4096 in asm-generic/vmlinux.lds.h?
>
> I would much rather use PAGE_SIZE direct since we have access to that symbol.

I completely agree, that seems to be what platforms which have
a configurable page size such as powerpc, ia64, etc. are already
using in their vmlinux.lds.S files, and I'll likely follow suit on
sparc64. :-)

> > If you could take care of this I'd really appreciate it.
> Will do.
> And may expend the effort a bit further when attacking the .lds files.
>
> It will be a week or two before I get at it.

Thanks a lot.

2007-05-18 10:42:16

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH 05/14] all-archs: consolidate .data section definition in asm-generic

On Fri, May 18, 2007 at 03:21:26AM -0700, David Miller wrote:
> From: Sam Ravnborg <[email protected]>
> Date: Fri, 18 May 2007 11:42:31 +0200
>
> > On Fri, May 18, 2007 at 12:16:04AM -0700, David Miller wrote:
> > >
> > > Looking at these patches reminds me of a quirk in the generic
> > > RODATA definition:
> > >
> > > > #define RODATA \
> > > > . = ALIGN(4096); \
> > > > .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
> > >
> > > It uses ALIGN(4096) which is likely supposed to be something
> > > like ALIGN(PAGE_SIZE). Perhaps we should handle this by
> > > definiting a LD_PAGE_SIZE at the top of vmlinux.ld.S files
> > > that need a value other than 4096, and define the default of
> > > 4096 in asm-generic/vmlinux.lds.h?
> >
> > I would much rather use PAGE_SIZE direct since we have access to that symbol.
>
> I completely agree, that seems to be what platforms which have
> a configurable page size such as powerpc, ia64, etc. are already
> using in their vmlinux.lds.S files, and I'll likely follow suit on
> sparc64. :-)

If you hold of a bit I would like to use sparc64 as template for
a bit more consolidation.
Most likely I will try to consolidate vmlinux.lds for sparc64 and ARM
at the same time and then take the other arch's one by one.

In the process the vmlinux.lds will start to use a consistent
indenting like the following.

Sample diff only on top of -linus.
I will redo it when I have my current patch-set applied.

Sam

diff --git a/arch/sparc64/kernel/vmlinux.lds.S b/arch/sparc64/kernel/vmlinux.lds.S
index 13fa2a2..e9469ea 100644
--- a/arch/sparc64/kernel/vmlinux.lds.S
+++ b/arch/sparc64/kernel/vmlinux.lds.S
@@ -9,105 +9,149 @@ ENTRY(_start)
jiffies = jiffies_64;
SECTIONS
{
- swapper_low_pmd_dir = 0x0000000000402000;
- . = 0x4000;
- .text 0x0000000000404000 :
- {
- _text = .;
- *(.text)
- SCHED_TEXT
- LOCK_TEXT
- KPROBES_TEXT
- *(.gnu.warning)
- } =0
- _etext = .;
- PROVIDE (etext = .);
-
- RODATA
-
- .data :
- {
- *(.data)
- CONSTRUCTORS
- }
- .data1 : { *(.data1) }
- . = ALIGN(64);
- .data.cacheline_aligned : { *(.data.cacheline_aligned) }
- . = ALIGN(64);
- .data.read_mostly : { *(.data.read_mostly) }
- _edata = .;
- PROVIDE (edata = .);
- .fixup : { *(.fixup) }
-
- . = ALIGN(16);
- __start___ex_table = .;
- __ex_table : { *(__ex_table) }
- __stop___ex_table = .;
-
- . = ALIGN(8192);
- __init_begin = .;
- .init.text : {
- _sinittext = .;
- *(.init.text)
- _einittext = .;
- }
- .init.data : { *(.init.data) }
- . = ALIGN(16);
- __setup_start = .;
- .init.setup : { *(.init.setup) }
- __setup_end = .;
- __initcall_start = .;
- .initcall.init : {
- INITCALLS
- }
- __initcall_end = .;
- __con_initcall_start = .;
- .con_initcall.init : { *(.con_initcall.init) }
- __con_initcall_end = .;
- SECURITY_INIT
- . = ALIGN(4);
- __tsb_ldquad_phys_patch = .;
- .tsb_ldquad_phys_patch : { *(.tsb_ldquad_phys_patch) }
- __tsb_ldquad_phys_patch_end = .;
- __tsb_phys_patch = .;
- .tsb_phys_patch : { *(.tsb_phys_patch) }
- __tsb_phys_patch_end = .;
- __cpuid_patch = .;
- .cpuid_patch : { *(.cpuid_patch) }
- __cpuid_patch_end = .;
- __sun4v_1insn_patch = .;
- .sun4v_1insn_patch : { *(.sun4v_1insn_patch) }
- __sun4v_1insn_patch_end = .;
- __sun4v_2insn_patch = .;
- .sun4v_2insn_patch : { *(.sun4v_2insn_patch) }
- __sun4v_2insn_patch_end = .;
+ swapper_low_pmd_dir = 0x0000000000402000;
+ . = 0x4000;
+ .text 0x0000000000404000 : {
+ _text = .;
+ *(.text)
+ SCHED_TEXT
+ LOCK_TEXT
+ KPROBES_TEXT
+ *(.gnu.warning)
+ } =0
+ _etext = .;
+ PROVIDE (etext = .);
+
+ RODATA
+
+ .data : {
+ *(.data)
+ CONSTRUCTORS
+ }
+ .data1 : {
+ *(.data1)
+ }
+
+ . = ALIGN(64);
+ .data.cacheline_aligned : {
+ *(.data.cacheline_aligned)
+ }
+
+ . = ALIGN(64);
+ .data.read_mostly : {
+ *(.data.read_mostly)
+ }
+ _edata = .;
+ PROVIDE (edata = .);
+ .fixup : {
+ *(.fixup)
+ }
+
+ . = ALIGN(16);
+ __start___ex_table = .;
+ __ex_table : {
+ *(__ex_table)
+ }
+ __stop___ex_table = .;
+
+ . = ALIGN(8192);
+ __init_begin = .;
+ .init.text : {
+ _sinittext = .;
+ *(.init.text)
+ _einittext = .;
+ }
+
+ .init.data : {
+ *(.init.data)
+ }
+
+ . = ALIGN(16);
+ __setup_start = .;
+ .init.setup : {
+ *(.init.setup)
+ }
+ __setup_end = .;
+
+ __initcall_start = .;
+ .initcall.init : {
+ INITCALLS
+ }
+ __initcall_end = .;
+
+ __con_initcall_start = .;
+ .con_initcall.init : {
+ *(.con_initcall.init)
+ }
+ __con_initcall_end = .;
+ SECURITY_INIT
+
+ . = ALIGN(4);
+ __tsb_ldquad_phys_patch = .;
+ .tsb_ldquad_phys_patch : {
+ *(.tsb_ldquad_phys_patch)
+ }
+ __tsb_ldquad_phys_patch_end = .;
+
+ __tsb_phys_patch = .;
+ .tsb_phys_patch : {
+ *(.tsb_phys_patch)
+ }
+ __tsb_phys_patch_end = .;
+
+ __cpuid_patch = .;
+ .cpuid_patch : {
+ *(.cpuid_patch)
+ }
+ __cpuid_patch_end = .;
+
+ __sun4v_1insn_patch = .;
+ .sun4v_1insn_patch : {
+ *(.sun4v_1insn_patch)
+ }
+ __sun4v_1insn_patch_end = .;
+ __sun4v_2insn_patch = .;
+ .sun4v_2insn_patch : {
+ *(.sun4v_2insn_patch)
+ }
+ __sun4v_2insn_patch_end = .;

#ifdef CONFIG_BLK_DEV_INITRD
- . = ALIGN(8192);
- __initramfs_start = .;
- .init.ramfs : { *(.init.ramfs) }
- __initramfs_end = .;
+ . = ALIGN(8192);
+ __initramfs_start = .;
+ .init.ramfs : {
+ *(.init.ramfs)
+ }
+ __initramfs_end = .;
#endif

- . = ALIGN(8192);
- __per_cpu_start = .;
- .data.percpu : { *(.data.percpu) }
- __per_cpu_end = .;
- . = ALIGN(8192);
- __init_end = .;
- __bss_start = .;
- .sbss : { *(.sbss) *(.scommon) }
- .bss :
- {
- *(.dynbss)
- *(.bss)
- *(COMMON)
- }
- _end = . ;
- PROVIDE (end = .);
- /DISCARD/ : { *(.exit.text) *(.exit.data) *(.exitcall.exit) }
-
- STABS_DEBUG
-
- DWARF_DEBUG
+ . = ALIGN(8192);
+ __per_cpu_start = .;
+ .data.percpu : {
+ *(.data.percpu)
+ }
+ __per_cpu_end = .;
+ . = ALIGN(8192);
+ __init_end = .;
+ __bss_start = .;
+ .sbss : {
+ *(.sbss)
+ *(.scommon)
+ }
+ .bss : {
+ *(.dynbss)
+ *(.bss)
+ *(COMMON)
+ }
+ _end = . ;
+ PROVIDE (end = .);
+
+ /DISCARD/ : {
+ *(.exit.text)
+ *(.exit.data)
+ *(.exitcall.exit)
+ }
+
+ STABS_DEBUG
+ DWARF_DEBUG
}