Most of work needed for working -ffunction-sections -fdata-sections build is already in the mainline, but a few bits are still missing. In order to have a working kernel with this make invocation: make KCFLAGS="-ffunction-sections -fdata-sections" we need these patches: modpost: support objects with more than 64k sections This patch is in -mm, it still did not reach mainline, thus resending. Sam suggested some readability improvements. [Note: this patch is included into 2.6.36+ kernels] module linker script: coalesce function and data sections kernel linker stripts: accomodate function and data sections boot linker stripts: accomodate function and data sections Please see individual patches for more detailed changelogs. The patches do not enable section garbage-collection per se, since this change is a bit drastic and the plan is to test it more extensively before pushing such a feature into mainline. In order to enable it, add: LDFLAGS_vmlinux += --gc-sections in top-level Makefile, add apply the additional patch, linux-2.6.35-rc4-fsgs.patch, which adds KEEP(section) directives to kernel linker stripts. Otherwise, linker will discard some crucial sections. A rough idea what sort of size savings are achievable with section garbage collection: Kernel: text data bss dec hex filename 8299299 857324 785348 9941971 97b3d3 2.6.35-rc4/vmlinux 7566908 832388 717844 9117140 8b1dd4 2.6.35-rc4-fsgs/vmlinux -9.2% -2.9% -9.0% -8.6% The largest module in the build: 451009 54640 2224 507873 7bfe1 2.6.35-rc4/fs/xfs/xfs.ko 450521 54292 2202 507015 7bc87 2.6.35-rc4-fsgs/fs/xfs/xfs.ko (negligible size change since section garbage collection for modules is not done. TODO: figure out how to do it)