All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: "David S. Miller" <davem@davemloft.net>
Cc: rusty@rustcorp.com.au, netfilter-devel@lists.netfilter.org
Subject: Re: [00/10]: Netfilter Update
Date: Thu, 23 Mar 2006 05:10:50 +0100	[thread overview]
Message-ID: <44221FCA.4080301@trash.net> (raw)
In-Reply-To: <44221A45.7060003@trash.net>

[-- Attachment #1: Type: text/plain, Size: 1534 bytes --]

Patrick McHardy wrote:
> David S. Miller wrote:
> 
>>>     [NETFILTER]: Fix undefined references to get_h225_addr
>>
>>
>>I never in a million years would have thought that exporting
>>a symbol to modules would work if the symbol was declared
>>static :-)  But come to think of it, I see nothing that prevents
>>this.
>>
>>I wonder if this could be prevented somehow using so me construct
>>in the module symbol export macros?
> 
> 
> I was surprised too. Looking at the gcc-builtins, there seems to
> be no way to determine if a function is static. But this small
> hack appears to work. It adds a non-static forward declaration of
> the exported function to the function body, causing a warning
> if the function was declared static.
> 
> 
> ------------------------------------------------------------------------
> 
> diff --git a/include/linux/module.h b/include/linux/module.h
> index 70bd843..f8eec37 100644
> --- a/include/linux/module.h
> +++ b/include/linux/module.h
> @@ -183,6 +183,7 @@ void *__symbol_get_gpl(const char *symbo
>  
>  /* For every exported symbol, place a struct in the __ksymtab section */
>  #define __EXPORT_SYMBOL(sym, sec)				\
> +	typeof(sym) sym;					\
>  	__CRC_SYMBOL(sym, sec)					\
>  	static const char __kstrtab_##sym[]			\
>  	__attribute__((section("__ksymtab_strings")))		\

That patch was broken, I only tested the case it should fail on, but
it also fails on symbols exported in different files. This one adds an
extern declaration instead, I think that should have the desired
effect.


[-- Attachment #2: x --]
[-- Type: text/plain, Size: 1070 bytes --]

[MODULES]: Don't allow statically declared exports

Add an extern declaration for exported symbols to make the compiler warn
on symbols declared statically.

Signed-off-by: Patrick McHardy <kaber@trash.net>

---
commit 8648236083e488ff4fc279b66d63b1187e22e558
tree cba9ee372f1056c8cf63cdc6a37a6a761fa490c9
parent 8b21e6d05d6ac0aeb44f5866ab611e2709c2f08e
author Patrick McHardy <kaber@trash.net> Thu, 23 Mar 2006 05:07:39 +0100
committer Patrick McHardy <kaber@trash.net> Thu, 23 Mar 2006 05:07:39 +0100

 include/linux/module.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/linux/module.h b/include/linux/module.h
index 70bd843..d956915 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -183,6 +183,7 @@ void *__symbol_get_gpl(const char *symbo
 
 /* For every exported symbol, place a struct in the __ksymtab section */
 #define __EXPORT_SYMBOL(sym, sec)				\
+	extern typeof(sym) sym;					\
 	__CRC_SYMBOL(sym, sec)					\
 	static const char __kstrtab_##sym[]			\
 	__attribute__((section("__ksymtab_strings")))		\

      parent reply	other threads:[~2006-03-23  4:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-22 18:47 [00/10]: Netfilter Update Patrick McHardy
2006-03-22 18:47 ` [NETFILTER 01/10]: Fix ip6tables breakage from {get, set}sockopt compat layer Patrick McHardy
2006-03-22 18:47 ` [NETFILTER 02/10]: Fix Kconfig typos Patrick McHardy
2006-03-22 18:47 ` [NETFILTER 03/10]: ctnetlink: Fix expectaction mask dumping Patrick McHardy
2006-03-22 18:47 ` [NETFILTER 04/10]: nfnetlink_queue: fix nfnetlink message size Patrick McHardy
2006-03-22 18:47 ` [NETFILTER 05/10]: conntrack: cleanup the conntrack ID initialization Patrick McHardy
2006-03-22 18:47 ` [NETFILTER 06/10]: x_tables: set the protocol family in x_tables targets/matches Patrick McHardy
2006-03-22 18:47 ` [NETFILTER 07/10]: nf_conntrack: support for layer 3 protocol load on demand Patrick McHardy
2006-03-22 18:47 ` [NETFILTER 08/10]: Fix xt_policy address matching Patrick McHardy
2006-03-22 18:47 ` [NETFILTER 09/10]: futher {ip,ip6,arp}_tables unification Patrick McHardy
2006-03-22 18:47 ` [NETFILTER 10/10]: Fix undefined references to get_h225_addr Patrick McHardy
2006-03-22 21:59 ` [00/10]: Netfilter Update David S. Miller
2006-03-23  3:47   ` Patrick McHardy
2006-03-23  3:48     ` Patrick McHardy
2006-03-23  4:10     ` Patrick McHardy [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44221FCA.4080301@trash.net \
    --to=kaber@trash.net \
    --cc=davem@davemloft.net \
    --cc=netfilter-devel@lists.netfilter.org \
    --cc=rusty@rustcorp.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.