diff options
author | Mark Brown <broonie@kernel.org> | 2015-03-17 21:59:05 +0000 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-03-17 21:59:05 +0000 |
commit | 43e7406efd7822d75c64310461d2cbca0ece19f0 (patch) | |
tree | 22a7e030ac75c7db2b767292c59c9a36bb810c9c /kernel/module.c | |
parent | 42f504e28a169ebfea0e3d9c6e151451800e41d5 (diff) | |
parent | 3d95e2f8f6c3666ffb3f5aee405ecc15a14ea570 (diff) |
Merge remote-tracking branch 'lsk/v3.10/topic/gcov' into linux-linaro-lsklinux-linaro-lsk-test
Conflicts:
arch/arm64/Kconfig
Diffstat (limited to 'kernel/module.c')
-rw-r--r-- | kernel/module.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/kernel/module.c b/kernel/module.c index 61fb677211cb..a6f1de876d8a 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -2725,7 +2725,7 @@ static int check_modinfo(struct module *mod, struct load_info *info, int flags) return 0; } -static void find_module_sections(struct module *mod, struct load_info *info) +static int find_module_sections(struct module *mod, struct load_info *info) { mod->kp = section_objs(info, "__param", sizeof(*mod->kp), &mod->num_kp); @@ -2755,6 +2755,18 @@ static void find_module_sections(struct module *mod, struct load_info *info) #ifdef CONFIG_CONSTRUCTORS mod->ctors = section_objs(info, ".ctors", sizeof(*mod->ctors), &mod->num_ctors); + if (!mod->ctors) + mod->ctors = section_objs(info, ".init_array", + sizeof(*mod->ctors), &mod->num_ctors); + else if (find_sec(info, ".init_array")) { + /* + * This shouldn't happen with same compiler and binutils + * building all parts of the module. + */ + printk(KERN_WARNING "%s: has both .ctors and .init_array.\n", + mod->name); + return -EINVAL; + } #endif #ifdef CONFIG_TRACEPOINTS @@ -2793,6 +2805,8 @@ static void find_module_sections(struct module *mod, struct load_info *info) info->debug = section_objs(info, "__verbose", sizeof(*info->debug), &info->num_debug); + + return 0; } static int move_module(struct module *mod, struct load_info *info) @@ -3248,7 +3262,9 @@ static int load_module(struct load_info *info, const char __user *uargs, /* Now we've got everything in the final locations, we can * find optional sections. */ - find_module_sections(mod, info); + err = find_module_sections(mod, info); + if (err) + goto free_unload; err = check_module_license_and_versions(mod); if (err) |