All of lore.kernel.org
 help / color / mirror / Atom feed
* Detecting section mismatches in vmlinux
@ 2007-02-21 15:57 Atsushi Nemoto
  2007-02-24 18:53 ` Atsushi Nemoto
  0 siblings, 1 reply; 7+ messages in thread
From: Atsushi Nemoto @ 2007-02-21 15:57 UTC (permalink / raw)
  To: linux-kernel

Until 2.6.16 or so, we had reference_init.pl and
reference_discarded.pl to check section mismatches in vmlinux.

Are there any alternatives of this in recent kernel?

Now "modpost vmlinux" is executed during normal build, but it seems
the pass can not detect these mismatches.

For example:

$ ../build-i386/scripts/mod/modpost ../build-i386/mm/built-in.o
WARNING: ../build-i386/mm/built-in.o - Section mismatch: reference to .init.data:initkmem_list3 from .text between 'set_up_list3s' (at offset 0x18382) and '__kmem_cache_destroy'

set_up_list3s() in slab.c is not marked as __init and it references
initkmem_list3[] which is marked as __initdata.  So it is not false
positive.  But "modpost vmlinux" does not report it.

---
Atsushi Nemoto

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Detecting section mismatches in vmlinux
  2007-02-21 15:57 Detecting section mismatches in vmlinux Atsushi Nemoto
@ 2007-02-24 18:53 ` Atsushi Nemoto
  2007-02-24 20:07   ` Sam Ravnborg
  2007-02-24 23:25   ` Sam Ravnborg
  0 siblings, 2 replies; 7+ messages in thread
From: Atsushi Nemoto @ 2007-02-24 18:53 UTC (permalink / raw)
  To: linux-kernel; +Cc: sam

On Thu, 22 Feb 2007 00:57:28 +0900 (JST), Atsushi Nemoto <anemo@mba.ocn.ne.jp> wrote:
> $ ../build-i386/scripts/mod/modpost ../build-i386/mm/built-in.o
> WARNING: ../build-i386/mm/built-in.o - Section mismatch: reference to .init.data:initkmem_list3 from .text between 'set_up_list3s' (at offset 0x18382) and '__kmem_cache_destroy'
> 
> set_up_list3s() in slab.c is not marked as __init and it references
> initkmem_list3[] which is marked as __initdata.  So it is not false
> positive.  But "modpost vmlinux" does not report it.

For this set_up_list3s() case, it is not a fatal since it is only
called during early bootstrap phase.  But anyway I think we should
detect these case at compile time.

I found refenrence_*.pl was removed on these commits at 2.6.17:

> commit eae0f536f640bb95f2ad437a57c40c7d5683d1ac
> Author: Sam Ravnborg <sam@mars.ravnborg.org>
> Date:   Tue Mar 21 07:28:24 2006 +0100
> 
>     kbuild: remove obsoleted scripts/reference_* files
> 
> commit b39927cf4cc5a9123d2b157ffd396884cb8156eb
> Author: Sam Ravnborg <sam@mars.ravnborg.org>
> Date:   Fri Feb 17 22:42:02 2006 +0100
> 
>     kbuild: check for section mismatch during modpost stage

Reviving these perl scripts looks overkill for me.

This is a dirty hack to check all built-in.o just after linking
vmlinux.  But this can not detect mismatches in libs.a files, and
modpost fails with "... is truncated" message on empty built-in.o
files.

Maybe checking at each $(LD) invocation should detect all mismatches,
but I'm not familer with kbuild to do it by myself.  Could someone
make perfect solution?


diff --git a/Makefile b/Makefile
index d442d4b..4e8015d 100644
--- a/Makefile
+++ b/Makefile
@@ -738,6 +738,7 @@ ifdef CONFIG_HEADERS_CHECK
 endif
 	$(call if_changed_rule,vmlinux__)
 	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost $@
+	-scripts/mod/modpost $(filter-out $(libs-y1),$(vmlinux-init) $(vmlinux-main))
 	$(Q)rm -f .old_version
 
 # The actual objects are generated when descending, 


