[lkml]   [2001]   [Apr]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
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 */

> 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

 \ /
  Last update: 2005-03-22 12:52    [W:0.084 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site