From: Russell King <rmk+lkml@arm.linux.org.uk>
To: Linux Kernel List <linux-kernel@vger.kernel.org>,
Rusty Russell <rusty@rustcorp.com.au>,
Sam Ravnborg <sam@ravnborg.org>,
Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>
Subject: [PATCH] Fix ARM kernel build with permitted binutils versions
Date: Wed, 20 Oct 2004 12:38:53 +0100 [thread overview]
Message-ID: <20041020123853.A14627@flint.arm.linux.org.uk> (raw)
In-Reply-To: <20040927210305.A26680@flint.arm.linux.org.uk>; from rmk+lkml@arm.linux.org.uk on Mon, Sep 27, 2004 at 09:03:05PM +0100
Ok, here's the latest version of the patch, fixing all presently known
issues with ARM binutils post 2.11.90 by changing the kernel to suit.
Yes, it sounds like the wrong thing to do, but shrug.
---
All ARM binutils versions post 2.11.90 contains an extra "feature" which
interferes with the kernel in various ways - extra "mapping symbols"
in the ELF symbol table '$a', '$t' and '$d'. This causes two problems:
1. Since '$a' symbols have the same value as function names, this
causes anything which uses the kallsyms infrastructure to report
wrong values.
2. programs which parse System.map do not expect symbols to start with
'$'.
Signed-off-by: Russell King <rmk@arm.linux.org.uk>
===== kernel/module.c 1.120 vs edited =====
--- 1.120/kernel/module.c 2004-09-08 07:33:04 +01:00
+++ edited/kernel/module.c 2004-10-08 16:34:19 +01:00
@@ -1903,6 +1903,16 @@
}
#ifdef CONFIG_KALLSYMS
+/*
+ * This ignores the intensely annoying "mapping symbols" found
+ * in ARM ELF files: $a, $t and $d.
+ */
+static inline int is_arm_mapping_symbol(const char *str)
+{
+ return str[0] == '$' && strchr("atd", str[1])
+ && (str[2] == '\0' || str[2] == '.');
+}
+
static const char *get_ksymbol(struct module *mod,
unsigned long addr,
unsigned long *size,
@@ -1927,11 +1937,13 @@
* and inserted at a whim. */
if (mod->symtab[i].st_value <= addr
&& mod->symtab[i].st_value > mod->symtab[best].st_value
- && *(mod->strtab + mod->symtab[i].st_name) != '\0' )
+ && *(mod->strtab + mod->symtab[i].st_name) != '\0'
+ && !is_arm_mapping_symbol(mod->strtab + mod->symtab[i].st_name))
best = i;
if (mod->symtab[i].st_value > addr
&& mod->symtab[i].st_value < nextval
- && *(mod->strtab + mod->symtab[i].st_name) != '\0')
+ && *(mod->strtab + mod->symtab[i].st_name) != '\0'
+ && !is_arm_mapping_symbol(mod->strtab + mod->symtab[i].st_name))
nextval = mod->symtab[i].st_value;
}
===== scripts/kallsyms.c 1.12 vs edited =====
--- 1.12/scripts/kallsyms.c 2004-07-11 10:23:27 +01:00
+++ edited/scripts/kallsyms.c 2004-10-08 16:34:20 +01:00
@@ -32,6 +32,17 @@
exit(1);
}
+/*
+ * This ignores the intensely annoying "mapping symbols" found
+ * in ARM ELF files: $a, $t and $d.
+ */
+static inline int
+is_arm_mapping_symbol(const char *str)
+{
+ return str[0] == '$' && strchr("atd", str[1])
+ && (str[2] == '\0' || str[2] == '.');
+}
+
static int
read_symbol(FILE *in, struct sym_entry *s)
{
@@ -56,7 +67,8 @@
_sinittext = s->addr;
else if (strcmp(str, "_einittext") == 0)
_einittext = s->addr;
- else if (toupper(s->type) == 'A' || toupper(s->type) == 'U')
+ else if (toupper(s->type) == 'A' || toupper(s->type) == 'U' ||
+ is_arm_mapping_symbol(str))
return -1;
s->sym = strdup(str);
===== scripts/mksysmap 1.4 vs edited =====
--- 1.4/scripts/mksysmap 2004-08-18 22:05:12 +01:00
+++ edited/scripts/mksysmap 2004-10-08 16:39:39 +01:00
@@ -40,5 +40,5 @@
# so we just ignore them to let readprofile continue to work.
# (At least sparc64 has __crc_ in the middle).
-$NM -n $1 | grep -v '\( [aUw] \)\|\(__crc_\)' > $2
+$NM -n $1 | grep -v '\( [aUw] \)\|\(__crc_\)\|\( \$[adt]\)' > $2
--
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-10-20 11:44 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-27 20:03 [RFC] ARM binutils feature churn causing kernel problems Russell King
2004-09-27 20:17 ` Christoph Hellwig
2004-09-27 20:35 ` Russell King
2004-09-27 20:37 ` Nicolas Pitre
2004-10-01 20:11 ` Russell King
2004-10-04 12:01 ` Catalin Marinas
2004-10-04 23:18 ` Rusty Russell
2004-10-05 11:10 ` Richard Earnshaw
2004-10-05 11:53 ` Russell King
2004-10-05 12:57 ` Richard Earnshaw
2004-10-05 13:14 ` Russell King
2004-10-05 13:40 ` Richard Earnshaw
2004-10-05 13:51 ` Russell King
2004-10-06 10:08 ` Adrian Cox
2004-10-07 15:02 ` Russell King
2004-10-12 13:15 ` Richard Earnshaw
2004-10-07 14:54 ` Russell King
2004-10-05 23:00 ` Rusty Russell
2004-10-07 12:35 ` Paulo Marques
2004-10-07 15:01 ` Russell King
2004-10-07 16:39 ` Paulo Marques
2004-10-05 13:02 ` Richard Earnshaw
2004-10-08 15:04 ` Russell King
2004-10-08 16:36 ` Paulo Marques
2004-10-08 18:14 ` Albert Cahalan
2004-10-08 19:43 ` Paulo Marques
2004-10-20 11:38 ` Russell King [this message]
2004-10-26 22:37 ` [PATCH] Fix ARM kernel build with permitted binutils versions Sam Ravnborg
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=20041020123853.A14627@flint.arm.linux.org.uk \
--to=rmk+lkml@arm.linux.org.uk \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=sam@ravnborg.org \
--cc=torvalds@osdl.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.