---
Atsushi Nemoto

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: Detecting section mismatches in vmlinux
  2007-02-24 18:53 ` Atsushi Nemoto
@ 2007-02-24 20:07   ` Sam Ravnborg
  2007-02-24 23:25   ` Sam Ravnborg
  1 sibling, 0 replies; 7+ messages in thread
From: Sam Ravnborg @ 2007-02-24 20:07 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: linux-kernel

On Sun, Feb 25, 2007 at 03:53:15AM +0900, Atsushi Nemoto wrote:
> 
> This is a dirty hack to check all built-in.o just after linking
> vmlinux.  But this can not detect mismatches in libs.a files, and
> modpost fails with "... is truncated" message on empty built-in.o
> files.
> 
> Maybe checking at each $(LD) invocation should detect all mismatches,
> but I'm not familer with kbuild to do it by myself.  Could someone
> make perfect solution?

I would prefer to find out why it fails when running the check
on full vmlinux.
Your suggestion is like papering over the real bug - and only
if something prevent us from detecting this in full
vmlinux should we do it for each LD invocation.

	Sam

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Detecting section mismatches in vmlinux
  2007-02-24 18:53 ` Atsushi Nemoto
  2007-02-24 20:07   ` Sam Ravnborg
@ 2007-02-24 23:25   ` Sam Ravnborg
  2007-02-25 15:48     ` Atsushi Nemoto
  1 sibling, 1 reply; 7+ messages in thread
From: Sam Ravnborg @ 2007-02-24 23:25 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: linux-kernel

Hi Atsushi-san

On Sun, Feb 25, 2007 at 03:53:15AM +0900, Atsushi Nemoto wrote:
> On Thu, 22 Feb 2007 00:57:28 +0900 (JST), Atsushi Nemoto <anemo@mba.ocn.ne.jp> wrote:
> > $ ../build-i386/scripts/mod/modpost ../build-i386/mm/built-in.o
> > WARNING: ../build-i386/mm/built-in.o - Section mismatch: reference to .init.data:initkmem_list3 from .text between 'set_up_list3s' (at offset 0x18382) and '__kmem_cache_destroy'
> > 
> > set_up_list3s() in slab.c is not marked as __init and it references
> > initkmem_list3[] which is marked as __initdata.  So it is not false
> > positive.  But "modpost vmlinux" does not report it.

Correct- modpost vmlinux lacks relocation infomration info in vmlinux so it will
not report these errors.

> Maybe checking at each $(LD) invocation should detect all mismatches,
> but I'm not familer with kbuild to do it by myself.  Could someone
> make perfect solution?

Attached patch does:
1) Do not check vmlinux but check all .o files that is used to create vmlinux
2) Teach modpost to skip non-elf files (.a files and empty .o files etc)

With this change we get proper check of vmlinux (or files used to create vmlinux)

This gives following errors in a x86_64 defconfig build:

WARNING: init/built-in.o - Section mismatch: reference to .init.text:init from .text between 'rest_init' (at offset 0xe) and 'run_init_process'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.text:mtrr_bp_init from .text between 'identify_cpu' (at offset 0x65eb) and 'IRQ0x20_interrupt'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data: from .text between 'finish_e820_parsing' (at offset 0x7dc2) and 'early_panic'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.text:e820_print_map from .text between 'finish_e820_parsing' (at offset 0x7de1) and 'early_panic'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:num_processors from .text between 'acpi_unmap_lsapic' (at offset 0xc88f) and 'acpi_register_ioapic'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.text:stop_timer_interrupt from .text between 'setup_APIC_timer' (at offset 0xfcbc) and 'setup_secondary_APIC_clock'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:disabled_cpus from .text between 'MP_processor_info' (at offset 0x11f35) and 'mp_register_lapic'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:num_processors from .text between 'MP_processor_info' (at offset 0x11f6e) and 'mp_register_lapic'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:num_processors from .text between 'MP_processor_info' (at offset 0x11f93) and 'mp_register_lapic'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:fix_aperture from .text between 'gart_parse_options' (at offset 0x15517) and 'iommu_full'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:fix_aperture from .text between 'gart_parse_options' (at offset 0x1552c) and 'iommu_full'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:iommu_aperture_allowed from .text between 'gart_parse_options' (at offset 0x1553d) and 'iommu_full'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:iommu_aperture_allowed from .text between 'gart_parse_options' (at offset 0x15552) and 'iommu_full'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:iommu_aperture_allowed from .text between 'gart_parse_options' (at offset 0x15561) and 'iommu_full'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:iommu_aperture_allowed from .text between 'gart_parse_options' (at offset 0x15577) and 'iommu_full'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:fallback_aper_force from .text between 'gart_parse_options' (at offset 0x1558a) and 'iommu_full'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:fallback_aper_order from .text between 'gart_parse_options' (at offset 0x155bf) and 'iommu_full'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:timer_over_8254 from .text between 'ati_bugs' (at offset 0x16344) and 'via_bugs'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:timer_over_8254 from .text between 'ati_bugs' (at offset 0x16356) and 'via_bugs'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:iommu_aperture_allowed from .text between 'via_bugs' (at offset 0x16380) and 'nvidia_bugs'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:iommu_aperture_disabled from .text between 'via_bugs' (at offset 0x16397) and 'nvidia_bugs'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:acpi_use_timer_override from .text between 'nvidia_bugs' (at offset 0x163a7) and 'arch_unregister_cpu'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.text:nvidia_hpet_check from .text between 'nvidia_bugs' (at offset 0x163b1) and 'arch_unregister_cpu'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data: from .text between 'nvidia_bugs' (at offset 0x163be) and 'arch_unregister_cpu'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data: from .text between 'nvidia_bugs' (at offset 0x163d1) and 'arch_unregister_cpu'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:acpi_skip_timer_override from .text between 'nvidia_bugs' (at offset 0x163e1) and 'arch_unregister_cpu'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.text:quirk_intel_irqbalance from .text between 'intel_bugs' (at offset 0x1633c) and 'ati_bugs'
WARNING: mm/built-in.o - Section mismatch: reference to .init.data:initkmem_list3 from .text between 'set_up_list3s' (at offset 0x1e6fb) and 'slab_get_obj'
WARNING: mm/built-in.o - Section mismatch: reference to .init.data:initkmem_list3 from .text between 'set_up_list3s' (at offset 0x1e71c) and 'slab_get_obj'
WARNING: lib/built-in.o - Section mismatch: reference to .init.text:swiotlb_init from __ksymtab between '__ksymtab_swiotlb_init' (at offset 0x3a0) and '__ksymtab_swiotlb_map_single'
WARNING: drivers/built-in.o - Section mismatch: reference to .init.text:quirk_ide_samemode from .pci_fixup_early between '__pci_fixup_PCI_VENDOR_ID_INTELPCI_DEVICE_ID_INTEL_82801CA_10quirk_ide_samemode' (at offset 0x18) and '__pci_fixup_PCI_VENDOR_ID_JMICRONPCI_ANY_IDquirk_jmicron_dualfn'


Before pushing this patch the above list needs to be smaller :-(
I have not yet looked into the list.

	Sam

diff --git a/Makefile b/Makefile
index 30b66e2..fa32fde 100644
--- a/Makefile
+++ b/Makefile
@@ -603,6 +603,7 @@ vmlinux-init := $(head-y) $(init-y)
 vmlinux-main := $(core-y) $(libs-y) $(drivers-y) $(net-y)
 vmlinux-all  := $(vmlinux-init) $(vmlinux-main)
 vmlinux-lds  := arch/$(ARCH)/kernel/vmlinux.lds
+export KBUILD_VMLINUX_OBJS := $(vmlinux-all)
 
 # Rule to link vmlinux - also used during CONFIG_KALLSYMS
 # May be overridden by arch/$(ARCH)/Makefile
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index 65e0a79..d7277bb 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -63,15 +63,14 @@ quiet_cmd_modpost = MODPOST $(words $(fi
 	$(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \
 	$(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \
 	$(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \
-	$(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) \
-	$(wildcard vmlinux) $(filter-out FORCE,$^)
+	$(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w)
 
 PHONY += __modpost
 __modpost: $(modules:.ko=.o) FORCE
-	$(call cmd,modpost)
+	$(call cmd,modpost) $(wildcard vmlinux) $(filter-out FORCE,$^)
 
 quiet_cmd_kernel-mod = MODPOST $@
-      cmd_kernel-mod = $(cmd_modpost)
+      cmd_kernel-mod = $(cmd_modpost) $(KBUILD_VMLINUX_OBJS)
 
 vmlinux: FORCE
 	$(call cmd,kernel-mod)
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index c4b5398..ec7ad96 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -333,10 +333,10 @@ void release_file(void *file, unsigned l
 	munmap(file, size);
 }
 
-static void parse_elf(struct elf_info *info, const char *filename)
+static int parse_elf(struct elf_info *info, const char *filename)
 {
 	unsigned int i;
-	Elf_Ehdr *hdr = info->hdr;
+	Elf_Ehdr *hdr;
 	Elf_Shdr *sechdrs;
 	Elf_Sym  *sym;
 
@@ -346,8 +346,19 @@ static void parse_elf(struct elf_info *i
 		exit(1);
 	}
 	info->hdr = hdr;
-	if (info->size < sizeof(*hdr))
-		goto truncated;
+	/* Is this a valid ELF file? */
+	if ((hdr->e_ident[EI_MAG0] != ELFMAG0) ||
+	    (hdr->e_ident[EI_MAG1] != ELFMAG1) ||
+	    (hdr->e_ident[EI_MAG2] != ELFMAG2) ||
+	    (hdr->e_ident[EI_MAG3] != ELFMAG3)) {
+		/* Not an ELF file - silently ignore it */
+		return 0;
+	}
+
+	if (info->size < sizeof(*hdr)) {
+		/* file too small, assume this is an empty .o file */
+		return 0;
+	}
 
 	/* Fix endianness in ELF header */
 	hdr->e_shoff    = TO_NATIVE(hdr->e_shoff);
@@ -371,8 +382,10 @@ static void parse_elf(struct elf_info *i
 			= (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;
 		const char *secname;
 
-		if (sechdrs[i].sh_offset > info->size)
-			goto truncated;
+		if (sechdrs[i].sh_offset > info->size) {
+			fatal("%s is truncated. sechdrs[i].sh_offset=%u > sizeof(*hrd)=%ul\n", filename, (unsigned int)sechdrs[i].sh_offset, sizeof(*hdr));
+			return 0;
+		}
 		secname = secstrings + sechdrs[i].sh_name;
 		if (strcmp(secname, ".modinfo") == 0) {
 			info->modinfo = (void *)hdr + sechdrs[i].sh_offset;
@@ -407,10 +420,7 @@ static void parse_elf(struct elf_info *i
 		sym->st_value = TO_NATIVE(sym->st_value);
 		sym->st_size  = TO_NATIVE(sym->st_size);
 	}
-	return;
-
- truncated:
-	fatal("%s is truncated.\n", filename);
+	return 1;
 }
 
 static void parse_elf_finish(struct elf_info *info)
@@ -1088,7 +1098,8 @@ static void read_symbols(char *modname)
 	struct elf_info info = { };
 	Elf_Sym *sym;
 
-	parse_elf(&info, modname);
+	if (!parse_elf(&info, modname))
+		return;
 
 	mod = new_module(modname);
 

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: Detecting section mismatches in vmlinux
  2007-02-24 23:25   ` Sam Ravnborg
