Re: 2.6.7-mm6

Andrew Morton
2004-07-06T22:31:14Z

William Lee Irwin III <wli@holomorphy.com> wrote:
>
> Third, some naive check for undefined symbols failed to understand the
> relocation types indicating that a given operand refers to some hard
> register, which manifest as undefined symbols in ELF executables. A
> patch to refine its criteria, which I used to build with, follows. rmk
> and hpa have some other ideas on this undefined symbol issue I've not
> quite had the opportunity to get a clear statement of yet.

I converted that to a non-fatal warning due to the same problem on sparc64.

Here's the current patch against -linus. I think I'll drop it. Could you
please work with rmk to come up with a final version?

diff -puN Makefile~check-for-undefined-symbols Makefile
--- 25/Makefile~check-for-undefined-symbols Tue Jul 6 14:41:49 2004
+++ 25-akpm/Makefile Tue Jul 6 15:33:15 2004
@@ -586,6 +586,15 @@ define rule_verify_kallsyms
(echo Inconsistent kallsyms data, try setting CONFIG_KALLSYMS_EXTRA_PASS ; rm .tmp_kallsyms* ; false)
endef

+# Warn if there are undefined symbols in the final linked image. They can lead
+# to silent link failures.
+define rule_check_vmlinux
+ if $(NM) $@ | grep -q '^ *U '; then \
+ echo 'ldchk: $@: final image has undefined symbols:'; \
+ $(NM) $@ | sed 's/^ *U \(.*\)/ \1/p;d'; \
+ fi;
+endef
+
quiet_cmd_kallsyms = KSYM $@
cmd_kallsyms = $(NM) -n $< | $(KALLSYMS) $(foreach x,$(CONFIG_KALLSYMS_ALL),--all-symbols) > $@

@@ -612,6 +621,7 @@ define rule_vmlinux
$(rule_vmlinux__); \
$(call do_system_map, $@, System.map)
$(rule_verify_kallsyms)
+ $(rule_check_vmlinux)
endef

vmlinux: $(vmlinux-objs) $(kallsyms.o) arch/$(ARCH)/kernel/vmlinux.lds.s FORCE
_