From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936090AbcJUXpD (ORCPT ); Fri, 21 Oct 2016 19:45:03 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:35946 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935413AbcJUXpC (ORCPT ); Fri, 21 Oct 2016 19:45:02 -0400 Date: Sat, 22 Oct 2016 10:44:41 +1100 From: Nicholas Piggin To: Steven Rostedt Cc: LKML , Al Viro , Borislav Petkov , Thomas Gleixner , Ingo Molnar , Gabriel C Subject: Re: [RFC][PATCH] Add EXPORT_MACRO_SYMBOL() for asm Message-ID: <20161022104441.6a8f442f@roar.ozlabs.ibm.com> In-Reply-To: <20161021121759.74a635db@gandalf.local.home> References: <20161021121759.74a635db@gandalf.local.home> Organization: IBM X-Mailer: Claws Mail 3.14.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 21 Oct 2016 12:17:59 -0400 Steven Rostedt wrote: > Commit 784d5699eddc5 ("x86: move exports to actual definitions") removed the > EXPORT_SYMBOL(__fentry__) and EXPORT_SYMBOL(mcount) from x8664_ksyms_64.c, > and added EXPORT_SYMBOL(function_hook) in mcount_64.S instead. The problem > is that function_hook isn't a function at all, but a macro that is defined > as eithe mcount or __fentry__ depending on the support from gcc. But instead > of adding more #ifdefs like x8684_ksyms_64.c had, I suggest having another > export that can handle this similar to the way __string() works with > converting macros to strings. By having: > > EXPORT_MACRO_SYMBOL(function_hook) > > Where we have: > > #define EXPORT_MACRO_SYMBOL(x) EXPORT_SYMBOL(x) > > It will convert the macro into what it is defined as before calling > EXPORT_SYMBOL(), and this will just work properly again. > > Cc: stable@vger.kernel.org > Fixes: Commit 784d5699eddc5 ("x86: move exports to actual definitions") > Signed-off-by: Steven Rostedt > --- > arch/x86/kernel/mcount_64.S | 2 +- > include/asm-generic/export.h | 5 +++++ > 2 files changed, 6 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/kernel/mcount_64.S b/arch/x86/kernel/mcount_64.S > index efe73aacf966..ccd9d912af27 100644 > --- a/arch/x86/kernel/mcount_64.S > +++ b/arch/x86/kernel/mcount_64.S > @@ -295,7 +295,7 @@ trace: > jmp fgraph_trace > END(function_hook) > #endif /* CONFIG_DYNAMIC_FTRACE */ > -EXPORT_SYMBOL(function_hook) > +EXPORT_MACRO_SYMBOL(function_hook) > #endif /* CONFIG_FUNCTION_TRACER */ > > #ifdef CONFIG_FUNCTION_GRAPH_TRACER > diff --git a/include/asm-generic/export.h b/include/asm-generic/export.h > index 43199a049da5..cb86e746865e 100644 > --- a/include/asm-generic/export.h > +++ b/include/asm-generic/export.h > @@ -90,5 +90,10 @@ > __EXPORT_SYMBOL(name, KSYM(name),) > #define EXPORT_DATA_SYMBOL_GPL(name) \ > __EXPORT_SYMBOL(name, KSYM(name),_gpl) > +/* > + * If "name" is a macro of a function and not a function itself, > + * it needs a second pass. > + */ > +#define EXPORT_MACRO_SYMBOL(x) EXPORT_SYMBOL(x) Seems okay, but what about just calling it EXPORT_SYMBOL? Thanks, Nick