@ 2007-02-25 15:48     ` Atsushi Nemoto
  2007-02-25 20:53       ` [PATCH] x86_64: fix section mismatch warnings Sam Ravnborg
  0 siblings, 1 reply; 7+ messages in thread
From: Atsushi Nemoto @ 2007-02-25 15:48 UTC (permalink / raw)
  To: sam; +Cc: linux-kernel

On Sun, 25 Feb 2007 00:25:27 +0100, Sam Ravnborg <sam@ravnborg.org> wrote:
> Attached patch does:
> 1) Do not check vmlinux but check all .o files that is used to create vmlinux
> 2) Teach modpost to skip non-elf files (.a files and empty .o files etc)
> 
> With this change we get proper check of vmlinux (or files used to create vmlinux)

Thanks!  It works fine for me too.

> This gives following errors in a x86_64 defconfig build:
> 
> WARNING: init/built-in.o - Section mismatch: reference to .init.text:init from .text between 'rest_init' (at offset 0xe) and 'run_init_process'

This is because rest_init() (non __init) references 'init' (__init) as
an argument of kernel_thread().  No idea how to avoid this warning...

> WARNING: mm/built-in.o - Section mismatch: reference to .init.data:initkmem_list3 from .text between 'set_up_list3s' (at offset 0x1e6fb) and 'slab_get_obj'
> WARNING: mm/built-in.o - Section mismatch: reference to .init.data:initkmem_list3 from .text between 'set_up_list3s' (at offset 0x1e71c) and 'slab_get_obj'

