From patchwork Wed May 3 20:07:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akshay Adiga X-Patchwork-Id: 758189 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wJ8Nr5494z9rxl for ; Thu, 4 May 2017 06:08:28 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3wJ8Nr3pNszDqFy for ; Thu, 4 May 2017 06:08:28 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3wJ8Nj6f4YzDqBH for ; Thu, 4 May 2017 06:08:21 +1000 (AEST) Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v43K3o2Q170604 for ; Wed, 3 May 2017 16:08:12 -0400 Received: from e23smtp09.au.ibm.com (e23smtp09.au.ibm.com [202.81.31.142]) by mx0b-001b2d01.pphosted.com with ESMTP id 2a7m0qcvrh-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 03 May 2017 16:08:12 -0400 Received: from localhost by e23smtp09.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 4 May 2017 06:08:09 +1000 Received: from d23relay08.au.ibm.com (202.81.31.227) by e23smtp09.au.ibm.com (202.81.31.206) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 4 May 2017 06:08:08 +1000 Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.235.139]) by d23relay08.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v43K7xG959768864 for ; Thu, 4 May 2017 06:08:07 +1000 Received: from d23av04.au.ibm.com (localhost [127.0.0.1]) by d23av04.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v43K7Y59027521 for ; Thu, 4 May 2017 06:07:34 +1000 Received: from aksadiga.in.ibm.com ([9.78.206.57]) by d23av04.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v43K7Tax027186; Thu, 4 May 2017 06:07:31 +1000 From: Akshay Adiga To: skiboot@lists.ozlabs.org Date: Thu, 4 May 2017 01:37:06 +0530 X-Mailer: git-send-email 2.5.5 X-TM-AS-MML: disable x-cbid: 17050320-0052-0000-0000-00000238BABE X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17050320-0053-0000-0000-00000813C5F0 Message-Id: <1493842026-9345-1-git-send-email-akshay.adiga@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-05-03_14:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1705030352 Subject: [Skiboot] [RFC] Add support for glibc style endianess detection X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" CCAN defines HAVE_LITTLE_ENDIAN or HAVE_BIG_ENDIAN to endianess of the system and code developed on top of glibc expect __BYTE_ORDER to tell the endianess. Suggested-by: Benjamin Herrenschmidt Signed-off-by: Akshay Adiga --- Other attempt: 1) when named as include/endian.h, conflicted with host include files (gcov build failed). include/glibc_endian.h | 36 ++++++++++++++++++++++++++++++++++++ include/skiboot.h | 2 +- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 include/glibc_endian.h diff --git a/include/glibc_endian.h b/include/glibc_endian.h new file mode 100644 index 0000000..8b1ce5f --- /dev/null +++ b/include/glibc_endian.h @@ -0,0 +1,36 @@ +/* Copyright 2013-2014 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef GLIBC_ENDIAN_H +#define GLIBC_ENDIAN_H + +#include + +/* + * CCAN does not export __BYTE_ORDER hence copying definitions from + * glibc + */ +#define __LITTLE_ENDIAN 1234 +#define __BIG_ENDIAN 4321 +#ifdef HAVE_LITTLE_ENDIAN + #define __BYTE_ORDER __LITTLE_ENDIAN +#elif HAVE_BIG_ENDIAN + #define __BYTE_ORDER __BIG_ENDIAN +#else + #error +#endif +#endif + diff --git a/include/skiboot.h b/include/skiboot.h index 5c8b0c8..519c5fe 100644 --- a/include/skiboot.h +++ b/include/skiboot.h @@ -27,13 +27,13 @@ #include #include #include +#include #include #include #include #include #include -#include #include #include