From: Mike Frysinger <vapier@gentoo.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] Allow board specific overwriting of library code
Date: Wed, 4 Feb 2009 11:23:08 -0500 [thread overview]
Message-ID: <200902041123.09688.vapier@gentoo.org> (raw)
In-Reply-To: <4989BFC8.6030204@nessie.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
next prev parent reply other threads:[~2009-02-04 16:23 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-04 14:29 [U-Boot] [PATCH 0/2] Initial Stamp9261 board support Michael Roth
2009-02-04 14:29 ` [U-Boot] [PATCH 1/2] Allow board specific overwriting of library code Michael Roth
2009-02-04 14:29 ` [U-Boot] [PATCH 2/2] Stamp9261 board support Michael Roth
2009-02-04 16:05 ` Wolfgang Denk
2009-02-05 14:07 ` Michael Roth
2009-02-04 14:48 ` [U-Boot] [PATCH 1/2] Allow board specific overwriting of library code Jerry Van Baren
2009-02-04 15:36 ` Wolfgang Denk
2009-02-04 16:00 ` Michael Roth
2009-02-04 16:08 ` Wolfgang Denk
2009-02-04 16:18 ` Michael Roth
2009-02-04 16:23 ` Mike Frysinger [this message]
2009-02-04 21:12 ` Wolfgang Denk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200902041123.09688.vapier@gentoo.org \
--to=vapier@gentoo.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox