Re: [RFC] ARM binutils feature churn causing kernel problems

From: Russell King
Date: Fri Oct 01 2004 - 15:23:53 EST


On Mon, Sep 27, 2004 at 09:03:05PM +0100, Russell King wrote:
> [<address>] ($a+0xfoo/0xbar) from [<address>] ($a+0xfoo/0xbar)

Ok, here's a _partly_ tested patch which fixes kallsyms itself. I'm
not certain whether this fixes the module side of it since I haven't
had an oops from a module to confirm yet.

Comments at this stage only please?

===== 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-01 20:39:43 +01:00
@@ -1903,6 +1903,15 @@
}

#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';
+}
+
static const char *get_ksymbol(struct module *mod,
unsigned long addr,
unsigned long *size,
@@ -1927,11 +1936,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-01 20:41:43 +01:00
@@ -32,6 +32,16 @@
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';
+}
+
static int
read_symbol(FILE *in, struct sym_entry *s)
{
@@ -56,7 +66,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);


--
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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/