mirror of
https://github.com/torvalds/linux.git
synced 2026-11-29 18:12:48 +00:00
module: allow symbol exports to be disabled
To allow existing C code to be incorporated into the decompressor or the UEFI stub, introduce a CPP macro that turns all EXPORT_SYMBOL_xxx declarations into nops, and #define it in places where such exports are undesirable. Note that this gets rid of a rather dodgy redefine of linux/export.h's header guard. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ard Biesheuvel <[email protected]> Acked-by: Nicolas Pitre <[email protected]> Acked-by: Michael Ellerman <[email protected]> Reviewed-by: Will Deacon <[email protected]> Acked-by: Ingo Molnar <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: Bjorn Helgaas <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: James Morris <[email protected]> Cc: James Morris <[email protected]> Cc: Jessica Yu <[email protected]> Cc: Josh Poimboeuf <[email protected]> Cc: Kees Cook <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Petr Mladek <[email protected]> Cc: Russell King <[email protected]> Cc: "Serge E. Hallyn" <[email protected]> Cc: Sergey Senozhatsky <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: Thomas Garnier <[email protected]> Cc: Thomas Gleixner <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
committed by
Linus Torvalds
parent
271ca78877
commit
f922c4abdf
@@ -23,11 +23,8 @@
|
||||
* _ctype[] in lib/ctype.c is needed by isspace() of linux/ctype.h.
|
||||
* While both lib/ctype.c and lib/cmdline.c will bring EXPORT_SYMBOL
|
||||
* which is meaningless and will cause compiling error in some cases.
|
||||
* So do not include linux/export.h and define EXPORT_SYMBOL(sym)
|
||||
* as empty.
|
||||
*/
|
||||
#define _LINUX_EXPORT_H
|
||||
#define EXPORT_SYMBOL(sym)
|
||||
#define __DISABLE_EXPORTS
|
||||
|
||||
#include "misc.h"
|
||||
#include "error.h"
|
||||
|
||||
@@ -24,6 +24,7 @@ KBUILD_CFLAGS := $(cflags-y) -DDISABLE_BRANCH_PROFILING \
|
||||
-D__NO_FORTIFY \
|
||||
$(call cc-option,-ffreestanding) \
|
||||
$(call cc-option,-fno-stack-protector) \
|
||||
-D__DISABLE_EXPORTS
|
||||
|
||||
GCOV_PROFILE := n
|
||||
KASAN_SANITIZE := n
|
||||
|
||||
+10
-1
@@ -66,7 +66,16 @@ extern struct module __this_module;
|
||||
__attribute__((section("___ksymtab" sec "+" #sym), used)) \
|
||||
= { (unsigned long)&sym, __kstrtab_##sym }
|
||||
|
||||
#if defined(__KSYM_DEPS__)
|
||||
#if defined(__DISABLE_EXPORTS)
|
||||
|
||||
/*
|
||||
* Allow symbol exports to be disabled completely so that C code may
|
||||
* be reused in other execution contexts such as the UEFI stub or the
|
||||
* decompressor.
|
||||
*/
|
||||
#define __EXPORT_SYMBOL(sym, sec)
|
||||
|
||||
#elif defined(__KSYM_DEPS__)
|
||||
|
||||
/*
|
||||
* For fine grained build dependencies, we want to tell the build system
|
||||
|
||||
Reference in New Issue
Block a user