
In message e68c55e80705231251s678d3e59g2db9ed3da3fce830@mail.gmail.com you wrote:
#define cond_extern(name) asm(".weak\t" #name "\n\t.set\t" #name ", unimpl_extern")
I do not understand what this does. Does it work?
Yes, it does. See file: gcc.info, node: Function Attributes, section: 5.24 Declaring Attributes of Functions
static int unimpl_extern(void) { return -ENOSYS; /* or something more appropriate */ }
How is this different that using the dummy function?
The main difference is that with "normal" functions you must make sure that the dummy function does not get compiled / linked when you implement a real function. "Weak" are simply overwritten if any user provides another (real) function with the same name. No #ifdef mess any more :-)
Best regards,
Wolfgang Denk