Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2070189ybb; Thu, 26 Mar 2020 21:08:29 -0700 (PDT) X-Google-Smtp-Source: ADFU+vt6gMohBUdFkZVdZ/L3R+8EJm8dn9/MnyonDJXvvUlx7E5OqUv3i7L5wkfQdGkjCEoTdbL6 X-Received: by 2002:a4a:db87:: with SMTP id s7mr7887811oou.38.1585282109084; Thu, 26 Mar 2020 21:08:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585282109; cv=none; d=google.com; s=arc-20160816; b=GzMO9C/TEgKTw+JqAjuBh943pCiBXvk98jxPh0x8xGkjgYSabVbkWC1Xz8PqZhgZAW 9rjGgJ9Bh41bt/BB/lkJGeJw7LaaFfppsDbVFWLIzmTzYhLklF7eUI4GW9CvdofFJCec pgGMzn8T/l5qBU+L08WXoOg5ylURzYnmaSqaJEoubg82nDKJGDeAcRFBW0S13Qe9uxvH 9ngxpsPrsvSWG0BFfNhv98Vln9pb3XfPVXYQioinqgiclmOFgHkJodatr17Wa1+6B4jD 5x/RqzPFAfZKZP0m+U0989ow6cVt8EjcDOdsBnNGv306k5InpqMCdFu+RQToqXwf68D7 0D6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=8qLw4G8wz3yDALhNVk8Egjke+0sAAvmqxPMG/Lc5cWI=; b=sktDbDK6Yeqp3XsxvFNd+HdTn28BCYxg5Td1JMNXzr0sOjEE7SR0qINJhSzVW9lOd+ jxkKjG69H3bvQW+aNQzFuOWBUEQBfyth+sMMV47y5B+1+JMVGhwgw6Au0PMPtG3cfJaf rGYGYXgsGSZf+Au2468TrZi5jD9ORZ/S2lFDhxs5bFM1/Dmg4JKOZLCtestfnwTgrhRp KHDERAKN5wSoi1cuI68vI0MAUfSzq4bJLYy9oH72D5ofdoU7N/11qOATBWWKT1mNynyO F5eN0WxEUjbrPD0UFLCsseP6JmLAZ0CmgzjFfEKt6C1t6fCNgFs8V9cV80i1Qp2m8YC1 YzmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=RhdHyhJP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h20si1800587oie.28.2020.03.26.21.08.16; Thu, 26 Mar 2020 21:08:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=RhdHyhJP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726275AbgC0EGR (ORCPT + 99 others); Fri, 27 Mar 2020 00:06:17 -0400 Received: from ozlabs.org ([203.11.71.1]:46819 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725822AbgC0EGR (ORCPT ); Fri, 27 Mar 2020 00:06:17 -0400 Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 48pSvf1RWFz9sSN; Fri, 27 Mar 2020 15:06:06 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ellerman.id.au; s=201909; t=1585281973; bh=kg/R97OXCQPDDw7FjCMRczi3AXDimlrIJshJ+0pnob4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=RhdHyhJPd79i6SoBIDesf0HUyhI9j0YvFvyFh9Gf/MXAKdkl710wlwwmaGbyJ6zh+ bivuu8WPX+4dFuoK0stxg431SLoKSzazK993OZta6D9Bo7/utRu7ukDFwmbhm/s0Lb umLyukSNtKydfA0L0rpPhFpPoyHtlSPLlqg7yUhvyr6BW2dc7YUUU7Jh5hxOsepzLk 1atEgTiCDrRyWeXv3WYWvCb1kEuQ3c8HOEEa6hjRnD2CR7hK9GWRnmdXwB+8QH01Ad +3De2LQ6NAOBujDlYtt0CxcL9YWGmSWUzht4KUV4r/QXPalxXplngcIyL/9uj0A3fI nOXiUI31uJNVA== From: Michael Ellerman To: Clement Courbet Cc: Nathan Chancellor , Kees Cook , Nick Desaulniers , Joe Perches , Bernd Petrovitsch , Benjamin Herrenschmidt , Paul Mackerras , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org, Segher Boessenkool , Greg Kroah-Hartman , Allison Randal , Clement Courbet , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com Subject: Re: [PATCH] x86: Alias memset to __builtin_memset. In-Reply-To: <20200326123841.134068-1-courbet@google.com> References: <20200323114207.222412-1-courbet@google.com> <20200326123841.134068-1-courbet@google.com> Date: Fri, 27 Mar 2020 15:06:14 +1100 Message-ID: <87a742wifd.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Clement Courbet writes: > I discussed with the original authors who added freestanding to our > build. It turns out that it was added globally but this was just to > to workaround powerpc not compiling under clang, but they felt the > fix was appropriate globally. > > Now Nick has dug up https://lkml.org/lkml/2019/8/29/1300, which > advises against freestanding. Also, I've did some research and > discovered that the original reason for using freestanding for > powerpc has been fixed here: > https://lore.kernel.org/linuxppc-dev/20191119045712.39633-3-natechancellor@gmail.com/ > > I'm going to remove -ffreestanding from downstream, so we don't really need > this anymore, sorry for waisting people's time. > > I wonder if the freestanding fix from the aforementioned patch is really needed > though. I think that clang is actually right to point out the issue. > I don't see any reason why setjmp()/longjmp() are declared as taking longs > rather than ints. The implementation looks like it only ever propagates the > value (in longjmp) or sets it to 1 (in setjmp), and we only ever call longjmp > with integer parameters. But I'm not a PowerPC expert, so I might > be misreading the code. > > > So it seems that we could just remove freestanding altogether and rewrite the > code to: > > diff --git a/arch/powerpc/include/asm/setjmp.h b/arch/powerpc/include/asm/setjmp.h > index 279d03a1eec6..7941ae68fe21 100644 > --- a/arch/powerpc/include/asm/setjmp.h > +++ b/arch/powerpc/include/asm/setjmp.h > @@ -12,7 +12,9 @@ > > #define JMP_BUF_LEN 23 > -extern long setjmp(long *); > -extern void longjmp(long *, long); > +typedef long * jmp_buf; > + > +extern int setjmp(jmp_buf); > +extern void longjmp(jmp_buf, int); > > I'm happy to send a patch for this, and get rid of more -ffreestanding. > Opinions ? If it works then it looks like a much better fix than using -ffreestanding. Please submit a patch with a change log etc. and I'd be happy to merge it. cheers