Using -ffunction-sections in Linux kernel builds

From: Graham Stoney (greyham@research.canon.com.au)
Date: Mon Apr 03 2000 - 01:39:22 EST


Hi There,

Last year on the gcc mailing list, there was a brief discussion about using
-ffunction-sections (gcc) and --gc-sections (ld) to eliminate dead functions
in Linux kernel builds. For reference, see:
    http://gcc.gnu.org/ml/gcc/1999-02n/msg00494.html

I'm having trouble getting this to work, and I'm wondering if anyone can give
me a quick pointer. I've added -ffunction-sections to CFLAGS, and added a line
to arch/ppc/vmlinux.lds in the .text section saying:

    *(.text.*)

However, the kernel won't link without --gc-section in LINKFLAGS, and with
--gc-section in LINKFLAGS it generates a tiny vmlinux file which nm won't even
recognise.

Has anyone succeeded in getting this to work in kernel builds with the latest
gcc & binutils?

Thanks,
Graham

-- 
Graham Stoney
Principal Hardware/Software Engineer
Canon Information Systems Research Australia
Ph: +61 2 9805 2909  Fax: +61 2 9805 2929

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Apr 07 2000 - 21:00:09 EST