[RFC PATCH 2/2] Kbuild: avoid partial linking of drivers/built-in.o
From: Dave.Martin@arm.com (Dave Martin)
Date: 2015-03-31 16:30:14
Also in:
linux-kbuild, lkml
From: Dave.Martin@arm.com (Dave Martin)
Date: 2015-03-31 16:30:14
Also in:
linux-kbuild, lkml
On Tue, Mar 31, 2015 at 11:22:29AM -0400, Nicolas Pitre wrote:
On Mon, 30 Mar 2015, Ard Biesheuvel wrote:quoted
On 30 March 2015 at 16:13, Michal Marek [off-list ref] wrote:
[...]
quoted
quoted
What you could do is to add a Kconfig option to arch/arm/Kconfig adding -ffunction-sections to the compiler flags. Then allyesconfig would select it and work around the problem in a somewhat elegant way.Excellent idea! Arnd hasn't chimed in yet, but he is the one doing lots and lots of randconfig builds and other test builds, so I will wait for him to confirm that this is a useful thing to have.I'm using -ffunction-sections as well for the kernel size reduction work I'm currently doing. The linker script has to be adapted so .text.* is specified along .text otherwise those functions end up appended at the end of the binary.
Interesting ... do you also mean using --gc-sections at link time? We'd need to avoid pruning needed code that has no explicit caller, and functions that are part of the kernel/module ABI but not used within vmlinux. The GCC docs suggest that -ffunction-sections may impact performance and/or increase code size, but I don't know by how much. Maybe it interferes with inling. Cheers ---Dave