From ab2032371edc4a656ddbdfc0f2411b6ee6e2b7e9 Mon Sep 17 00:00:00 2001 From: Brandon Bergren Date: Wed, 23 Sep 2020 02:37:27 +0000 Subject: [PATCH] [PowerPC] Fix multiple ntp configuration issues * powerpc time_t is 64 bit, not 32 bit. * Add definition for powerpc64le. With this, powerpc64le ntpd and ntpdate operate correctly instead of corrupting the clock and exiting. Tested on powerpc64, powerpc64le, and powerpc. No feedback from cy@. I am a bit confused as to how SIZEOF_TIME_T being wrong ever worked on powerpc, it being big endian and all. Sponsored by: Tag1 Consulting, Inc. Differential Revision: https://reviews.freebsd.org/D26379 --- usr.sbin/ntp/config.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/usr.sbin/ntp/config.h b/usr.sbin/ntp/config.h index a7aaa24467a..7446d199e16 100644 --- a/usr.sbin/ntp/config.h +++ b/usr.sbin/ntp/config.h @@ -1548,7 +1548,7 @@ #define SIZEOF_SIGNED_CHAR 1 /* The size of `time_t', as computed by sizeof. */ -#if defined(__i386__) || defined(__powerpc__) +#if defined(__i386__) #define SIZEOF_TIME_T 4 #else #define SIZEOF_TIME_T 8 @@ -1580,6 +1580,8 @@ /* canonical system (cpu-vendor-os) of where we should run */ #if defined(__amd64__) #define STR_SYSTEM "amd64-undermydesk-freebsd" +#elif defined(__powerpc64__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +#define STR_SYSTEM "powerpc64le-undermydesk-freebsd" #elif defined(__powerpc64__) #define STR_SYSTEM "powerpc64-undermydesk-freebsd" #elif defined(__powerpc__) @@ -1660,8 +1662,8 @@ typedef unsigned int uintptr_t; /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ -#if defined(__ARMEB__) || defined(__MIPSEB__) || defined(__powerpc__) || \ - defined(__powerpc64__) +#if defined(__ARMEB__) || defined(__MIPSEB__) || \ + (defined(__powerpc__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) #define WORDS_BIGENDIAN 1 #endif