In article <[EMAIL PROTECTED]>,
Matthew Jacob <[EMAIL PROTECTED]> wrote:
>
> So, I notice that '#pragma weak' appears to work for me for the compilers and
> linkers we currently use for i386 && alpha (at least in user space), so you
> can do things like:
>
> ---------
> extern void *isp_static_fw_vector(void);
> #pragma weak isp_static_fw_vector
[...]
> Is there any reason to *not* use this trick in the kernel?
I won't address the question of whether to use weak symbols in the
kernel. But I do have an opinion about how it should be done if
weak symbols are used.
Instead of using "#pragma weak", make a macro "__weak_definition" or
somesuch in <sys/cdefs.h>. It should look something like this:
#define __weak_definition __attribute__ ((__weak__))
and it should be enclosed in the appropriate #ifdefs to ensure that
the compiler is GCC and its version is late enough to support it.
See the other examples in <sys/cdefs.h>. It would be used like
this:
extern void *isp_static_fw_vector(void) __weak_definition;
#pragma weak is bad because you can't put #pragmas into macros.
John
--
John Polstra [EMAIL PROTECTED]
John D. Polstra & Co., Inc. Seattle, Washington USA
"Disappointment is a good sign of basic intelligence." -- Ch�gyam Trungpa
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message