Subject: Use of / assumptions about __weak_alias in tools build
To: None <tech-userlevel@netbsd.org>
From: Rafal Boni <rafal@pobox.com>
List: tech-userlevel
Date: 11/28/2007 01:15:59
While playing with Sun Netra T1 AC200 I couldn't get NetBSD to boot on,
I installed the latest OpenBSD/sparc64 on it to make sure the hardware
was OK and baseline some *BSD support.  I figured once I had OpenBSD
installed on it, I could suck down the NetBSD tree and cross-build away.

Not without hacking the OpenBSD /usr/include/sparc64/cdefs.h, I
couldn't.  OpenBSD apparently has a __weak_alias macro just like we do,
except they require the caller to supply the trailing ';' (whereas ours
does it for you).

Fixing the OpenBSD header file was (of course) the most expedient thing
to do, but I'm wondering if tools/compat/compat_defs.h should explicitly
undefine this or undef & redefine to nothing (and the same for any other
'exotic' features of the host OS'es headers, whatever they may be) so
that look-alikes don't get us in trouble.

For this issue __weak_alias seems to be enough, but maybe all the
aliasing/rename foo in sys/cdefs_<obj-format>.h should be done as well?

Thoughts?
--rafal

PS: Of course the build dies somewhere else later with a different
issue, grumble.  I guess I'll build stuff on the working NetBSD sparc64
box instead, but it seemed like a nice idea to be able to
build/reboot/test right on the problematic system.