From patchwork Tue Nov 3 10:06:16 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Jenkins X-Patchwork-Id: 57252 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nA3ABeVc007974 for ; Tue, 3 Nov 2009 10:11:40 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752223AbZKCKLd (ORCPT ); Tue, 3 Nov 2009 05:11:33 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751657AbZKCKLd (ORCPT ); Tue, 3 Nov 2009 05:11:33 -0500 Received: from fallback-out1.mxes.net ([216.86.168.180]:64328 "EHLO fallback-in1.mxes.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752223AbZKCKLc (ORCPT ); Tue, 3 Nov 2009 05:11:32 -0500 X-Greylist: delayed 300 seconds by postgrey-1.27 at vger.kernel.org; Tue, 03 Nov 2009 05:11:32 EST Received: from mxout-08.mxes.net (mxout-08.mxes.net [216.86.168.183]) by fallback-in1.mxes.net (Postfix) with ESMTP id E42318651B for ; Tue, 3 Nov 2009 05:09:01 -0500 (EST) Received: from localhost.localdomain (unknown [86.53.68.233]) by smtp.mxes.net (Postfix) with ESMTPA id 3CA0F509DC; Tue, 3 Nov 2009 05:06:44 -0500 (EST) From: Alan Jenkins To: greg@kroah.com Cc: linux-kbuild@vger.kernel.org, carmelo73@gmail.com, linux-kernel@vger.kernel.org, rusty@rustcorp.com.au, Alan Jenkins Subject: [PATCH 04/10] module: make MODULE_SYMBOL_PREFIX into a CONFIG option Date: Tue, 3 Nov 2009 10:06:16 +0000 Message-Id: <1257242782-10496-5-git-send-email-alan-jenkins@tuffmail.co.uk> X-Mailer: git-send-email 1.6.3.2 In-Reply-To: <9b2b86520911020852q49c55695rb05d87090fa9ad33@mail.gmail.com> References: <9b2b86520911020852q49c55695rb05d87090fa9ad33@mail.gmail.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig index 9a01d44..6c99419 100644 --- a/arch/blackfin/Kconfig +++ b/arch/blackfin/Kconfig @@ -26,6 +26,7 @@ config BLACKFIN select HAVE_KERNEL_BZIP2 select HAVE_KERNEL_LZMA select HAVE_OPROFILE + select HAVE_SYMBOL_PREFIX select ARCH_WANT_OPTIONAL_GPIOLIB config GENERIC_BUG diff --git a/arch/blackfin/include/asm/module.h b/arch/blackfin/include/asm/module.h index e3128df..81d8b90 100644 --- a/arch/blackfin/include/asm/module.h +++ b/arch/blackfin/include/asm/module.h @@ -1,8 +1,6 @@ #ifndef _ASM_BFIN_MODULE_H #define _ASM_BFIN_MODULE_H -#define MODULE_SYMBOL_PREFIX "_" - #define Elf_Shdr Elf32_Shdr #define Elf_Sym Elf32_Sym #define Elf_Ehdr Elf32_Ehdr diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig index 9420648..cc03bbf 100644 --- a/arch/h8300/Kconfig +++ b/arch/h8300/Kconfig @@ -9,6 +9,7 @@ config H8300 bool default y select HAVE_IDE + select HAVE_SYMBOL_PREFIX config MMU bool diff --git a/arch/h8300/include/asm/module.h b/arch/h8300/include/asm/module.h index de23231..8e46724 100644 --- a/arch/h8300/include/asm/module.h +++ b/arch/h8300/include/asm/module.h @@ -8,6 +8,4 @@ struct mod_arch_specific { }; #define Elf_Sym Elf32_Sym #define Elf_Ehdr Elf32_Ehdr -#define MODULE_SYMBOL_PREFIX "_" - #endif /* _ASM_H8/300_MODULE_H */ diff --git a/include/linux/mod_export.h b/include/linux/mod_export.h index 3d80057..56b817a 100644 --- a/include/linux/mod_export.h +++ b/include/linux/mod_export.h @@ -4,10 +4,8 @@ #include #include -/* some toolchains uses a `_' prefix for all user symbols */ -#ifndef MODULE_SYMBOL_PREFIX -#define MODULE_SYMBOL_PREFIX "" -#endif +/* Some toolchains use a `_' prefix for all user symbols. */ +#define MODULE_SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX struct kernel_symbol { unsigned long value; diff --git a/init/Kconfig b/init/Kconfig index c7bac39..fe43d6d 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -1171,6 +1171,17 @@ config MODULE_SRCVERSION_ALL endif # MODULES +config HAVE_SYMBOL_PREFIX + bool + help + Some arch toolchains use a `_' prefix for all user symbols. + This option will be taken into account when loading modules. + +config SYMBOL_PREFIX + string + default "_" if HAVE_SYMBOL_PREFIX + default "" + config INIT_ALL_POSSIBLE bool help diff --git a/scripts/mod/Makefile b/scripts/mod/Makefile index 11d69c3..ff954f8 100644 --- a/scripts/mod/Makefile +++ b/scripts/mod/Makefile @@ -8,7 +8,7 @@ modpost-objs := modpost.o file2alias.o sumversion.o $(obj)/modpost.o $(obj)/file2alias.o $(obj)/sumversion.o: $(obj)/elfconfig.h quiet_cmd_elfconfig = MKELF $@ - cmd_elfconfig = $(obj)/mk_elfconfig $(ARCH) < $< > $@ + cmd_elfconfig = $(obj)/mk_elfconfig < $< > $@ $(obj)/elfconfig.h: $(obj)/empty.o $(obj)/mk_elfconfig FORCE $(call if_changed,elfconfig) diff --git a/scripts/mod/mk_elfconfig.c b/scripts/mod/mk_elfconfig.c index 6a96d47..639bca7 100644 --- a/scripts/mod/mk_elfconfig.c +++ b/scripts/mod/mk_elfconfig.c @@ -9,9 +9,6 @@ main(int argc, char **argv) unsigned char ei[EI_NIDENT]; union { short s; char c[2]; } endian_test; - if (argc != 2) { - fprintf(stderr, "Error: no arch\n"); - } if (fread(ei, 1, EI_NIDENT, stdin) != EI_NIDENT) { fprintf(stderr, "Error: input truncated\n"); return 1; @@ -55,12 +52,6 @@ main(int argc, char **argv) else exit(1); - if ((strcmp(argv[1], "h8300") == 0) - || (strcmp(argv[1], "blackfin") == 0)) - printf("#define MODULE_SYMBOL_PREFIX \"_\"\n"); - else - printf("#define MODULE_SYMBOL_PREFIX \"\"\n"); - return 0; } diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 801a16a..3867481 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -15,8 +15,12 @@ #include #include #include "modpost.h" +#include "../../include/linux/autoconf.h" #include "../../include/linux/license.h" +/* Some toolchains use a `_' prefix for all user symbols. */ +#define MODULE_SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX + /* Are we using CONFIG_MODVERSIONS? */ int modversions = 0; /* Warn about undefined symbols? (do so if we have vmlinux) */