From: Peter Tyser <ptyser@xes-inc.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [TESTING PATCH] ppc: Relocation test patch
Date: Fri, 18 Sep 2009 11:24:48 -0500 [thread overview]
Message-ID: <1253291088.617.469.camel@localhost.localdomain> (raw)
In-Reply-To: <OF8731F443.09A8590A-ONC1257635.0054DC6D-C1257635.0055729F@transmode.se>
> > > Sorry, I don't have an example. Just a guess, weak function references:
> > >
> > > void weak_fun(void) __attribute__ ((weak));
> > > if (weak_fun)
> > > weak_fun();
> >
> > Using default weak functions as well as overridden weak functions both
> > definitely work. So the pointers must be being updated correctly. I
> > guess I'm not sure where specifically a problem could arise. Let me
> > know if you have any additional details. I'm hoping to send the patches
> > out later today, maybe some review/testing will make things clearer.
>
> This does not work:
>
> void weak_fun(void) __attribute__ ((weak));
> printf("weak_fun:%p\n", weak_fun);
>
> prints "weak 17f9c000" after relocation
> for me, should be NULL when weak_fun is undefined.
Ahh, I see. I see the same thing. In general U-Boot declares weak
functions by either using the 'alias' attribute:
static int __def_eth_init(bd_t *bis)
{
return -1;
}
int cpu_eth_init(bd_t *bis) __attribute__((weak, alias("__def_eth_init")));
or by declaring a function as weak:
void __attribute__((weak)) _machine_restart(void)
{
}
Both these scenarios work with the current relocation fixup scheme.
What is a real world scenario (such as your example) when someone would
declare a weak function, but not actually implement a default. Doesn't
that defeat the purpose of having a weak function in the first place?
Eg why would someone use your example of:
void weak_fun(void) __attribute__ ((weak));
...
if (weak_fun)
weak_fun();
...
over:
void weak_fun(void) __attribute__ ((weak))
{
};
...
weak_fun();
...
(or the alias implementation)
I'm trying to grasp the limitations of the current relocation mechanism
as I'm afraid I don't have time to dig through all PPC architectures'
start.S files to fix their relocation code right now:)
Thanks,
Peter
next prev parent reply other threads:[~2009-09-18 16:24 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-11 22:45 [U-Boot] [TESTING PATCH] ppc: Relocation test patch Peter Tyser
2009-09-14 21:26 ` Wolfgang Denk
2009-09-14 22:54 ` Peter Tyser
2009-09-16 23:20 ` Peter Tyser
2009-09-17 7:06 ` Joakim Tjernlund
2009-09-17 7:50 ` Wolfgang Denk
2009-09-17 8:39 ` Joakim Tjernlund
2009-09-17 10:15 ` Wolfgang Denk
2009-09-17 12:34 ` Joakim Tjernlund
2009-09-17 12:53 ` Wolfgang Denk
2009-09-17 13:25 ` Joakim Tjernlund
2009-09-17 21:57 ` Graeme Russ
2009-09-18 5:44 ` Joakim Tjernlund
2009-09-17 17:29 ` Peter Tyser
2009-09-18 11:40 ` Joakim Tjernlund
2009-09-18 14:28 ` Peter Tyser
2009-09-18 14:52 ` Joakim Tjernlund
2009-09-18 15:21 ` Peter Tyser
2009-09-18 15:33 ` Joakim Tjernlund
2009-09-18 16:24 ` Peter Tyser [this message]
2009-09-18 17:21 ` Joakim Tjernlund
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=1253291088.617.469.camel@localhost.localdomain \
--to=ptyser@xes-inc.com \
--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