From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Roth Date: Wed, 04 Feb 2009 17:18:16 +0100 Subject: [U-Boot] [PATCH 1/2] Allow board specific overwriting of library code In-Reply-To: <4989BB8E.9090405@nessie.de> References: <1233757799-1165-1-git-send-email-mroth@nessie.de> <1233757799-1165-2-git-send-email-mroth@nessie.de> <20090204153632.231B48322908@gemini.denx.de> <4989BB8E.9090405@nessie.de> Message-ID: <4989BFC8.6030204@nessie.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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