On Sat, May 08, 2010 at 10:34:23AM +0200, Patrick Georgi wrote:
Am Samstag, den 08.05.2010, 10:25 +0200 schrieb Stefan Reinauer:
On 5/8/10 12:13 AM, Patrick Georgi wrote:
-#initobj-y += serial.o +initobj-$(CONFIG_USE_DCACHE_RAM) += serial.o subdirs-y += vga
Awesome... the less .c file includes we have in romstage.c the better..
This way works in the case of converting code that was previously always compiled in.
But how should we handle things in case of other conditions?
We could stuff all of the initobjs into an initobj.a, and use that for linking. ld will only pick up the object files that are actually needed then. This means we probably compile a serial port thingy too many, but they're rather small.
I think coreboot should try to avoid using .a files.
The latest version of gcc (v4.5) contains the -flto feature. This can provide significant benefits to coreboot code generation because it allows the entire romstage (and ramstage) to be analyzed as a whole. The resulting binaries are significantly smaller because unused code can be eliminated and more functions can be inlined. Unfortunately, the standard linker can't handle -flto with .a files.
-Kevin