Re: IPv4 NAT doesn't compile in 2.4.4

From: Russell King (
Date: Sat Apr 28 2001 - 16:21:45 EST

On Sat, Apr 28, 2001 at 02:07:53PM -0700, David S. Miller wrote:
> Why would ip_nat_cleanup() be removed by the linker?

Because we explicitly tell the linker to drop all code marked as

#define __exit __attribute__ ((unused, __section__(".text.exit")))

>From x86

  /* Sections to be discarded */
  /DISCARD/ : {

> 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.

I quote from the ld info pages:

   The special output section name `/DISCARD/' may be used to discard
input sections. Any input sections which are assigned to an output
section named `/DISCARD/' are not included in the output file.

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

Try x86.

> 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?

Architecture independent linker behaviour.

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

The reason it shows up on ARM is because the relocation is not 32-bit
long, and therefore the relocation it is trying to encode generates
an error.

(I'm presuming that it was allocating the symbol an address of zero,
but I haven't checked this since trying to call a non-present section
seems a bit stupid to start with).

Russell King (                The developer of ARM Linux

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to More majordomo info at Please read the FAQ at

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