summaryrefslogtreecommitdiff
path: root/scripts/modpost.c
diff options
context:
space:
mode:
authorKai Germaschewski <kai@tp1.ruhr-uni-bochum.de>2003-02-19 01:16:36 -0600
committerKai Germaschewski <kai@tp1.ruhr-uni-bochum.de>2003-02-19 01:16:36 -0600
commit3194de9cf7a9207db7552aaae74564e64806a01b (patch)
treef2340cfb33779761d2038381e75c1c5da365efa3 /scripts/modpost.c
parent939ff4992fd06928220e3073e7c99b05359be1f4 (diff)
kbuild: Handle MODULE_SYMBOL_PREFIX in module postprocessing
Loosely based on a patch by Miles Bader, have modpost deal with weird archs (v850) which prefix their symbols with '_'. Modpost does not yet handle ppc64 "prefix function symbols with '.'" correctly, btw.
Diffstat (limited to 'scripts/modpost.c')
-rw-r--r--scripts/modpost.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/scripts/modpost.c b/scripts/modpost.c
index 976d39387ae0..ba4984c57b50 100644
--- a/scripts/modpost.c
+++ b/scripts/modpost.c
@@ -265,6 +265,9 @@ parse_elf_finish(struct elf_info *info)
munmap(info->hdr, info->size);
}
+#define CRC_PFX MODULE_SYMBOL_PREFIX "__crc_"
+#define KSYMTAB_PFX MODULE_SYMBOL_PREFIX "__ksymtab_"
+
void
handle_modversions(struct module *mod, struct elf_info *info,
Elf_Sym *sym, const char *symname)
@@ -279,9 +282,10 @@ handle_modversions(struct module *mod, struct elf_info *info,
break;
case SHN_ABS:
/* CRC'd symbol */
- if (memcmp(symname, "__crc_", 6) == 0) {
+ if (memcmp(symname, CRC_PFX, strlen(CRC_PFX)) == 0) {
crc = (unsigned int) sym->st_value;
- add_exported_symbol(symname+6, mod, &crc);
+ add_exported_symbol(symname + strlen(CRC_PFX),
+ mod, &crc);
modversions = 1;
}
break;
@@ -290,15 +294,20 @@ handle_modversions(struct module *mod, struct elf_info *info,
if (ELF_ST_BIND(sym->st_info) != STB_GLOBAL)
break;
- s = alloc_symbol(symname);
- /* add to list */
- s->next = mod->unres;
- mod->unres = s;
+ if (memcmp(symname, MODULE_SYMBOL_PREFIX,
+ strlen(MODULE_SYMBOL_PREFIX)) == 0) {
+ s = alloc_symbol(symname +
+ strlen(MODULE_SYMBOL_PREFIX));
+ /* add to list */
+ s->next = mod->unres;
+ mod->unres = s;
+ }
break;
default:
/* All exported symbols */
- if (memcmp(symname, "__ksymtab_", 10) == 0) {
- add_exported_symbol(symname+10, mod, NULL);
+ if (memcmp(symname, KSYMTAB_PFX, strlen(KSYMTAB_PFX)) == 0) {
+ add_exported_symbol(symname + strlen(KSYMTAB_PFX),
+ mod, NULL);
}
break;
}