[U-Boot] [PATCH 1/2] Allow board specific overwriting of library code
Michael Roth
mroth at nessie.de
Wed Feb 4 17:18:16 CET 2009
Michael Roth schrieb:
> Because the whole weak-linking looks like it is somewhat broken or at
> least very difficult to get it correctly.
Small example:
In board/atmel/at91sam9261ek there is:
led.c:
void red_LED_on(void)
...
void red_LED_off(void)
...
Makefile:
COBJS-y += led.o
...
OBJS := $(addprefix $(obj),$(COBJS-y))
...
$(LIB): $(obj).depend $(OBJS) $(SOBJS)
And in lib_arm/board.c we have:
void inline __red_LED_on (void) {}
void inline red_LED_on (void) __attribute__((weak, alias("__red_LED_on")));
void inline __red_LED_off(void) {}
void inline red_LED_off(void) __attribute__((weak, alias("__red_LED_off")));
But as you can see from u-boot.map, the result is not as expected:
0x23f00340 0x35c lib_arm/libarm.a(board.o)
0x23f00390 __red_LED_off
...
0x23f00390 red_LED_off
...
0x23f0038c red_LED_on
0x23f0038c __red_LED_on
No single weak symbol from lib_arm/board.c get overridden from the
board specific led.c. Very annoying.
Michael Roth
More information about the U-Boot
mailing list