NetBSD-Users archive

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

Re: DNSSEC vs netbsd-8/sparc?



On Tue, Apr 21, 2020 at 10:56 AM Havard Eidnes <he%netbsd.org@localhost> wrote:
>
> > Does anybody think that the bind bits in netbsd-8 are ok, even before we
> > talk about compilation?
>
> I'm about halfway through the diff between what's in-tree in
> netbsd-8 and what's in ISC BIND 9.10.5-P1, and all I find so far
> are
> ...
> Hmm, wait a bit... One commonality between sparc, sparc64 and
> macppc is that they're all big-endian.  ... and in
> external/bsd/bind/include/config.h (which is "pre-cooked" in
> NetBSD, but the corresponding file is generated by configure by
> the ISC build setup) we find this part:
>
> /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
>    significant byte first (like Motorola and SPARC, unlike Intel). */
> #ifndef __NetBSD__
> /* Defined by the build process */
> #if defined AC_APPLE_UNIVERSAL_BUILD
> # if defined __BIG_ENDIAN__
> #  define WORDS_BIGENDIAN 1
> # endif
> #else
> # ifndef WORDS_BIGENDIAN
> /* #  undef WORDS_BIGENDIAN */
> # endif
> #endif
> #endif
>
> which on NetBSD ends up not defining WORDS_BIGENDIAN ever, which
> is OK for little-endian platforms, but not quite for the others.
> Let's see...
>
> Index: include/config.h
> ===================================================================
> RCS file: /cvsroot/src/external/bsd/bind/include/Attic/config.h,v
> retrieving revision 1.20.8.1
> diff -u -r1.20.8.1 config.h
> --- include/config.h    21 Jun 2017 18:03:51 -0000      1.20.8.1
> +++ include/config.h    21 Apr 2020 14:26:04 -0000
> @@ -594,6 +594,11 @@
>  /* #  undef WORDS_BIGENDIAN */
>  # endif
>  #endif
> +#else /* __NetBSD__ */
> +# include <endian.h>
> +# if _BYTE_ORDER == _BIG_ENDIAN
> +#  define WORDS_BIGENDIAN 1
> +# endif
>  #endif
>
>  /* Define to empty if `const' does not conform to ANSI C. */
>
> fixes it!  After re-building libs and reinstalling them:

Yeah, it looks like the preprocessor test is not correct.

To test for endianess using modern compilers, like GCC, Clang, XLC and
SunCC, you have to test for __LITTLE_ENDIAN__ and __BIG_ENDIAN__.
Other tests are unreliable.

Jeff


Home | Main Index | Thread Index | Old Index