Skip to contentSkip to conversation

ip_conntrack section mismatch warning fix

PATCH In review Stephen Hemminger 3 participants 4 messages Apr 4, 2006 – Apr 5, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ip_conntrack section mismatch warning fix

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.

net/ipv4/netfilter/ip_conntrack_standalone.c +1 -1
@@ -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;
#1 lore raw
Quoted 6 lines · Stephen Hemminger

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.

#2 lore raw
Quoted 8 lines · Patrick McHardy
Quoted 6 lines · Stephen Hemminger

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.

Quoted 4 lines

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.

Signature · 5 lines
- Harald Welte <[email protected]>                 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
#3 lore raw
Quoted 10 lines · Harald Welte
Quoted 4 lines · Patrick McHardy

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.