2005-03-26 00:43:42

by Alexey Dobriyan

[permalink] [raw]
Subject: 2.6.12-rc1-bk1: Inconsistent kallsyms data

While building 2.6.12-rc1-bk1 with attached config I get "Inconsistent
kallsyms data".

Setting CONFIG_KALLSYMS_EXTRA_PASS or CONFIG_KALLSYMS_ALL fixes the problem.

Noted differences:

--- System.map
+++ .tmp_System.map

-c03cf83c D kallsyms_markers
-c03cf8d4 D kallsyms_token_table
-c03cfce4 D kallsyms_token_index
+c03cf804 D kallsyms_markers
+c03cf89c D kallsyms_token_table
+c03cfcb0 D kallsyms_token_index

Huge chunk of symbols in tmp_kallsyms2.S are shifted by 0x20000 wrt
tmp_kallsyms1.S (_sinittext and _einittext being among them).

--- tmp_kallsyms1.S_
+++ tmp_kallsyms2.S_

-T __sched_text_start PTR 0xc0311e9e
+T __sched_text_start PTR 0xc0311ea0

-T _sinittext PTR 0xc03b5000
+T _sinittext PTR 0xc03d5000

-T _einittext PTR 0xc03cc682
+T _einittext PTR 0xc03ec682

Gnu C 3.4.2
binutils 2.15.92.0.2
Linux C Library 2.3.4
Dynamic linker (ldd) 2.3.4


Attachments:
(No filename) (908.00 B)
config-stripped (6.12 kB)
Download all attachments

2005-03-26 08:08:19

by Sam Ravnborg

[permalink] [raw]
Subject: Re: 2.6.12-rc1-bk1: Inconsistent kallsyms data

On Sat, Mar 26, 2005 at 03:43:03AM +0300, Alexey Dobriyan wrote:
> While building 2.6.12-rc1-bk1 with attached config I get "Inconsistent
> kallsyms data".
>
> Setting CONFIG_KALLSYMS_EXTRA_PASS or CONFIG_KALLSYMS_ALL fixes the problem.

Please try attached patch. What you see may be the linker deciding to
re-shuffle some sections a bit more than usual.
Patch has been in -mm for a while.

Sam

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2005/03/14 20:56:01+01:00 [email protected]
# kbuild: Avoid inconsistent kallsyms data
#
# Several reports on inconsistent kallsyms data has been caused by the aliased symbols
# __sched_text_start and __down to shift places in the output of nm.
# The root cause was that on second pass ld aligned __sched_text_start to a 4 byte boundary
# which is the function alignment on i386.
# sched.text and spinlock.text is now aligned to an 8 byte boundary to make sure they
# are aligned to a function alignemnt on most (all?) archs.
#
# Tested by: Paulo Marques <[email protected]>
# Tested by: Alexander Stohr <[email protected]>
#
# Signed-off-by: Sam Ravnborg <[email protected]>
#
# include/asm-generic/vmlinux.lds.h
# 2005/03/14 20:55:39+01:00 [email protected] +9 -0
# Align sched.text and spinlock.text to an 8 byte boundary
#
diff -Nru a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
--- a/include/asm-generic/vmlinux.lds.h 2005-03-26 09:07:42 +01:00
+++ b/include/asm-generic/vmlinux.lds.h 2005-03-26 09:07:42 +01:00
@@ -6,6 +6,9 @@
#define VMLINUX_SYMBOL(_sym_) _sym_
#endif

+/* Align . to a 8 byte boundary equals to maximum function alignment. */
+#define ALIGN_FUNCTION() . = ALIGN(8)
+
#define RODATA \
.rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
*(.rodata) *(.rodata.*) \
@@ -79,12 +82,18 @@
VMLINUX_SYMBOL(__security_initcall_end) = .; \
}

+/* sched.text is aling to function alignment to secure we have same
+ * address even at second ld pass when generating System.map */
#define SCHED_TEXT \
+ ALIGN_FUNCTION(); \
VMLINUX_SYMBOL(__sched_text_start) = .; \
*(.sched.text) \
VMLINUX_SYMBOL(__sched_text_end) = .;

+/* spinlock.text is aling to function alignment to secure we have same
+ * address even at second ld pass when generating System.map */
#define LOCK_TEXT \
+ ALIGN_FUNCTION(); \
VMLINUX_SYMBOL(__lock_text_start) = .; \
*(.spinlock.text) \
VMLINUX_SYMBOL(__lock_text_end) = .;

2005-03-26 08:34:15

by Alexey Dobriyan

[permalink] [raw]
Subject: Re: 2.6.12-rc1-bk1: Inconsistent kallsyms data

On Saturday 26 March 2005 11:09, Sam Ravnborg wrote:
> On Sat, Mar 26, 2005 at 03:43:03AM +0300, Alexey Dobriyan wrote:
> > While building 2.6.12-rc1-bk1 with attached config I get "Inconsistent
> > kallsyms data".
> >
> > Setting CONFIG_KALLSYMS_EXTRA_PASS or CONFIG_KALLSYMS_ALL fixes the
> > problem.
>
> Please try attached patch.

Thanks, Sam. It works.

> What you see may be the linker deciding to re-shuffle some sections a bit
> more than usual.
> Patch has been in -mm for a while.

Oh, that's why -mm3 was ok. :-)

> # ChangeSet
> # 2005/03/14 20:56:01+01:00 [email protected]
> # kbuild: Avoid inconsistent kallsyms data

> # Tested by: Paulo Marques <[email protected]>
> # Tested by: Alexander Stohr <[email protected]>

Tested-by: Alexey Dobriyan <[email protected]>