From: Mike Frysinger Date: Wed, 4 Feb 2009 11:23:08 -0500 Subject: [U-Boot] [PATCH 1/2] Allow board specific overwriting of library code In-Reply-To: <4989BFC8.6030204@nessie.de> References: <1233757799-1165-1-git-send-email-mroth@nessie.de> <4989BB8E.9090405@nessie.de> <4989BFC8.6030204@nessie.de> Message-ID: <200902041123.09688.vapier@gentoo.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 835 bytes Desc: This is a digitally signed message part. Url : http://lists.denx.de/pipermail/u-boot/attachments/20090204/e259fc99/attachment.pgp