From owner-svn-src-head@freebsd.org Fri Dec 4 16:26:10 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D571A4A4DBF; Fri, 4 Dec 2020 16:26:10 +0000 (UTC) (envelope-from arichardson.kde@gmail.com) Received: from mail-ej1-f67.google.com (mail-ej1-f67.google.com [209.85.218.67]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CndPG5Xgyz4vqv; Fri, 4 Dec 2020 16:26:10 +0000 (UTC) (envelope-from arichardson.kde@gmail.com) Received: by mail-ej1-f67.google.com with SMTP id g20so9539451ejb.1; Fri, 04 Dec 2020 08:26:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=IJuXNpH2QgYOV4QEtSoAAazLm9ShUo1vknUiR7h0sB4=; b=kX7XdZV+6z6EVXGM4dayoLc9mVdwb3xUyjWTPnvB9Q7V9rODUBlm9m2X28/3VFVzi0 1aY7WZP/ktWnomvy6fTP/IsmCYrfmi0oghQvTJgGV0rfOh1npHWVM4MSrcDYwUzpDeZK iIONa3whE2BqdJBVhvBTkPacwJZjiJkT0woTKe8V25fzLmAXGFEobHrtlCPJbCJxfyvJ 1pax8fWqyWH+BxXLqulygcUpevFztQ4ck/nDaQH2WtSR8sd0y3dKl2rKJwdaYDe6WUBN zU9uEqvvPqoeF8FvCTotQqMoyHZyFlsDxB9Ifju9Bg4DxV7YFwVZlgcLS4NgXnGA+di8 6htg== X-Gm-Message-State: AOAM5334++bc75vvESW4GS9XTtAZbDzG3+tQE3OW/HrHicdoIH/Z7x+8 17f+UEZgk/OBbQIjKIz0/vh8/95wJNK+hpJ9 X-Google-Smtp-Source: ABdhPJyylA/Kc3mB7vqNiCCKoaOe9e28rSQjyNclrvByy5hRkHjKJA9xuwuFW1ddqE/mE0SVhsIFlg== X-Received: by 2002:a17:907:414c:: with SMTP id od20mr7817989ejb.75.1607099169078; Fri, 04 Dec 2020 08:26:09 -0800 (PST) Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com. [209.85.221.46]) by smtp.gmail.com with ESMTPSA id 91sm4250160edy.45.2020.12.04.08.26.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Dec 2020 08:26:08 -0800 (PST) Received: by mail-wr1-f46.google.com with SMTP id z7so5895486wrn.3; Fri, 04 Dec 2020 08:26:08 -0800 (PST) X-Received: by 2002:a05:6000:112:: with SMTP id o18mr5803623wrx.7.1607099168451; Fri, 04 Dec 2020 08:26:08 -0800 (PST) MIME-Version: 1.0 References: <202012041450.0B4EouQ2024632@repo.freebsd.org> <6f9541e4-b216-8a93-881e-e3859bff84fa@selasky.org> In-Reply-To: <6f9541e4-b216-8a93-881e-e3859bff84fa@selasky.org> From: Alexander Richardson Date: Fri, 4 Dec 2020 16:25:57 +0000 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r368329 - head/stand/kshim To: Hans Petter Selasky Cc: src-committers , svn-src-all , svn-src-head , Konstantin Belousov Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4CndPG5Xgyz4vqv X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 16:26:10 -0000 On Fri, 4 Dec 2020 at 16:06, Hans Petter Selasky wrote: > > On 12/4/20 4:59 PM, Alexander Richardson wrote: > > On Fri, 4 Dec 2020 at 14:51, Hans Petter Selasky wrote: > >> > >> Author: hselasky > >> Date: Fri Dec 4 14:50:55 2020 > >> New Revision: 368329 > >> URL: https://svnweb.freebsd.org/changeset/base/368329 > >> > >> Log: > >> Fix definition of int64_t and uint64_t when long is 64-bit. This gets the kernel > >> shim code in line with the rest of the kernel, sys/x86/include/_types.h. > >> > >> MFC after: 1 week > >> Sponsored by: Mellanox Technologies // NVIDIA Networking > >> > >> Modified: > >> head/stand/kshim/bsd_kernel.h > >> > >> Modified: head/stand/kshim/bsd_kernel.h > >> ============================================================================== > >> --- head/stand/kshim/bsd_kernel.h Fri Dec 4 14:09:12 2020 (r368328) > >> +++ head/stand/kshim/bsd_kernel.h Fri Dec 4 14:50:55 2020 (r368329) > >> @@ -208,9 +208,17 @@ typedef unsigned int uint32_t; > >> #define _INT32_T_DECLARED > >> typedef signed int int32_t; > >> #define _UINT64_T_DECLARED > >> +#ifndef __LP64__ > >> typedef unsigned long long uint64_t; > >> +#else > >> +typedef unsigned long uint64_t; > >> +#endif > >> #define _INT16_T_DECLARED > >> +#ifndef __LP64__ > >> typedef signed long long int64_t; > >> +#else > >> +typedef signed long int64_t; > >> +#endif > >> > >> typedef uint16_t uid_t; > >> typedef uint16_t gid_t; > > > > Since we no longer support ancient compilers, could we simplify this > > and just use > > typedef __UINT64_TYPE__ uint64_t; > > typedef __INT64_TYPE__ int64_t; > > ? > > > > This will work across all architectures and ABIs, and appears to work > > starting with GCC 4.5.3 and Clang 3.5: > > https://godbolt.org/z/TWavfb > > Hi Alexander, > > I'm not sure how that definition will work together with existing code, > mixing uint64_t, unsigned long, and unsigned long long. Will this cause > more compiler warnings? This also will affect user-space and ports. > > Maybe Konstantin, CC'ed, has some input on this? > > --HPS > I haven't looked at GCC's source code, but clang tries to make __UINT64_TYPE__ expand to what the target expects: it picks unsigned long/unsigned long long depending on the target OS and architecture. E.g. if I look at clang/Basic/Targets/AArch64.cpp, I can see that clang uses unsigned long for uint64_t everywhere except OpenBSD/Windows/Darwin where it uses unsigned long long. Alex