From patchwork Thu Sep 19 22:18:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 34608 Received: (qmail 100615 invoked by alias); 19 Sep 2019 22:22:42 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 100603 invoked by uid 89); 19 Sep 2019 22:22:42 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT autolearn=ham version=3.3.1 spammy= X-HELO: esa4.hgst.iphmx.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1568931760; x=1600467760; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=MUygrf/CuL+CbHPDlriqZDsbzaPhRVPMdMUL0NfbQro=; b=fTUPg9lVyLLJJyFbfMy2c0yoLpo9mvcJlSLGqglP0AysfKzt8LvO0cq+ VNNcSETdZh9A6m0YItwlXnIs1ReJYFbl3izmHBjzRkQW/1QO8ZbMREsMr nvhe7SdyNH1W3YUwxm3rfywiMnavQVHbTkLF25GSHoUhUWZBvF28lID5i daegDshRn1pzg7ap5SPzy6eAQVH63xw5ijRHn4T+cDpcoFa5RI6poc75y 08jUB03HYjaOqFyS0XhMiphzeg3j5D38lFe5XkadESFOVAW6f1fCG+erJ fFjqz+DGFapi7revsJ4UFKngZ6wPtgy8Vo1/T/Wuwzr0zZ+TMipNlt7zb w==; IronPort-SDR: KEhDePQ23/gzgvVEyzQAAIGaGpIOOOnXwKH/1ZF2+7dwTuUSvG14EnGO9PYKiPpARibgos/swY JGhvMJjlDDAiuSUCBnmFm085apC3WIcQ0gJl+P3qOmnXpF7clJJPAdJWMJLbA34cWXpTPepkR0 Yftxsjc7m4xzRC0seJ1aFXYWMw8YKhndFHGQMaxaiNHc9zdeArXwbj5UeBq9h1L2gL2iAAptcL kUFvIkNjrK1FsfLN2XjBpSb1FViyZ6r+0QH82wY3BOeWmiPKHNKl0tI3rdfljxOdX14Tg6YyXs 9Os= IronPort-SDR: AfftF62VWdJv3ILm4MM9f4k5My51ZzUZ1H5L0KP1ZnjXoLjj7cu8qxs0aSUv6PcWjAOinZ/2Dt olRsaU91oJULB4GCozztHEVlLkNdl2gVFbr1HVs+czezj1Js3Kje1Mmcw1YxFREYTjGz9VVLBY oBCohClV5vSOVFBVmDZnRgqE1Yid/IcrXPQ/b0DDob+DhhdSlmewmqpY3PF9b3YqKE/WufOHGd /NVOU83e5eIcC+jBbGVv28wc7ulSgSi4zRZSsJ7qxeFx/v++sRj2rR8Hud3PPvFlU9GRal9zNB t7cw5Z4PIiZ9KPZ4+q95kfvQ IronPort-SDR: VsyVcGW6f13AXWF/ELGRoIIrw0BQaYeFYbDLInzv61gdM6G0+oZtkQPX3dMcrkHZrzfCgsareL RODr01ZG4iik1GDujPk1//CpkdSLcPzxl/cx1P5Tqwef/VyGwZl6jZpXvm5BXUYqVyrKy75ZPP aMUNlk7d+n9dWUEb5UWOWgCtBU+QwhglUPaG5Mg9AjX4R73tFSTgq4zXanh40LdezZImY/6ahR lUf3wMuvrcRc9kLHpfF58IIJ6ZpFyEWz8d4Ca15hv0TsJGRPpYGQDHtpejODn2GbHevYQVh+fC Rrg= WDCIronportException: Internal From: Alistair Francis To: libc-alpha@sourceware.org Cc: joseph@codesourcery.com, Alistair Francis Subject: [RFC] time: Create a endian_t.h headerfile Date: Thu, 19 Sep 2019 15:18:28 -0700 Message-Id: <20190919221829.6137-1-alistair.francis@wdc.com> MIME-Version: 1.0 To allow struct __timespec64 and struct timespec to be the same on a 32-bit architecture with a 64-bit time_t we need to add padding to the struct timespec. This padding requires knowledge of the machines endianess, which requires us exporting the endianness in time/bits/types/struct_timespec.h. To reduce the number of macros that we are exporting let's split out an endian_t.h header file that can be used. 2019-09-19 Alistair Francis * bits/endian.h: Create a endian_t.h headerfile. * string/endian.h: Create a endian_t.h headerfile. * sysdeps/aarch64/bits/endian.h: Allow including from endian_t.h. * sysdeps/alpha/bits/endian.h: Likewise. * sysdeps/arm/bits/endian.h: Likewise. * sysdeps/csky/bits/endian.h: Likewise. * sysdeps/hppa/bits/endian.h: Likewise. * sysdeps/m68k/bits/endian.h: Likewise. * sysdeps/microblaze/bits/endian.h: Likewise. * sysdeps/mips/bits/endian.h: Likewise. * sysdeps/nios2/bits/endian.h: Likewise. * sysdeps/powerpc/bits/endian.h: Likewise. * sysdeps/riscv/bits/endian.h: Likewise. * sysdeps/s390/bits/endian.h: Likewise. * sysdeps/sh/bits/endian.h: Likewise. * sysdeps/sparc/bits/endian.h: Likewise. * sysdeps/unix/sysv/linux/ia64/bits/endian.h: Likewise. * sysdeps/x86/bits/endian.h: Likewise. * time/bits/types/endian_t.h: New file. --- This is based on the feedback from: https://sourceware.org/ml/libc-alpha/2019-09/msg00272.html bits/endian.h | 2 +- string/endian.h | 16 +--------- sysdeps/aarch64/bits/endian.h | 2 +- sysdeps/alpha/bits/endian.h | 2 +- sysdeps/arm/bits/endian.h | 2 +- sysdeps/csky/bits/endian.h | 2 +- sysdeps/hppa/bits/endian.h | 2 +- sysdeps/m68k/bits/endian.h | 2 +- sysdeps/microblaze/bits/endian.h | 2 +- sysdeps/mips/bits/endian.h | 2 +- sysdeps/nios2/bits/endian.h | 2 +- sysdeps/powerpc/bits/endian.h | 2 +- sysdeps/riscv/bits/endian.h | 2 +- sysdeps/s390/bits/endian.h | 2 +- sysdeps/sh/bits/endian.h | 2 +- sysdeps/sparc/bits/endian.h | 2 +- sysdeps/unix/sysv/linux/ia64/bits/endian.h | 2 +- sysdeps/x86/bits/endian.h | 2 +- time/bits/types/endian_t.h | 36 ++++++++++++++++++++++ 19 files changed, 54 insertions(+), 32 deletions(-) create mode 100644 time/bits/types/endian_t.h diff --git a/bits/endian.h b/bits/endian.h index 45afd4ae477..29838739049 100644 --- a/bits/endian.h +++ b/bits/endian.h @@ -6,7 +6,7 @@ So if cross-compiling to a machine with a different byte order, the bits/endian.h file for that machine must exist. */ -#ifndef _ENDIAN_H +#ifndef _ENDIAN_T_H # error "Never use directly; include instead." #endif diff --git a/string/endian.h b/string/endian.h index 17e4e893fb5..e23484c1f0f 100644 --- a/string/endian.h +++ b/string/endian.h @@ -19,21 +19,7 @@ #define _ENDIAN_H 1 #include - -/* Definitions for byte order, according to significance of bytes, - from low addresses to high addresses. The value is what you get by - putting '4' in the most significant byte, '3' in the second most - significant byte, '2' in the second least significant byte, and '1' - in the least significant byte, and then writing down one digit for - each byte, starting with the byte at the lowest address at the left, - and proceeding to the byte with the highest address at the right. */ - -#define __LITTLE_ENDIAN 1234 -#define __BIG_ENDIAN 4321 -#define __PDP_ENDIAN 3412 - -/* This file defines `__BYTE_ORDER' for the particular machine. */ -#include +#include