Because we explicitly tell the linker to drop all code marked as
__exit:
#define __exit __attribute__ ((unused, __section__(".text.exit")))
/* Sections to be discarded */
/DISCARD/ : {
*(.text.exit)
*(.data.exit)
*(.exitcall.exit)
}
> 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 (rmk@arm.linux.org.uk) The developer of ARM Linux http://www.arm.linux.org.uk/personal/aboutme.html- 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/