Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Dec 2017 20:35:35 +1100 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Warner Losh <imp@freebsd.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org,  svn-src-head@freebsd.org
Subject:   Re: svn commit: r326486 - in head/stand: ofw/libofw powerpc/boot1.chrp
Message-ID:  <20171203185027.T872@besplex.bde.org>
In-Reply-To: <201712030454.vB34ssem056112@repo.freebsd.org>
References:  <201712030454.vB34ssem056112@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 3 Dec 2017, Warner Losh wrote:

> Log:
>  Include machine/md_var to pick up __syncicache prototype.

This is nonsense.  machine/md_var.h is kernel-only, but on powerpc
it declares __syncicache() which also exists in userland.  This include
is like including the kernel-only header sys/systm.h to declare printf()
in userland.

It is also an error to include machine/md_var.h in MI files in the
kernel.  Approx. 72 of the 305 includes of it in -current have this
bug.  The worst one is probably the one in altq_subr.c.  altq_subr.c
abuses the MD variable cpu_feature to test for CPUID_TSC.  That is just
the start of it layering violations and other bugs.

> Modified: head/stand/ofw/libofw/elf_freebsd.c
> ==============================================================================
> --- head/stand/ofw/libofw/elf_freebsd.c	Sun Dec  3 04:54:49 2017	(r326485)
> +++ head/stand/ofw/libofw/elf_freebsd.c	Sun Dec  3 04:54:54 2017	(r326486)
> @@ -32,6 +32,9 @@ __FBSDID("$FreeBSD$");
>
> #include <machine/metadata.h>
> #include <machine/elf.h>
> +#if defined(__powerpc__)
> +#include <machine/md_var.h>
> +#endif

Style bug (verbose spelling of 'ifdef').

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20171203185027.T872>