mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Randy.Dunlap" <rddunlap@osdl.org>
To: lkml <linux-kernel@vger.kernel.org>
Cc: zwane@linuxpower.ca, rusty@rustcorp.com.au
Subject: [PATCH*] show last kernel-image symbol in /proc/kallsyms
Date: Sun, 9 May 2004 17:14:52 -0700	[thread overview]
Message-ID: <20040509171452.09ee1ca0.rddunlap@osdl.org> (raw)


'cat' or 'tail' of /proc/kallsyms (2.6.6-rc2 or -rc3, & probably much
earlier) does not include the last kernel-image symbol (_einittext).

_einittext is the last symbol generated in .tmp_kallsyms2.S
and the symbol count in that file also appears to be correct,
but the iterator code for /proc/kallsyms comes up 1 short somehow.

Here are 2 patches.  Either one of them "fixes" the problem.
Neither of them is the correct fix AFAIK.
Any other suggestions for fixes?

Thanks,
--
~Randy



// linux-266-rc3
// print the last (kernel image) symbol of /proc/kallsyms
// by making the valid symbol count 1 larger than symbols found;

diffstat:=
 scripts/kallsyms.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


diff -Naurp ./scripts/kallsyms.c~incr_count ./scripts/kallsyms.c
--- ./scripts/kallsyms.c~incr_count	2004-04-03 19:38:23.000000000 -0800
+++ ./scripts/kallsyms.c	2004-05-09 16:33:07.000000000 -0700
@@ -127,7 +127,7 @@ write_src(void)
 	printf(".globl kallsyms_num_syms\n");
 	printf("\tALGN\n");
 	printf("kallsyms_num_syms:\n");
-	printf("\tPTR\t%d\n", valid);
+	printf("\tPTR\t%d\n", valid + 1);
 	printf("\n");
 
 	printf(".globl kallsyms_names\n");



// linux-266-rc3
// print the last (kernel image) symbol of /proc/kallsyms
// by using '>' instead of '>=' in the limiting test
// of the iterator.

diffstat:=
 kernel/kallsyms.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


diff -Naurp ./kernel/kallsyms.c~use_gtr_not_geq ./kernel/kallsyms.c
--- ./kernel/kallsyms.c~use_gtr_not_geq	2004-04-03 19:38:21.000000000 -0800
+++ ./kernel/kallsyms.c	2004-05-09 16:00:11.000000000 -0700
@@ -199,7 +199,7 @@ static void reset_iter(struct kallsym_it
 static int update_iter(struct kallsym_iter *iter, loff_t pos)
 {
 	/* Module symbols can be accessed randomly. */
-	if (pos >= kallsyms_num_syms) {
+	if (pos > kallsyms_num_syms) {
 		iter->pos = pos;
 		return get_ksymbol_mod(iter);
 	}

             reply	other threads:[~2004-05-10  0:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-10  0:14 Randy.Dunlap [this message]
2004-05-10  4:14 ` Rusty Russell
2004-05-10 17:56   ` Randy.Dunlap
2004-05-10 23:24     ` Randy.Dunlap
2004-05-11  2:50       ` Rusty Russell

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=20040509171452.09ee1ca0.rddunlap@osdl.org \
    --to=rddunlap@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --cc=zwane@linuxpower.ca \
    /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

all inboxes | Powered by JetHome®