From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 168EFC43331 for ; Fri, 27 Mar 2020 04:06:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DCA012073E for ; Fri, 27 Mar 2020 04:06:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ellerman.id.au header.i=@ellerman.id.au header.b="RhdHyhJP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726360AbgC0EGR (ORCPT ); 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