On Wednesday 04 February 2009 11:18:16 Michael Roth wrote:
> 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.

that's because your led.o was not pulled in for any other reason.  give it a 
reason to be pulled in and the weak overrides will work fine.  in other words, 
what you show is not the linker being broken, but your expectations being 
broken ;).
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
U-Boot mailing list
[email protected]
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to