Re: Detecting section mismatches in vmlinux

From: Atsushi Nemoto
Date: Sat Feb 24 2007 - 13:53:34 EST


On Thu, 22 Feb 2007 00:57:28 +0900 (JST), Atsushi Nemoto <anemo@xxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxxxx>
> Date: Tue Mar 21 07:28:24 2006 +0100
>
> kbuild: remove obsoleted scripts/reference_* files
>
> commit b39927cf4cc5a9123d2b157ffd396884cb8156eb
> Author: Sam Ravnborg <sam@xxxxxxxxxxxxxxxxx>
> 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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/