This is because set_up_list3s() (non __init) references
initkmem_list3[] (__initdata).  The set_up_list3s() is only used on
early stage so can be __init, but it cause an another mismatch ---
setup_cpu_cache() (non __init) calls __init function.  Some trick
using a function pointer might solve this issue, but I wonder it is a
right thing to do...

Or we need another whitelist for vmlinux?

---
Atsushi Nemoto

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] x86_64: fix section mismatch warnings
  2007-02-25 15:48     ` Atsushi Nemoto
@ 2007-02-25 20:53       ` Sam Ravnborg
  2007-02-27 20:25         ` Andrew Morton
  0 siblings, 1 reply; 7+ messages in thread
From: Sam Ravnborg @ 2007-02-25 20:53 UTC (permalink / raw)
  To: Atsushi Nemoto, Andi Kleen; +Cc: linux-kernel

Fix the following section mismatch warnings on x86_64:
(build using defconfig)

WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.text:mtrr_bp_init from .text between 'identify_cpu' (at offset 0x65eb) and 'IRQ0x20_interrupt'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data: from .text between 'finish_e820_parsing' (at offset 0x7dc2) and 'early_panic'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.text:e820_print_map from .text between 'finish_e820_parsing' (at offset 0x7de1) and 'early_panic'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:num_processors from .text between 'acpi_unmap_lsapic' (at offset 0xc88f) and 'acpi_register_ioapic'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:disabled_cpus from .text between 'MP_processor_info' (at offset 0x11f35) and 'mp_register_lapic'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:num_processors from .text between 'MP_processor_info' (at offset 0x11f6e) and 'mp_register_lapic'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:num_processors from .text between 'MP_processor_info' (at offset 0x11f93) and 'mp_register_lapic'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:fix_aperture from .text between 'gart_parse_options' (at offset 0x15517) and 'iommu_full'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:fix_aperture from .text between 'gart_parse_options' (at offset 0x1552c) and 'iommu_full'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:iommu_aperture_allowed from .text between 'gart_parse_options' (at offset 0x1553d) and 'iommu_full'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:iommu_aperture_allowed from .text between 'gart_parse_options' (at offset 0x15552) and 'iommu_full'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:iommu_aperture_allowed from .text between 'gart_parse_options' (at offset 0x15561) and 'iommu_full'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:iommu_aperture_allowed from .text between 'gart_parse_options' (at offset 0x15577) and 'iommu_full'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:fallback_aper_force from .text between 'gart_parse_options' (at offset 0x1558a) and 'iommu_full'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:fallback_aper_order from .text between 'gart_parse_options' (at offset 0x155bf) and 'iommu_full'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:timer_over_8254 from .text between 'ati_bugs' (at offset 0x16344) and 'via_bugs'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:timer_over_8254 from .text between 'ati_bugs' (at offset 0x16356) and 'via_bugs'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:iommu_aperture_allowed from .text between 'via_bugs' (at offset 0x16380) and 'nvidia_bugs'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:iommu_aperture_disabled from .text between 'via_bugs' (at offset 0x16397) and 'nvidia_bugs'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:acpi_use_timer_override from .text between 'nvidia_bugs' (at offset 0x163a7) and 'arch_unregister_cpu'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.text:nvidia_hpet_check from .text between 'nvidia_bugs' (at offset 0x163b1) and 'arch_unregister_cpu'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data: from .text between 'nvidia_bugs' (at offset 0x163be) and 'arch_unregister_cpu'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data: from .text between 'nvidia_bugs' (at offset 0x163d1) and 'arch_unregister_cpu'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.data:acpi_skip_timer_override from .text between 'nvidia_bugs' (at offset 0x163e1) and 'arch_unregister_cpu'
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.text:quirk_intel_irqbalance from .text between 'intel_bugs' (at offset 0x1633c) and 'ati_bugs'

But adds:
WARNING: arch/x86_64/kernel/built-in.o - Section mismatch: reference to .init.text:get_mtrr_state from .text between 'mtrr_bp_init' (at offset 0xb887) and 'ipi_handler'

The warnings does not show up during a normal build due to kbuild
failing to check for section mismatch in vmlinux.
To see these warnings run:
scripts/mod/modpost arch/x86_64/kernel/built-in.o

kbuild will be fixed but the 'noise-level' had to be decresed first.
There remains a few section mismatch warnigns for x86_64 for areas where I did
not feel confident.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---

I only recently got my new dev machine running and has not yet
installed cross-compile tools etc. so I do not know the status
of other architectures.

Fro the mtrr changes I felt less confident then the rest and did not fix up the
introduced warning for the same reason. Let me know if you have any hints.

Any easy way to get cross-compile tools on ubuntu other than using Dan Kegel's
toolset or Linux Foundation precompield versions?

	Sam

diff --git a/arch/i386/kernel/cpu/mtrr/main.c b/arch/i386/kernel/cpu/mtrr/main.c
index 0acfb6a..8972cad 100644
--- a/arch/i386/kernel/cpu/mtrr/main.c
+++ b/arch/i386/kernel/cpu/mtrr/main.c
@@ -639,7 +639,7 @@ static struct sysdev_driver mtrr_sysdev_driver = {
  * initialized (i.e. before smp_init()).
  * 
  */
-void __init mtrr_bp_init(void)
+void __cpuinit mtrr_bp_init(void)
 {
 	init_ifs();
 
diff --git a/arch/x86_64/kernel/e820.c b/arch/x86_64/kernel/e820.c
index 4651fd2..a490fab 100644
--- a/arch/x86_64/kernel/e820.c
+++ b/arch/x86_64/kernel/e820.c
@@ -662,7 +662,7 @@ static int __init parse_memmap_opt(char *p)
 }
 early_param("memmap", parse_memmap_opt);
 
-void finish_e820_parsing(void)
+void __init finish_e820_parsing(void)
 {
 	if (userdef) {
 		printk(KERN_INFO "user-defined physical RAM map:\n");
diff --git a/arch/x86_64/kernel/early-quirks.c b/arch/x86_64/kernel/early-quirks.c
index 8047ea8..51c281c 100644
--- a/arch/x86_64/kernel/early-quirks.c
+++ b/arch/x86_64/kernel/early-quirks.c
@@ -16,7 +16,7 @@
 #include <asm/proto.h>
 #include <asm/dma.h>
 
-static void via_bugs(void)
+static void __init via_bugs(void)
 {
 #ifdef CONFIG_IOMMU
 	if ((end_pfn > MAX_DMA32_PFN ||  force_iommu) &&
@@ -39,7 +39,7 @@ static int __init nvidia_hpet_check(struct acpi_table_header *header)
 }
 #endif
 
-static void nvidia_bugs(void)
+static void __init nvidia_bugs(void)
 {
 #ifdef CONFIG_ACPI
 	/*
@@ -69,7 +69,7 @@ static void nvidia_bugs(void)
 
 }
 
-static void ati_bugs(void)
+static void __init ati_bugs(void)
 {
 	if (timer_over_8254 == 1) {
 		timer_over_8254 = 0;
@@ -78,7 +78,7 @@ static void ati_bugs(void)
 	}
 }
 
-static void intel_bugs(void)
+static void __init intel_bugs(void)
 {
 	u16 device = read_pci_config_16(0, 0, 0, PCI_DEVICE_ID);
 
@@ -95,7 +95,7 @@ struct chipset {
 	void (*f)(void);
 };
 
-static struct chipset early_qrk[] = {
+static struct __initdata chipset early_qrk[] = {
 	{ PCI_VENDOR_ID_NVIDIA, nvidia_bugs },
 	{ PCI_VENDOR_ID_VIA, via_bugs },
 	{ PCI_VENDOR_ID_ATI, ati_bugs },
diff --git a/arch/x86_64/kernel/mpparse.c b/arch/x86_64/kernel/mpparse.c
index 50dd8be..455aa0b 100644
--- a/arch/x86_64/kernel/mpparse.c
+++ b/arch/x86_64/kernel/mpparse.c
@@ -60,9 +60,9 @@ unsigned long mp_lapic_addr = 0;
 /* Processor that is doing the boot up */
 unsigned int boot_cpu_id = -1U;
 /* Internal processor count */
-unsigned int num_processors __initdata = 0;
+unsigned int num_processors __cpuinitdata = 0;
 
-unsigned disabled_cpus __initdata;
+unsigned disabled_cpus __cpuinitdata;
 
 /* Bitmask of physically existing CPUs */
 physid_mask_t phys_cpu_present_map = PHYSID_MASK_NONE;
diff --git a/arch/x86_64/kernel/pci-gart.c b/arch/x86_64/kernel/pci-gart.c
index 030eb37..2bac8c6 100644
--- a/arch/x86_64/kernel/pci-gart.c
+++ b/arch/x86_64/kernel/pci-gart.c
@@ -675,7 +675,7 @@ void __init gart_iommu_init(void)
 	dma_ops = &gart_dma_ops;
 } 
 
-void gart_parse_options(char *p)
+void __init gart_parse_options(char *p)
 {
 	int arg;
 
diff --git a/include/asm-x86_64/proto.h b/include/asm-x86_64/proto.h
index f54f3ab..b6e65a6 100644
--- a/include/asm-x86_64/proto.h
+++ b/include/asm-x86_64/proto.h
@@ -99,7 +99,7 @@ extern int force_iommu, no_iommu;
 extern int iommu_detected;
 #ifdef CONFIG_IOMMU
 extern void gart_iommu_init(void);
-extern void gart_parse_options(char *);
+extern void __init gart_parse_options(char *);
 extern void iommu_hole_init(void);
 extern int fallback_aper_order;
 extern int fallback_aper_force;
diff --git a/include/asm-x86_64/smp.h b/include/asm-x86_64/smp.h
index e17b9ec..de592a4 100644
--- a/include/asm-x86_64/smp.h
+++ b/include/asm-x86_64/smp.h
@@ -7,6 +7,7 @@
 #include <linux/threads.h>
 #include <linux/cpumask.h>
 #include <linux/bitops.h>
+#include <linux/init.h>
 extern int disable_apic;
 
 #include <asm/fixmap.h>
@@ -68,7 +69,7 @@ extern int __cpu_disable(void);
 extern void __cpu_die(unsigned int cpu);
 extern void prefill_possible_map(void);
 extern unsigned num_processors;
-extern unsigned disabled_cpus;
+extern unsigned __cpuinitdata disabled_cpus;
 
 #define NO_PROC_ID		0xFF		/* No processor magic marker */
 
 

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] x86_64: fix section mismatch warnings
  2007-02-25 20:53       ` [PATCH] x86_64: fix section mismatch warnings Sam Ravnborg
@ 2007-02-27 20:25         ` Andrew Morton
  0 siblings, 0 replies; 7+ messages in thread
From: Andrew Morton @ 2007-02-27 20:25 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: anemo, ak, linux-kernel

> On Sun, 25 Feb 2007 21:53:02 +0100 Sam Ravnborg <sam@ravnborg.org> wrote:
> Any easy way to get cross-compile tools on ubuntu other than using Dan Kegel's
> toolset or Linux Foundation precompield versions?

Not that I know of - it's all rather non-trivial.

I have uploaded a bunch of precompiled cross-compilers for redhatty systems
to http://userweb.kernel.org/~akpm/cross-compilers whcih give decent
coverage.

(URL might be inaccurate: am typing offline)

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-02-27 20:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-21 15:57 Detecting section mismatches in vmlinux Atsushi Nemoto
2007-02-24 18:53 ` Atsushi Nemoto
2007-02-24 20:07   ` Sam Ravnborg
2007-02-24 23:25   ` Sam Ravnborg
2007-02-25 15:48     ` Atsushi Nemoto
2007-02-25 20:53       ` [PATCH] x86_64: fix section mismatch warnings Sam Ravnborg
2007-02-27 20:25         ` Andrew Morton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.