Weak functions not overridden if overriding file contains only overrides of weak functions
Graeme Russ
graeme.russ@gmail.com
Thu Nov 27 02:01:00 GMT 2008
Hi All,
I am trying to defining a weak function so it can be overridden but have
struck an issue with I think is a shortcoming with ld (I hesitate to say
'bug' just yet)
In include_file.h I have:
void fn(ulong addr);
In default_behaviour.c I have:
#include "include_file.h>
void __fn_alias(ulong addr)
{
/* Default Behaviour */
}
void fn(ulong addr) __attribute__((weak, alias("__weak_fn_alias")));
In overide_behaviour.c I have:
void fn(ulong addr)
{
/* Overridden Behaviour */
}
However, if this is the only function in overide_behaviour.c, the function
will not get overridden. In order for ld to link in fn() found in
overide_behaviour.c, another (strong) function (which must be called
somewhere in the code) has to be included in overide_behaviour.c
I have heard this is intended behaviour - Is this so? If so, is there an
option which will force ld to override this behaviour?
Thanks for your time,
Graeme
More information about the Binutils
mailing list