aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mod
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/mod')
-rw-r--r--scripts/mod/file2alias.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 25f6f5970552..1924990a737f 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -42,7 +42,7 @@ typedef unsigned char __u8;
42 42
43/* This array collects all instances that use the generic do_table */ 43/* This array collects all instances that use the generic do_table */
44struct devtable { 44struct devtable {
45 const char *device_id; /* name of table, __mod_<name>_device_table. */ 45 const char *device_id; /* name of table, __mod_<name>__*_device_table. */
46 unsigned long id_size; 46 unsigned long id_size;
47 void *function; 47 void *function;
48}; 48};
@@ -146,7 +146,8 @@ static void device_id_check(const char *modname, const char *device_id,
146 146
147 if (size % id_size || size < id_size) { 147 if (size % id_size || size < id_size) {
148 fatal("%s: sizeof(struct %s_device_id)=%lu is not a modulo " 148 fatal("%s: sizeof(struct %s_device_id)=%lu is not a modulo "
149 "of the size of section __mod_%s_device_table=%lu.\n" 149 "of the size of "
150 "section __mod_%s__<identifier>_device_table=%lu.\n"
150 "Fix definition of struct %s_device_id " 151 "Fix definition of struct %s_device_id "
151 "in mod_devicetable.h\n", 152 "in mod_devicetable.h\n",
152 modname, device_id, id_size, device_id, size, device_id); 153 modname, device_id, id_size, device_id, size, device_id);
@@ -1216,7 +1217,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
1216{ 1217{
1217 void *symval; 1218 void *symval;
1218 char *zeros = NULL; 1219 char *zeros = NULL;
1219 const char *name; 1220 const char *name, *identifier;
1220 unsigned int namelen; 1221 unsigned int namelen;
1221 1222
1222 /* We're looking for a section relative symbol */ 1223 /* We're looking for a section relative symbol */
@@ -1227,7 +1228,7 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
1227 if (ELF_ST_TYPE(sym->st_info) != STT_OBJECT) 1228 if (ELF_ST_TYPE(sym->st_info) != STT_OBJECT)
1228 return; 1229 return;
1229 1230
1230 /* All our symbols are of form <prefix>__mod_XXX_device_table. */ 1231 /* All our symbols are of form <prefix>__mod_<name>__<identifier>_device_table. */
1231 name = strstr(symname, "__mod_"); 1232 name = strstr(symname, "__mod_");
1232 if (!name) 1233 if (!name)
1233 return; 1234 return;
@@ -1237,7 +1238,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
1237 return; 1238 return;
1238 if (strcmp(name + namelen - strlen("_device_table"), "_device_table")) 1239 if (strcmp(name + namelen - strlen("_device_table"), "_device_table"))
1239 return; 1240 return;
1240 namelen -= strlen("_device_table"); 1241 identifier = strstr(name, "__");
1242 if (!identifier)
1243 return;
1244 namelen = identifier - name;
1241 1245
1242 /* Handle all-NULL symbols allocated into .bss */ 1246 /* Handle all-NULL symbols allocated into .bss */
1243 if (info->sechdrs[get_secindex(info, sym)].sh_type & SHT_NOBITS) { 1247 if (info->sechdrs[get_secindex(info, sym)].sh_type & SHT_NOBITS) {