aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2004-04-11 23:05:02 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-04-11 23:05:02 -0700
commit7ee168c0b7a988210cc8024d105dfd1cb3e956e6 (patch)
treecbd11aebcd3b71f46ee9672d58e6b894bff837ba /scripts
parenta05fc485ee36ccca83808dae14a2487ab46d4c56 (diff)
downloadhistory-7ee168c0b7a988210cc8024d105dfd1cb3e956e6.tar.gz
[PATCH] Move __this_module to modpost
From: Brian Gerst <bgerst@didntduck.org> Move the __this_module structure to the modpost code where it really belongs.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.modpost2
-rw-r--r--scripts/modpost.c12
2 files changed, 14 insertions, 0 deletions
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index cd716ece897650..d349dda5edf79e 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -35,6 +35,8 @@ targets += $(modules)
# Compile version info for unresolved symbols
+modname = $(*F)
+
quiet_cmd_cc_o_c = CC $@
cmd_cc_o_c = $(CC) $(c_flags) $(CFLAGS_MODULE) \
-c -o $@ $<
diff --git a/scripts/modpost.c b/scripts/modpost.c
index a0976fcb99823a..69168e18d5bf40 100644
--- a/scripts/modpost.c
+++ b/scripts/modpost.c
@@ -343,6 +343,9 @@ handle_modversions(struct module *mod, struct elf_info *info,
/* ignore global offset table */
if (strcmp(symname, "_GLOBAL_OFFSET_TABLE_") == 0)
break;
+ /* ignore __this_module, it will be resolved shortly */
+ if (strcmp(symname, MODULE_SYMBOL_PREFIX "__this_module") == 0)
+ break;
#ifdef STT_REGISTER
if (info->hdr->e_machine == EM_SPARC ||
info->hdr->e_machine == EM_SPARCV9) {
@@ -468,6 +471,15 @@ add_header(struct buffer *b)
buf_printf(b, "#include <linux/compiler.h>\n");
buf_printf(b, "\n");
buf_printf(b, "MODULE_INFO(vermagic, VERMAGIC_STRING);\n");
+ buf_printf(b, "\n");
+ buf_printf(b, "struct module __this_module\n");
+ buf_printf(b, "__attribute__((section(\".gnu.linkonce.this_module\"))) = {\n");
+ buf_printf(b, " .name = __stringify(KBUILD_MODNAME),\n");
+ buf_printf(b, " .init = init_module,\n");
+ buf_printf(b, "#ifdef CONFIG_MODULE_UNLOAD\n");
+ buf_printf(b, " .exit = cleanup_module,\n");
+ buf_printf(b, "#endif\n");
+ buf_printf(b, "};\n");
}
/* Record CRCs for unresolved symbols */