All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ip_conntrack section mismatch warning fix
@ 2006-04-04 18:32 Stephen Hemminger
  2006-04-05 14:30 ` Patrick McHardy
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2006-04-04 18:32 UTC (permalink / raw)
  To: netfilter-devel

This is a bit of a hack. It eliminates the section mismatch warning from
latest linker. What happens is the init_or_cleanup code gets called
from cleanup() hook and the linker thinks it will reference __initdata
because of it's limited static analysis.  By asking compiler to
inline, it can eliminate that dead code. It does the __init text
section to grow, but then the space can be reclaimed.

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>


--- test-2.6.orig/net/ipv4/netfilter/ip_conntrack_standalone.c
+++ test-2.6/net/ipv4/netfilter/ip_conntrack_standalone.c
@@ -783,7 +783,7 @@ static ctl_table ip_ct_net_table[] = {
 EXPORT_SYMBOL(ip_ct_log_invalid);
 #endif /* CONFIG_SYSCTL */
 
-static int init_or_cleanup(int init)
+static inline int init_or_cleanup(int init)
 {
 #ifdef CONFIG_PROC_FS
 	struct proc_dir_entry *proc, *proc_exp, *proc_stat;

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ip_conntrack section mismatch warning fix
  2006-04-04 18:32 [PATCH] ip_conntrack section mismatch warning fix Stephen Hemminger
@ 2006-04-05 14:30 ` Patrick McHardy
  2006-04-05 15:23   ` Harald Welte
  0 siblings, 1 reply; 4+ messages in thread
From: Patrick McHardy @ 2006-04-05 14:30 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netfilter-devel

Stephen Hemminger wrote:
> This is a bit of a hack. It eliminates the section mismatch warning from
> latest linker. What happens is the init_or_cleanup code gets called
> from cleanup() hook and the linker thinks it will reference __initdata
> because of it's limited static analysis.  By asking compiler to
> inline, it can eliminate that dead code. It does the __init text
> section to grow, but then the space can be reclaimed.

I think this might still fail without forced inlining. Our init
functions look like crap anyway, and the reason mostly seems to
be mass-registration of hooks, so I guess I'll clean that up
with a small helper function and then just split them.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ip_conntrack section mismatch warning fix
  2006-04-05 14:30 ` Patrick McHardy
@ 2006-04-05 15:23   ` Harald Welte
  2006-04-05 15:28     ` Patrick McHardy
  0 siblings, 1 reply; 4+ messages in thread
From: Harald Welte @ 2006-04-05 15:23 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: netfilter-devel, Stephen Hemminger

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

On Wed, Apr 05, 2006 at 04:30:46PM +0200, Patrick McHardy wrote:
> Stephen Hemminger wrote:
> > This is a bit of a hack. It eliminates the section mismatch warning from
> > latest linker. What happens is the init_or_cleanup code gets called
> > from cleanup() hook and the linker thinks it will reference __initdata
> > because of it's limited static analysis.  By asking compiler to
> > inline, it can eliminate that dead code. It does the __init text
> > section to grow, but then the space can be reclaimed.
> 
> I think this might still fail without forced inlining. Our init
> functions look like crap anyway, and the reason mostly seems to
> be mass-registration of hooks, so I guess I'll clean that up
> with a small helper function and then just split them.

still I actually think of the shared init/cleanup functions as a big
feature rather than something that needs to be 'cleaned up'.  

I'm obviously not opposing something like nf_register_hook_array(), but
that's a different issue.

-- 
- Harald Welte <laforge@netfilter.org>                 http://netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie

[-- Attachment #2: Type: application/pgp-signature, Size: 191 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ip_conntrack section mismatch warning fix
  2006-04-05 15:23   ` Harald Welte
@ 2006-04-05 15:28     ` Patrick McHardy
  0 siblings, 0 replies; 4+ messages in thread
From: Patrick McHardy @ 2006-04-05 15:28 UTC (permalink / raw)
  To: Harald Welte; +Cc: netfilter-devel, Stephen Hemminger

Harald Welte wrote:
> On Wed, Apr 05, 2006 at 04:30:46PM +0200, Patrick McHardy wrote:
> 
>>I think this might still fail without forced inlining. Our init
>>functions look like crap anyway, and the reason mostly seems to
>>be mass-registration of hooks, so I guess I'll clean that up
>>with a small helper function and then just split them.
> 
> 
> still I actually think of the shared init/cleanup functions as a big
> feature rather than something that needs to be 'cleaned up'.  

I think they make the cleanup code quite unreadable because the
heavy mix with labels. I'm already half way through and the
seperated cleanup functions really are a lot more readable.
Besides that the split also allows to throw the init part away
after initializing, so it makes the binary smaller.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-04-05 15:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-04 18:32 [PATCH] ip_conntrack section mismatch warning fix Stephen Hemminger
2006-04-05 14:30 ` Patrick McHardy
2006-04-05 15:23   ` Harald Welte
2006-04-05 15:28     ` Patrick McHardy

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.