This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Is there a way to detect a null reference function pointer during assembly or linking ?


* William Tambe:

> To supplement my previous question, a null reference function pointer
> can occur when using a weak function for which there is no definition;
> ie:
>
> extern void func (void) __attribute__((weak));
>
> int main () {
>         if (func)
>                 func();
> }
>
> In the above example, func will be null if there is no default
> implementation.

Historically, many targets have problems with such checks because they
the func call creates something that causes the func check to succeed
becase it the symbol is no longer null.  This kind of check only works
if the availability of the symbol can be determined by the link editor.

Thanks,
Florian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]