tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: not cmake fallout in pkgsrc/lang/compiler-rt



On Fri, Feb 14, 2025 at 01:32:34PM +0000, Taylor R Campbell wrote:
> sys/param.h pulls in a huge pile of other crud -- it's awful.  Ideally
> we would empty it of everything except __NetBSD_Version__ and the
> related macros.  (I would suggest those be put in a different header
> file like sys/version.h, but that doesn't work -- we can't do that
> retroactively for past versions!)

I agree after seeing this weird fallout...

> In this case, sys/param.h pulls in sys/sysctl.h, which (when _KMEMUSER
> is defined) pulls in sys/ucontext.h, which in turns pulls in
> machine/mcontext.h, which is where the _RTLD_SOURCE conditional used
> to live.  After you've included machine/mcontext.h, including it again
> doesn't do anything because of the double-include protection we put on
> all^Wmost header files.
> 
> So after you have included sys/param.h, it's too late to decide to
> define _RTLD_SOURCE to expose the TLS-related definitions.
> 
> Probably best to do something like this:
> 
> #if SANITIZER_NETBSD
> #  define _RTLD_SOURCE
> #  include <machine/mcontext.h>
> #  undef _RTLD_SOURCE
> #  include <sys/param.h>
> #  if __NetBSD_Version__ >= 1099001200
> #    include <machine/lwp_private.h>
> #  endif
> ...
> #endif
> 
> Or, if that doesn't work, try <sys/ucontext.h> instead of
> <machine/mcontext.h> -- the point is to keep the scope of the
> _RTLD_SOURCE kludge as limited as possible so it doesn't affect
> anything it shouldn't.

I committed the version above - it still builds on -current, and I'll
watch the bulk builds.

Thanks for the explanation!
 Thomas


Home | Main Index | Thread Index | Old Index