This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
How to stop --gc-sections nukeing all sections?
- To: binutils at sourceware dot cygnus dot com
- Subject: How to stop --gc-sections nukeing all sections?
- From: greyham at research dot canon dot com dot au (Graham Stoney)
- Date: Wed, 5 Apr 2000 13:47:19 +1000 (EST)
Hi there,
I'm currently using --gc-sections to eliminate dead code from the Linux kernel
for use on embedded systems. I think I just resolved my last problem, which
was that the linker wasn't outputing _any_ data in the output sections,
presumably because there are no external references to any section. Hence, it
garbage collected _everything_, leaving no output section data, and no kernel
:-(.
My hack workaround is to add "-u _start" to LINKFLAGS, which is enough to
stop ld from discarding everything. However, I'm wondering what the approved
method is to prevent --gc-sections from simply discarding everything?
Is there something I can add to the linker command file to achieve this?
It would be nice to be able to turn --gc-sections on and off without having
to add other stuff to LINKFLAGS. I notice the binutils ldscripts don't suffer
from this problem, but I can't see the magic that makes it work.
Thanks,
Graham
--
Graham Stoney
Principal Hardware/Software Engineer
Canon Information Systems Research Australia
Ph: +61 2 9805 2909 Fax: +61 2 9805 2929