Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1690611ybb; Thu, 26 Mar 2020 05:40:43 -0700 (PDT) X-Google-Smtp-Source: ADFU+vu2Cj7KyYobQ3o4Y9bO+1ZVi3gXkVzSWu474++KGRF2pm+b0bIEkG9korAGJoajFU4Gq7d3 X-Received: by 2002:aca:cdd1:: with SMTP id d200mr1507877oig.153.1585226443406; Thu, 26 Mar 2020 05:40:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585226443; cv=none; d=google.com; s=arc-20160816; b=koHRo1QUXNMtFLse6cV+TMre5MkHMjwY+LvHMZaWLPmwxuG7xt8VA/WWj3sp2Ul780 gvNmhRndUKuPPDpjs5DbcfeSY+FJV4/lK9deHyMFlV+8J2lxMeJYHJyryK5FrgVfu4xj UpE8QIdiJlsvndGM1kPYgJCNkq9JKjagqNMoCflW4yNx6/DpKIzsqHMwG16xLpcfWnUS y/1SRhAL/tgJONrk7Mua7rZ5Cn7O//4oo8/LfxkFkQjSn7gwN1ZO7lfh/aNsHSc+bhRb wmE1rSzTM4rPg3hdhedghgyMhIhtQjsIJgGp4LC0ac9vrrydwZ/QVYUZnzyjbpm8bD3n ESSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:cc:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=8yqBrfdJM+UOOeS4se8770yNMpiUTGHQoT5T8DP4qB8=; b=hXkHgYFkIwiM7doPuTTvD+dy1lswwwXiuYHdebl0oTIOWMrAjs+mZt2Jwg1/qS5BMb 0pdDz/6xtmBL6I2Uw77+3iGBLBQw/yoXFmcqiHP5S6rF6NJu5FsIzHSPGk2TaovBB7SM qOIiIzNXymRkUbFu2rWOnDFs809YeCe5XU1Zaq5rsTyj9Abk2OoThPES0W4ceuIN3p/2 jYhK13p5vaFyVb2hgaiXnyua7tYb9f57GURLZGzpK4PIq4hKnX1dRKOci0T+gFMtYNfy GNK1M8LF1fOzYR9KWi/wW+fwNtS9xL515pSHz70mMLmzRqgtcMYtuXloMo5L6G+ZQf4Q mDiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="cz8v/be9"; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j26si1154640otk.98.2020.03.26.05.40.30; Thu, 26 Mar 2020 05:40:43 -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=@google.com header.s=20161025 header.b="cz8v/be9"; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728225AbgCZMiw (ORCPT + 99 others); Thu, 26 Mar 2020 08:38:52 -0400 Received: from mail-wm1-f73.google.com ([209.85.128.73]:52951 "EHLO mail-wm1-f73.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727841AbgCZMiv (ORCPT ); Thu, 26 Mar 2020 08:38:51 -0400 Received: by mail-wm1-f73.google.com with SMTP id w9so2122553wmi.2 for ; Thu, 26 Mar 2020 05:38:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:cc; bh=8yqBrfdJM+UOOeS4se8770yNMpiUTGHQoT5T8DP4qB8=; b=cz8v/be9ZLdMPE+hQeq2vnACmD7uqiN8Lq6TKluF0QZdRurVUMGO/Nkjigif91QwY5 3olUJsW79QJtQwo5MICQlAayampaZfYhnd5DOxSPhJlu6zUUdJM4An/CEtBX5syjwFrG bFnI62fgBXnQKzFiADNm0p+P0J0/oahYLaUiZInfTgRUpLv+HtnQmtyNYbeQ+PWoZQQK IYDBtpV7vZAFYxyrL9CbgSFM7vWPsht7QzsRMnfxoDLktjlvax679zqjDQ4VWW+T+eBz 0A3H7eBt/5Jv9KIkWdE4h5ZCPUq39MtsDrxg0UgLD53g4NY0vJV698NDiz7G7dKZr725 4Qgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:cc; bh=8yqBrfdJM+UOOeS4se8770yNMpiUTGHQoT5T8DP4qB8=; b=YHbThTposXPbzFR89r09dXciOc6whkFzREhvrb4OMHw3JJcb42xzZv9bjdXof7HclR TcL43ObWOpsPl9x6WpPfbl1mogyIq8uWjc+i8TIcvx88ZOY30mcDRptIY6Km82XmcEBG wsG6QywO/Bk2U63MJn5bOHcGCywqGvcA6E1tKe4KpxQi3wJttwd8/xomVn8V8vRXvHgX IwuTOJc/gyAbMyrsnwf7K9a5IuBjYHOumrUi5U3+Be1ZwqkTctGGkYmG3vbY8B2KEWb+ cq/wPaavC/RBDFsdmDQ4u5ungPVJ2oXhuEY4M9TSA4kUYym0ru5mE/3y6PNNoi9Vz6nN oicQ== X-Gm-Message-State: ANhLgQ1w0M7Y6oDtYZk4XGXZkvpKchFMM1RAQQzIdKBxoCMKihR9Bcnc 12GSnCm/fADI5+sB/gve9lbtls6jAdXv X-Received: by 2002:adf:a2d8:: with SMTP id t24mr9044184wra.366.1585226330006; Thu, 26 Mar 2020 05:38:50 -0700 (PDT) Date: Thu, 26 Mar 2020 13:38:39 +0100 In-Reply-To: <20200323114207.222412-1-courbet@google.com> Message-Id: <20200326123841.134068-1-courbet@google.com> Mime-Version: 1.0 References: <20200323114207.222412-1-courbet@google.com> X-Mailer: git-send-email 2.25.1.696.g5e7596f4ac-goog Subject: [PATCH] x86: Alias memset to __builtin_memset. From: Clement Courbet Cc: Nathan Chancellor , Kees Cook , Nick Desaulniers , Joe Perches , Bernd Petrovitsch , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , 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 Content-Type: text/plain; charset="UTF-8" To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 ?