Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1331539

Re: [PATCH v2 02/13] EXPORT_SYMBOL() for asm

From Nicolas Pitre <nico@fluxnic.net>
Newsgroups linux.kernel
Subject Re: [PATCH v2 02/13] EXPORT_SYMBOL() for asm
Date 2016-02-10 23:20 +0100
Message-ID <r0Lh8-8gU-11@gated-at.bofh.it> (permalink)
References <qYd9T-7j9-3@gated-at.bofh.it> <qYd9U-7j9-31@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, 3 Feb 2016, Al Viro wrote:

> From: Al Viro <viro@zeniv.linux.org.uk>
> 
> Add asm-usable variants of EXPORT_SYMBOL/EXPORT_SYMBOL_GPL.  This
> commit just adds the default implementation; most of the architectures
> can simply add export.h to asm/Kbuild and start using <asm/export.h>
> from assembler.  The rest needs to have their <asm/export.h> define
> everal macros and then explicitly include <asm-generic/export.h>
[...]

FYI, here's the needed changes to make it work with my autoksyms series. 
This is the asm/export.h version of http://lkml.org/lkml/2016/2/10/5.

diff --git a/include/asm-generic/export.h b/include/asm-generic/export.h
index 03b51ac4cc..b450da9d68 100644
--- a/include/asm-generic/export.h
+++ b/include/asm-generic/export.h
@@ -59,8 +59,24 @@ KSYM(__kcrctab_\name):
 #endif
 .endm
 #undef __put
-#define EXPORT_SYMBOL(name) __EXPORT_SYMBOL name,KSYM_FUNC(KSYM(name))
-#define EXPORT_SYMBOL_GPL(name) __EXPORT_SYMBOL name,KSYM_FUNC(KSYM(name)),_gpl
-#define EXPORT_DATA_SYMBOL(name) __EXPORT_SYMBOL name,KSYM(name)
-#define EXPORT_DATA_SYMBOL_GPL(name) __EXPORT_SYMBOL name,KSYM(name),_gpl
+
+#ifdef CONFIG_TRIM_UNUSED_KSYMS
+#include <linux/kconfig.h>
+#include <generated/autoksyms.h>
+#define ___EXPORT_SYMBOL(name, val, sec) \
+	__cond_export_sym(name, val, sec, config_enabled(__KSYM_##name))
+#define __cond_export_sym(name, val, sec, conf) \
+	___cond_export_sym(name, val, sec, conf)
+#define ___cond_export_sym(name, val, sec, enabled) \
+	__cond_export_sym_##enabled(name, val, sec)
+#define __cond_export_sym_1(name, val, sec) __EXPORT_SYMBOL name, val, sec
+#define __cond_export_sym_0(name, val, sec) /* nothing */
+#else
+#define ___EXPORT_SYMBOL(name, val, sec) __EXPORT_SYMBOL name, val, sec
+#endif
+
+#define EXPORT_SYMBOL(name) ___EXPORT_SYMBOL(name,KSYM_FUNC(KSYM(name)),())
+#define EXPORT_SYMBOL_GPL(name) ___EXPORT_SYMBOL(name,KSYM_FUNC(KSYM(name)),_gpl)
+#define EXPORT_DATA_SYMBOL(name) ___EXPORT_SYMBOL(name,KSYM(name),())
+#define EXPORT_DATA_SYMBOL_GPL(name) ___EXPORT_SYMBOL(name,KSYM(name),_gpl)
 #endif

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH v2 02/13] EXPORT_SYMBOL() for asm Nicolas Pitre <nico@fluxnic.net> - 2016-02-10 23:20 +0100

csiph-web