From: Sam Ravnborg <sam@ravnborg.org>
To: linux-kernel@vger.kernel.org
Cc: Sam Ravnborg <sam@ravnborg.org>
Subject: [PATCH 22/33] kbuild: do section mismatch check on full vmlinux
Date: Tue, 17 Jul 2007 16:08:51 +0200 [thread overview]
Message-ID: <11846813442810-git-send-email-sam@ravnborg.org> (raw)
In-Reply-To: <1184681344985-git-send-email-sam@ravnborg.org>
Previously we did do the check on the .o files used to link
vmlinux but that failed to find questionable references across
the .o files.
Create a dedicated vmlinux.o file used only for section mismatch checks
that uses the defualt linker script so section does not get renamed.
The vmlinux.o may later be used as part of the the final link of vmlinux
but for now it is used fo section mismatch only.
For a defconfig build this is instant but for an allyesconfig this
add two minutes to a full build (that anyways takes ~2 hours).
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
Makefile | 22 +++++++++++++++++++---
scripts/Makefile.modpost | 4 ++--
scripts/mod/modpost.c | 3 ++-
3 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/Makefile b/Makefile
index ddbfcac..4f0bd65 100644
--- a/Makefile
+++ b/Makefile
@@ -612,7 +612,7 @@ quiet_cmd_vmlinux__ ?= LD $@
cmd_vmlinux__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) -o $@ \
-T $(vmlinux-lds) $(vmlinux-init) \
--start-group $(vmlinux-main) --end-group \
- $(filter-out $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) FORCE ,$^)
+ $(filter-out $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) vmlinux.o FORCE ,$^)
# Generate new vmlinux version
quiet_cmd_vmlinux_version = GEN .version
@@ -736,15 +736,31 @@ debug_kallsyms: .tmp_map$(last_kallsyms)
endif # ifdef CONFIG_KALLSYMS
+# Do modpost on a prelinked vmlinux. The finally linked vmlinux has
+# relevant sections renamed as per the linker script.
+quiet_cmd_vmlinux-modpost = LD $@
+ cmd_vmlinux-modpost = $(LD) $(LDFLAGS) -r -o $@ \
+ $(vmlinux-init) --start-group $(vmlinux-main) --end-group \
+ $(filter-out $(vmlinux-init) $(vmlinux-main) $(vmlinux-lds) FORCE ,$^)
+define rule_vmlinux-modpost
+ :
+ +$(call cmd,vmlinux-modpost)
+ $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost $@
+ $(Q)echo 'cmd_$@ := $(cmd_vmlinux-modpost)' > $(dot-target).cmd
+endef
+
# vmlinux image - including updated kernel symbols
-vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCE
+vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) vmlinux.o FORCE
ifdef CONFIG_HEADERS_CHECK
$(Q)$(MAKE) -f $(srctree)/Makefile headers_check
endif
+ $(call vmlinux-modpost)
$(call if_changed_rule,vmlinux__)
- $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost $@
$(Q)rm -f .old_version
+vmlinux.o: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) $(kallsyms.o) FORCE
+ $(call if_changed_rule,vmlinux-modpost)
+
# The actual objects are generated when descending,
# make sure no implicit rule kicks in
$(sort $(vmlinux-init) $(vmlinux-main)) $(vmlinux-lds): $(vmlinux-dirs) ;
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index d5bbbcc..c6fcc59 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -70,10 +70,10 @@ __modpost: $(modules:.ko=.o) FORCE
$(call cmd,modpost) $(wildcard vmlinux) $(filter-out FORCE,$^)
quiet_cmd_kernel-mod = MODPOST $@
- cmd_kernel-mod = $(cmd_modpost) $(KBUILD_VMLINUX_OBJS)
+ cmd_kernel-mod = $(cmd_modpost) $@
PHONY += vmlinux
-vmlinux: FORCE
+vmlinux.o: FORCE
$(call cmd,kernel-mod)
# Declare generated files as targets for modpost
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index bb895b1..ec036c2 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -75,7 +75,8 @@ static int is_vmlinux(const char *modname)
else
myname = modname;
- return strcmp(myname, "vmlinux") == 0;
+ return (strcmp(myname, "vmlinux") == 0) ||
+ (strcmp(myname, "vmlinux.o") == 0);
}
void *do_nofail(void *ptr, const char *expr)
--
1.5.0.6
next prev parent reply other threads:[~2007-07-17 14:14 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-17 14:08 [PATCH 01/33] kbuild: asm-offsets.h is now cleaned with O=.. builds Sam Ravnborg
2007-07-17 14:08 ` [PATCH 02/33] kbuild: New 'cc-fullversion' macro Sam Ravnborg
2007-07-17 14:08 ` [PATCH 03/33] powerpc: Refuse to build 64-bit with GCC-4.2.0 and CONFIG_MODULES Sam Ravnborg
2007-07-17 14:08 ` [PATCH 04/33] kbuild: document cc-fullversion Sam Ravnborg
2007-07-17 14:08 ` [PATCH 05/33] kbuild: avoid environment to set variables used by kbuild Sam Ravnborg
[not found] ` <11846813432072-git-send-email-sam@ravnborg.org>
2007-07-17 14:08 ` [PATCH 07/33] kconfig: use POSIX equality test in check-lxdialog.sh Sam Ravnborg
2007-07-17 14:08 ` [PATCH 08/33] kbuild: add support for reading stdin with gen_init_cpio Sam Ravnborg
2007-07-17 14:08 ` [PATCH 09/33] kbuild: add support for squashing uid/gid in gen_initramfs_list.sh Sam Ravnborg
2007-07-17 14:08 ` [PATCH 10/33] kconfig: fix update-po-config Sam Ravnborg
2007-07-17 14:08 ` [PATCH 11/33] kbuild: make better section mismatch reports on i386 and mips Sam Ravnborg
2007-07-17 14:08 ` [PATCH 12/33] kbuild: make better section mismatch reports on arm Sam Ravnborg
2007-07-17 14:08 ` [PATCH 13/33] kbuild: suppress modpost warnings for references from the .toc section as used by powerpc Sam Ravnborg
2007-07-17 14:08 ` [PATCH 14/33] kbuild: .paravirtprobe section is obsolete, so modpost doesn't need to handle it Sam Ravnborg
2007-07-17 14:08 ` [PATCH 15/33] kbuild: ignore section mismatch warnings originating from .note section Sam Ravnborg
2007-07-17 14:08 ` [PATCH 16/33] kbuild: refactor code in modpost to improve maintainability Sam Ravnborg
2007-07-17 14:08 ` [PATCH 17/33] kbuild: consolidate section checks Sam Ravnborg
2007-07-17 14:08 ` [PATCH 18/33] kbuild: warn about references from .init.text to .exit.text Sam Ravnborg
2007-07-17 14:08 ` [PATCH 19/33] kbuild: remove hardcoded apic_es7000 from modpost Sam Ravnborg
2007-07-17 14:08 ` [PATCH 20/33] kbuild: remove hardcoded _logo names " Sam Ravnborg
2007-07-17 14:08 ` [PATCH 21/33] kbuild: whitelist references from variables named _timer to .init.text Sam Ravnborg
2007-07-17 14:08 ` Sam Ravnborg [this message]
2007-07-17 14:08 ` [PATCH 23/33] modpost white list pattern adjustment Sam Ravnborg
2007-07-17 14:08 ` [PATCH 24/33] Whitelist references from __dbe_table to .init Sam Ravnborg
2007-07-17 14:08 ` [PATCH 25/33] kbuild: use POSIX BRE in headers install target Sam Ravnborg
2007-07-17 14:08 ` [PATCH 26/33] kconfig: strip 'CONFIG_' automatically in kernel configuration search Sam Ravnborg
[not found] ` <11846813443988-git-send-email-sam@ravnborg.org>
2007-07-17 14:08 ` [PATCH 28/33] kconfig: reset generated values only if Kconfig and .config agree Sam Ravnborg
2007-07-17 14:08 ` [PATCH 29/33] kbuild: use -fno-optimize-sibling-calls unconditionally Sam Ravnborg
2007-07-17 14:08 ` [PATCH 30/33] kallsyms: remove usage of memmem and _GNU_SOURCE from scripts/kallsyms.c Sam Ravnborg
2007-07-17 14:09 ` [PATCH 31/33] cris: use DATA_DATA in cris Sam Ravnborg
2007-07-17 14:09 ` [PATCH 32/33] powerpc: add missing DATA_DATA to powerpc Sam Ravnborg
2007-07-17 14:09 ` [PATCH 33/33] xtensa: use DATA_DATA in xtensa Sam Ravnborg
2007-07-21 8:22 ` [PATCH 25/33] kbuild: use POSIX BRE in headers install target Oleg Verych
2007-07-21 8:23 ` Andreas Schwab
2007-07-21 8:39 ` Jan Engelhardt
2007-07-21 9:03 ` Andreas Schwab
2007-07-21 9:43 ` Oleg Verych
2007-07-21 8:27 ` [kbuild-devel] " Mike Frysinger
2007-07-21 10:04 ` Oleg Verych
2007-07-21 19:21 ` Mike Frysinger
2007-07-21 20:39 ` Sam Ravnborg
2007-07-21 22:03 ` Mike Frysinger
2007-07-21 22:11 ` Sam Ravnborg
2007-07-21 22:12 ` Mike Frysinger
2007-07-21 22:15 ` Robert P. J. Day
2007-07-21 22:16 ` More effective processing (Re: [PATCH 25/33] kbuild: use POSIX BRE in headers install target) Oleg Verych
2007-07-21 22:13 ` Sam Ravnborg
2007-07-21 22:39 ` Oleg Verych
2007-07-21 22:15 ` Mike Frysinger
2007-07-18 10:03 ` [PATCH 03/33] powerpc: Refuse to build 64-bit with GCC-4.2.0 and CONFIG_MODULES Clemens Koller
2007-07-19 15:55 ` Segher Boessenkool
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11846813442810-git-send-email-sam@ravnborg.org \
--to=sam@ravnborg.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox