From: Rusty Russell <rusty@rustcorp.com.au>
To: "Randy.Dunlap" <rddunlap@osdl.org>
Cc: lkml - Kernel Mailing List <linux-kernel@vger.kernel.org>,
akpm <akpm@osdl.org>, Zwane Mwaikambo <zwane@linuxpower.ca>,
Sam Ravnborg <sam@ravnborg.org>
Subject: Re: [PATCH*] show last kernel-image symbol in /proc/kallsyms
Date: Tue, 11 May 2004 12:50:07 +1000 [thread overview]
Message-ID: <1084243805.31807.280.camel@bach> (raw)
In-Reply-To: <20040510162413.6db2d60e.rddunlap@osdl.org>
On Tue, 2004-05-11 at 09:24, Randy.Dunlap wrote:
> On Mon, 10 May 2004 10:56:06 -0700 Randy.Dunlap wrote:
> | And thanks for taking time to fix it.
> | It now works as expected. :)
>
> Welllll, almost as expected. I now see _einittext as hoped and
> expected. However, sometimes I don't see _etext... if it has the
> same address as another (previous) symbol, which it can.
I've been reconsidering this optimization anyway: there are only a few
symbols which are aliases for other symbols.
How's this?
Rusty.
Name: Include Aliases in kallsyms
Status: Booted on 2.6.6-mm1
Version: -mm
Kallsyms discards symbols with the same address, but these are
sometimes useful. Skip this minor optimization and make
kallsyms_lookup deal with aliases
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .31104-linux-2.6.6-mm1/kernel/kallsyms.c .31104-linux-2.6.6-mm1.updated/kernel/kallsyms.c
--- .31104-linux-2.6.6-mm1/kernel/kallsyms.c 2004-03-12 07:57:28.000000000 +1100
+++ .31104-linux-2.6.6-mm1.updated/kernel/kallsyms.c 2004-05-11 10:42:52.000000000 +1000
@@ -88,14 +88,20 @@ const char *kallsyms_lookup(unsigned lon
name += strlen(name) + 1;
}
- /* Base symbol size on next symbol. */
- if (best + 1 < kallsyms_num_syms)
- symbol_end = kallsyms_addresses[best + 1];
- else if (is_kernel_inittext(addr))
+ /* At worst, symbol ends at end of section. */
+ if (is_kernel_inittext(addr))
symbol_end = (unsigned long)_einittext;
else
symbol_end = (unsigned long)_etext;
+ /* Search for next non-aliased symbol */
+ for (i = best+1; i < kallsyms_num_syms; i++) {
+ if (kallsyms_addresses[i] > kallsyms_addresses[best]) {
+ symbol_end = kallsyms_addresses[i];
+ break;
+ }
+ }
+
*symbolsize = symbol_end - kallsyms_addresses[best];
*modname = NULL;
*offset = addr - kallsyms_addresses[best];
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .31104-linux-2.6.6-mm1/scripts/kallsyms.c .31104-linux-2.6.6-mm1.updated/scripts/kallsyms.c
--- .31104-linux-2.6.6-mm1/scripts/kallsyms.c 2003-09-22 10:07:21.000000000 +1000
+++ .31104-linux-2.6.6-mm1.updated/scripts/kallsyms.c 2004-05-11 10:39:14.000000000 +1000
@@ -93,7 +93,6 @@ read_map(FILE *in)
static void
write_src(void)
{
- unsigned long long last_addr;
int i, valid = 0;
char *prev;
@@ -111,16 +110,12 @@ write_src(void)
printf(".globl kallsyms_addresses\n");
printf("\tALGN\n");
printf("kallsyms_addresses:\n");
- for (i = 0, last_addr = 0; i < cnt; i++) {
+ for (i = 0; i < cnt; i++) {
if (!symbol_valid(&table[i]))
continue;
-
- if (table[i].addr == last_addr)
- continue;
printf("\tPTR\t%#llx\n", table[i].addr);
valid++;
- last_addr = table[i].addr;
}
printf("\n");
@@ -134,20 +129,16 @@ write_src(void)
printf("\tALGN\n");
printf("kallsyms_names:\n");
prev = "";
- for (i = 0, last_addr = 0; i < cnt; i++) {
+ for (i = 0; i < cnt; i++) {
int k;
if (!symbol_valid(&table[i]))
continue;
-
- if (table[i].addr == last_addr)
- continue;
for (k = 0; table[i].sym[k] && table[i].sym[k] == prev[k]; ++k)
;
printf("\t.byte 0x%02x\n\t.asciz\t\"%s\"\n", k, table[i].sym + k);
- last_addr = table[i].addr;
prev = table[i].sym;
}
printf("\n");
--
Anyone who quotes me in their signature is an idiot -- Rusty Russell
prev parent reply other threads:[~2004-05-11 2:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-10 0:14 [PATCH*] show last kernel-image symbol in /proc/kallsyms Randy.Dunlap
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 [this message]
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=1084243805.31807.280.camel@bach \
--to=rusty@rustcorp.com.au \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rddunlap@osdl.org \
--cc=sam@ravnborg.org \
--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