From patchwork Thu Feb 20 08:55:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 24975 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f70.google.com (mail-qa0-f70.google.com [209.85.216.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 356C32066E for ; Thu, 20 Feb 2014 08:58:59 +0000 (UTC) Received: by mail-qa0-f70.google.com with SMTP id m5sf2927798qaj.1 for ; Thu, 20 Feb 2014 00:58:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mime-version:in-reply-to:references :date:message-id:subject:from:to:cc:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:content-type :content-transfer-encoding; bh=9ME+WXaGKe20iYtG5EaispZ+s7KIsdK6lj86qUGsp7A=; b=KHh06VfePFqjzWsn0l4QXJgk4Jdztm9yodmEeET1vujkD+9OQARZGJgTfTa8nYFNO3 KTq/uYripnK3W87vLboWrpmAuTE92NcJzgCOn/jVRCPD2hy+X+xlpPplwqvUZRBBm4n6 07fG6e1T4BSKKPwtuvDtIBt4SrdwJ6iayWwggs7TLJutXTNPm9yGg63bZ9y9J7T6OZf4 xTb/w/UNij20oIqZjoeZgJN5V5MZBwsKLfaVRUiiS5g04/9a/j8T5bUOiMP07C93rAhM nTZZA+rvfZyygPP4ZHDUlbdK4vR7NZauKN55vyb3hgMaRPtMdZL0/nBtDM13PmFQc+zp 4GXw== X-Gm-Message-State: ALoCoQnFO7lYemI+a1rCiNEKlXZAlPswh+L+L2Ajcxt3StqzgR7pq8hjy4U9jll+22I5e6N3cmND X-Received: by 10.224.47.129 with SMTP id n1mr292395qaf.4.1392886738829; Thu, 20 Feb 2014 00:58:58 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.21.136 with SMTP id 8ls410874qgl.27.gmail; Thu, 20 Feb 2014 00:58:58 -0800 (PST) X-Received: by 10.236.47.162 with SMTP id t22mr960864yhb.123.1392886738690; Thu, 20 Feb 2014 00:58:58 -0800 (PST) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id e36si3048006yhf.19.2014.02.20.00.58.58 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Feb 2014 00:58:58 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.171; Received: by mail-vc0-f171.google.com with SMTP id le5so1575128vcb.16 for ; Thu, 20 Feb 2014 00:58:58 -0800 (PST) X-Received: by 10.52.61.168 with SMTP id q8mr307397vdr.40.1392886738486; Thu, 20 Feb 2014 00:58:58 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.174.196 with SMTP id u4csp40705vcz; Thu, 20 Feb 2014 00:58:57 -0800 (PST) X-Received: by 10.180.189.10 with SMTP id ge10mr5743849wic.47.1392886736375; Thu, 20 Feb 2014 00:58:56 -0800 (PST) Received: from casper.infradead.org (casper.infradead.org. [2001:770:15f::2]) by mx.google.com with ESMTPS id ha2si4330356wib.6.2014.02.20.00.58.56 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Feb 2014 00:58:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:770:15f::2 as permitted sender) client-ip=2001:770:15f::2; Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WGPRN-0004wl-6C; Thu, 20 Feb 2014 08:57:10 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WGPQk-00068b-Hf; Thu, 20 Feb 2014 08:56:30 +0000 Received: from mail-lb0-f177.google.com ([209.85.217.177]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WGPQV-00065r-Kp for linux-arm-kernel@lists.infradead.org; Thu, 20 Feb 2014 08:56:17 +0000 Received: by mail-lb0-f177.google.com with SMTP id 10so1100895lbg.36 for ; Thu, 20 Feb 2014 00:55:48 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.152.206.104 with SMTP id ln8mr368204lac.67.1392886548104; Thu, 20 Feb 2014 00:55:48 -0800 (PST) Received: by 10.112.29.200 with HTTP; Thu, 20 Feb 2014 00:55:48 -0800 (PST) In-Reply-To: References: <1390768248-1688-1-git-send-email-ard.biesheuvel@linaro.org> <20140217122334.GA19102@arm.com> <20140217174247.GA8361@arm.com> <20140217180237.GC8361@arm.com> Date: Thu, 20 Feb 2014 09:55:48 +0100 Message-ID: Subject: Re: [PATCH] arm64: add workaround for ambiguous C99 stdint.h types From: Ard Biesheuvel To: Catalin Marinas X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140220_035615_883697_3A40D2DD X-CRM114-Status: GOOD ( 20.01 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.217.177 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Will Deacon , Dave P Martin , "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ard.biesheuvel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 On 17 February 2014 19:17, Ard Biesheuvel wrote: > On 17 February 2014 19:02, Catalin Marinas wrote: >> On Mon, Feb 17, 2014 at 05:57:22PM +0000, Ard Biesheuvel wrote: >>> On 17 February 2014 18:42, Catalin Marinas wrote: [...] >>> > For other intrinsics that we use like __builtin_ctzl(), do we need to >>> > explicitly include gcc headers? I don't think we do and I really don't >>> > like such arm_neon.h include which brings in other user headers. Don't >>> > we have any work around this? >>> >>> Well, I talked to the toolchain guys at the time and they really >>> disliked the idea of coding directly against the __builtins because >>> they are not considered a stable interface, especially because the >>> interface that /is/ considered stable (arm_neon.h) is supported both >>> on ARM and on arm64. >> >> Than we don't use the Neon __builtins in the kernel. >> >>> > My inbox only has some discussion in May last year on the linaro-kernel >>> > list without any clear conclusion (it could be that I deleted other >>> > emails). >>> >>> There was some discussion, indeed, but for ARM, with the conclusion >>> being the fix I mentioned in the patch: 09096f6a0ee2 ("ARM: 7822/1: >>> add workaround >>> for ambiguous C99 stdint.h types"), only in that case, the ambiguity >>> is (unsurprisingly) about the 32 bit types, not the 64 bit ones. >> >> My worry is that some future toolchain may include something else in >> this file and get other type conflicts. It really looks fragile. >> > > Well, the GCC folks are quite careful not to depend on arbitrary user > headers when the -ffreestanding option is set. Also, the real problem > is the fact that Linux defines C99 types, but does so in an > incompatible way. (I.e., one could also argue that the Linux typedefs > should be based on GCC's builtin #defines of __INT64_TYPE, > __UINT64_TYPE, etc if defined). So the chances of something similar > reappearing all of a sudden are quite slim imo. > Perhaps this alternative approach would be better? tells us exactly which types it thinks should be used for typedef'ing [u]int64_t. Anyway, I am perfectly happy to park this until a real use case shows up. I have some crypto coded up in intrinsics, but we won't know if it's fast enough until I manage to run it on actual hardware. Regards, Ard. diff --git a/include/linux/types.h b/include/linux/types.h index 4d118ba11349..78344874fff0 100644 --- a/include/linux/types.h +++ b/include/linux/types.h @@ -108,9 +108,9 @@ typedef __u16 uint16_t; typedef __u32 uint32_t; #if defined(__GNUC__) -typedef __u64 uint64_t; -typedef __u64 u_int64_t; -typedef __s64 int64_t; +typedef __UINT64_TYPE__ uint64_t; +typedef __UINT64_TYPE__ u_int64_t; +typedef __INT64_TYPE__ int64_t; #endif I mean, we are already depending explicitly on __GNUC__, and GNUC