summaryrefslogtreecommitdiffstats
path: root/scripts/mod
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/mod')
-rw-r--r--scripts/mod/file2alias.c22
-rw-r--r--scripts/mod/modpost.c39
2 files changed, 52 insertions, 9 deletions
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index f61c9ccef6a..b2f73ffb40b 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -452,6 +452,24 @@ static int do_eisa_entry(const char *filename, struct eisa_device_id *eisa,
return 1;
}
+/* Looks like: parisc:tNhvNrevNsvN */
+static int do_parisc_entry(const char *filename, struct parisc_device_id *id,
+ char *alias)
+{
+ id->hw_type = TO_NATIVE(id->hw_type);
+ id->hversion = TO_NATIVE(id->hversion);
+ id->hversion_rev = TO_NATIVE(id->hversion_rev);
+ id->sversion = TO_NATIVE(id->sversion);
+
+ strcpy(alias, "parisc:");
+ ADD(alias, "t", id->hw_type != PA_HWTYPE_ANY_ID, id->hw_type);
+ ADD(alias, "hv", id->hversion != PA_HVERSION_ANY_ID, id->hversion);
+ ADD(alias, "rev", id->hversion_rev != PA_HVERSION_REV_ANY_ID, id->hversion_rev);
+ ADD(alias, "sv", id->sversion != PA_SVERSION_ANY_ID, id->sversion);
+
+ return 1;
+}
+
/* Ignore any prefix, eg. v850 prepends _ */
static inline int sym_is(const char *symbol, const char *name)
{
@@ -559,6 +577,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
do_table(symval, sym->st_size,
sizeof(struct eisa_device_id), "eisa",
do_eisa_entry, mod);
+ else if (sym_is(symname, "__mod_parisc_device_table"))
+ do_table(symval, sym->st_size,
+ sizeof(struct parisc_device_id), "parisc",
+ do_parisc_entry, mod);
}
/* Now add out buffered information to the generated C source */
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 569e68410d7..65bdfdb5687 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -686,6 +686,30 @@ static Elf_Sym *find_elf_symbol(struct elf_info *elf, Elf_Addr addr,
return NULL;
}
+static inline int is_arm_mapping_symbol(const char *str)
+{
+ return str[0] == '$' && strchr("atd", str[1])
+ && (str[2] == '\0' || str[2] == '.');
+}
+
+/*
+ * If there's no name there, ignore it; likewise, ignore it if it's
+ * one of the magic symbols emitted used by current ARM tools.
+ *
+ * Otherwise if find_symbols_between() returns those symbols, they'll
+ * fail the whitelist tests and cause lots of false alarms ... fixable
+ * only by merging __exit and __init sections into __text, bloating
+ * the kernel (which is especially evil on embedded platforms).
+ */
+static inline int is_valid_name(struct elf_info *elf, Elf_Sym *sym)
+{
+ const char *name = elf->strtab + sym->st_name;
+
+ if (!name || !strlen(name))
+ return 0;
+ return !is_arm_mapping_symbol(name);
+}
+
/*
* Find symbols before or equal addr and after addr - in the section sec.
* If we find two symbols with equal offset prefer one with a valid name.
@@ -714,16 +738,15 @@ static void find_symbols_between(struct elf_info *elf, Elf_Addr addr,
symsec = secstrings + elf->sechdrs[sym->st_shndx].sh_name;
if (strcmp(symsec, sec) != 0)
continue;
+ if (!is_valid_name(elf, sym))
+ continue;
if (sym->st_value <= addr) {
if ((addr - sym->st_value) < beforediff) {
beforediff = addr - sym->st_value;
*before = sym;
}
else if ((addr - sym->st_value) == beforediff) {
- /* equal offset, valid name? */
- const char *name = elf->strtab + sym->st_name;
- if (name && strlen(name))
- *before = sym;
+ *before = sym;
}
}
else
@@ -733,10 +756,7 @@ static void find_symbols_between(struct elf_info *elf, Elf_Addr addr,
*after = sym;
}
else if ((sym->st_value - addr) == afterdiff) {
- /* equal offset, valid name? */
- const char *name = elf->strtab + sym->st_name;
- if (name && strlen(name))
- *after = sym;
+ *after = sym;
}
}
}
@@ -941,7 +961,7 @@ static int init_section_ref_ok(const char *name)
".opd", /* see comment [OPD] at exit_section_ref_ok() */
".toc1", /* used by ppc64 */
".stab",
- ".rodata",
+ ".data.rel.ro", /* used by parisc64 */
".parainstructions",
".text.lock",
"__bug_table", /* used by powerpc for BUG() */
@@ -964,6 +984,7 @@ static int init_section_ref_ok(const char *name)
".eh_frame",
".debug",
".parainstructions",
+ ".rodata",
NULL
};
/* part of section name */