How to stop --gc-sections nukeing all sections?
Graham Stoney
greyham@research.canon.com.au
Tue Apr 4 20:47:00 GMT 2000
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
More information about the Binutils
mailing list