[U-Boot] weak functions versus conditional compile

Haavard Skinnemoen haavard.skinnemoen at atmel.com
Wed Nov 19 14:54:51 CET 2008


Mike Frysinger <vapier at gentoo.org> wrote:
> On Monday 17 November 2008 16:17:54 Graeme Russ wrote:
> > Should I declare these functions as weak in the core i386 code and use a
> > config #define to override or should I seperate the functions out into
> > seperate source files and use conditional compilation?
> 
> i wonder if weak functions that are always satisfied and used unconditionally 
> result in larger code, or if this is only a problem for people whose linkers 
> lack lazy relaxation support ?

It's probably a problem with linkers that don't support --gc-sections,
which is different from relaxation. Also, you definitely need to
compile with -ffunction-sections, or the weak functions might end up in
the same section as something linked unconditionally, which makes it
impossible for the linker to remove them.

Haavard


More information about the U-Boot mailing list