From: Russell King <rmk+lkml@arm.linux.org.uk>
To: Martin Schlemmer <azarah@nosferatu.za.org>,
Tom Rini <trini@kernel.crashing.org>,
Linux Kernel List <linux-kernel@vger.kernel.org>,
Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>
Subject: Re: binutils woes
Date: Thu, 1 Jul 2004 23:12:56 +0100 [thread overview]
Message-ID: <20040701231256.G8389@flint.arm.linux.org.uk> (raw)
In-Reply-To: <20040701205255.F8389@flint.arm.linux.org.uk>; from rmk+lkml@arm.linux.org.uk on Thu, Jul 01, 2004 at 08:52:55PM +0100
On Thu, Jul 01, 2004 at 08:52:55PM +0100, Russell King wrote:
> Therefore, unless anyone has any objections, I shall be cooking up
> a patch which adds an extra pass to any final object link for the
> kernel build system.
Ok, I decided that touching the rules used for the boot loader(s) was
probably going to be too fraught, so here's one which just checks the
final link for the main kernel image.
Essentially, we run 'nm' against the object, and look for any line
which matches the pattern '^ *U '. With this, a failing output looks
like:
LD init/built-in.o
LD .tmp_vmlinux1
ldchk: .tmp_vmlinux1: final image has undefined symbols:
SIZEOF_MACHINE_DESC
make[1]: *** [.tmp_vmlinux1] Error 1
make: *** [vmlinux] Error 2
and successful output:
LD init/built-in.o
LD .tmp_vmlinux1
KSYM .tmp_kallsyms1.S
AS .tmp_kallsyms1.o
LD .tmp_vmlinux2
KSYM .tmp_kallsyms2.S
AS .tmp_kallsyms2.o
LD vmlinux
===== Makefile 1.500 vs edited =====
--- 1.500/Makefile Tue Jun 29 15:44:49 2004
+++ edited/Makefile Thu Jul 1 23:10:04 2004
@@ -533,6 +533,8 @@
endef
# set -e makes the rule exit immediately on error
+# Note: Ensure that there are no undefined symbols in the final
+# linked image. Not doing this can lead to silent link failures.
define rule_vmlinux__
+set -e; \
@@ -545,6 +547,12 @@
$(if $($(quiet)cmd_vmlinux__), \
echo ' $($(quiet)cmd_vmlinux__)' &&) \
$(cmd_vmlinux__); \
+ if $(NM) $@ | grep -q '^ *U '; then \
+ echo 'ldchk: $@: final image has undefined symbols:'; \
+ $(NM) $@ | sed 's/^ *U \(.*\)/ \1/p;d'; \
+ $(RM) -f $@; \
+ exit 1; \
+ fi; \
echo 'cmd_$@ := $(cmd_vmlinux__)' > $(@D)/.$(@F).cmd
endef
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 PCMCIA - http://pcmcia.arm.linux.org.uk/
2.6 Serial core
next prev parent reply other threads:[~2004-07-01 22:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-07-01 16:52 binutils woes Russell King
2004-07-01 17:47 ` Tom Rini
2004-07-01 18:07 ` Russell King
2004-07-01 19:44 ` Martin Schlemmer
2004-07-01 19:52 ` Russell King
2004-07-01 22:12 ` Russell King [this message]
2004-07-01 22:21 ` Andrew Morton
2004-07-01 22:22 ` Russell King
2004-07-02 10:56 ` Michael Buesch
2004-07-11 11:32 ` Russell King
2004-07-11 13:56 ` Russell King
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=20040701231256.G8389@flint.arm.linux.org.uk \
--to=rmk+lkml@arm.linux.org.uk \
--cc=akpm@osdl.org \
--cc=azarah@nosferatu.za.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
--cc=trini@kernel.crashing.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