Re: IPv4 NAT doesn't compile in 2.4.4

From: David S. Miller (davem@redhat.com)
Date: Sat Apr 28 2001 - 16:07:53 EST


Russell King writes:
> ip_nat_standalone.c:
>
> static int init_or_cleanup(int init)
> {
> ...
> cleanup_nat:
> ip_nat_cleanup();
> ...
> }

Call ip_nat_cleanup();

> ip_nat_core:
>
> void __exit ip_nat_cleanup(void)
> {
> ip_ct_selective_cleanup(&clean_nat, NULL);
> ip_conntrack_destroyed = NULL;
> }

Define ip_nat_cleanup() as an __exit function.

> *Don't* do this - its fundamentally wrong. Code in the kernel should _not_
> reference code that has been removed by the linker.

Why would ip_nat_cleanup() be removed by the linker? All the "unused"
attribute should do is shut up gcc if the thing is marked static yet
not called. The GCC manual even states "... means that the function
is meant to be possibly unused. GNU CC will not produce a warning
for this function." It makes no mention of any effect on the actual
code output, or that the linker will delete it.

It doesn't remove the function on any platform I could test this on.

If the linker removed it, why did it give a relocation truncation
error instead of a missing symbol error? And more importantly, what
specifically was the reason that the linker removed the function on
ARM, what made this happen?

Please explain this in detail so we don't have to guess as I have
seen no other report of this.

Later,
David S. Miller
davem@redhat.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Apr 30 2001 - 21:00:21 EST