Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp399286ybx; Tue, 29 Oct 2019 21:15:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqyx+kHDQhBFahryGtJ9fSiRwUcQxEIRHazriRC99ubjLOgn3bNFNcVZG78KqTVSiA+fhq2F X-Received: by 2002:a17:906:e86:: with SMTP id p6mr6234988ejf.52.1572408945028; Tue, 29 Oct 2019 21:15:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572408945; cv=none; d=google.com; s=arc-20160816; b=SJEMYgxU4ym1k2PISI0uuU5kvMCuTqXsypG0uG+5j1Ih1WCeab24BQA40VmrPqK+Lr Pkm5Tl/byGEJ2DR4sBVyM2Zga1+bmLVaDKv4kSIzKtdiZekUsGDMcFy9cnVg+Y5nx8Gs T9PsbBTP6FSB9IG4jEy55be4xGxvlz5NEjN12hFp58u+YTxcA+0gZjYBq6ENGX/QSVaz 6DQQA5XMR7GPOFR2ra8TLeys520x3wsS0yOmyrUVxYpAbrNEMKT8nD54opMF9qAoaBtk Gru89uYUwm7+XXFsTE6ut88YsWuAiEfuZDU5JbrEerlcH7L5Lj8pKyZIfbE0kXTVKHm9 gplA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=q8SBmE+8CAuRsopHcvNfJ0iOGe3QE73CA4UWHXUOwzo=; b=xVre57FOV7tMe7At+iW5ebqLvgDphNtzK89sMlrVWj+Wl28W/bHfH7Zcq5y8zCY2qk zcXehPhGXsSkZIR5/nGOpr+Q0SPPaYbZy/7hLg1Uv7k3YcpQ7j9rcolOcVhHJ4Ez6HAN lxgDvFj0agTooO8cifJluhbbz0JD5QlNo2TlKgvtH/wZIpyIhBBn5KYU5j8EKI4/LANA dSCkSRkyQu2PcoBeekmAgiZyh6gyZU84kf2+XQ5VPP/G3ZSEBv5EMx0SogBvGRhyBlae tu2/0vGuaTFpf8vMfAgbezz9OjCZkaBJ1WV8i7aEe1Ry+ga9D6vxyeAeb+6FYDv801vk jzBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=NlVcq7fl; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n9si473376ejc.244.2019.10.29.21.15.21; Tue, 29 Oct 2019 21:15:45 -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=@gmail.com header.s=20161025 header.b=NlVcq7fl; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727164AbfJ3EMW (ORCPT + 99 others); Wed, 30 Oct 2019 00:12:22 -0400 Received: from mail-oi1-f195.google.com ([209.85.167.195]:40993 "EHLO mail-oi1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727006AbfJ3EMW (ORCPT ); Wed, 30 Oct 2019 00:12:22 -0400 Received: by mail-oi1-f195.google.com with SMTP id g81so814547oib.8 for ; Tue, 29 Oct 2019 21:12:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=q8SBmE+8CAuRsopHcvNfJ0iOGe3QE73CA4UWHXUOwzo=; b=NlVcq7fl9famiHFwVuXroRWduNF6YzH/4yHGpXWGNk+n1bQ4bvpjQCiEgUhbhk3mPO 9IQaYBsuiz4qQWkVyMbfR379LhuuUs5OLKHBEhrqS7R77grOSQ5TK/b9ec1xu9JMbciY q4SvSpPDfoZOHMB/wiwAxLPSHHndu3xnpfwwgIIF8S6myDXUgwH6tB5HawuxGXGexwDn AyhsgCsoYV5GwdLBR7tQH7u2Tyr+T2VwgKooE6sztkuOu30ZRd7kgAI2O3QWVLUY2ogx xBeFY11McksdtVcE2QO0uNO+mDhhbsA4BtdLVWZRUTdDISkY1P8Gh21QTVXEuYslV5af VHwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=q8SBmE+8CAuRsopHcvNfJ0iOGe3QE73CA4UWHXUOwzo=; b=GRIvc0cU8C9npMUq5rBwoeC8llfnna/Eg8gHNMmR094bBvSS5QkjS2SJ/sOwiS9RNY QebAbkwyOgzJh+rcmu90+uNLyzX6mGSQrN2AmGjl3tkpmiprWM1/9aPeEGp1UJzPk/dy nFNpiy+HWUDzysQbqNG1R8/Yl3Q/u9VaXKdnUAl0MBLthaVH7KWoe3SKM62bjoXcNsTy B2+KIFN8ZZPiftgQ+frT0R3Ul7d32SeUxCLNAy7LEqOS/WholPtsCWWoTvkkSJT3O+dJ 9PLq7BlFn8NcRRQxATTHfiUFvt7HJ4/GugMrSTR3ma4JV/RgOvB909FFzSJ2pSJnWUj8 bV9Q== X-Gm-Message-State: APjAAAVOW01q92BbfVEkJmEwur68g3LtQkQT7iB25PP9eC6ZKrda+DC6 tDvCRoH5gk5+cZlFF4pSf/E+/Wwo X-Received: by 2002:aca:fc11:: with SMTP id a17mr6995309oii.59.1572408741122; Tue, 29 Oct 2019 21:12:21 -0700 (PDT) Received: from ubuntu-m2-xlarge-x86 ([2604:1380:4111:8b00::1]) by smtp.gmail.com with ESMTPSA id z4sm300942oix.17.2019.10.29.21.12.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Oct 2019 21:12:20 -0700 (PDT) Date: Tue, 29 Oct 2019 21:12:18 -0700 From: Nathan Chancellor To: Segher Boessenkool Cc: Nick Desaulniers , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , clang-built-linux , linuxppc-dev , LKML Subject: Re: [PATCH v4 3/3] powerpc/prom_init: Use -ffreestanding to avoid a reference to bcmp Message-ID: <20191030041218.GB14630@ubuntu-m2-xlarge-x86> References: <20190911182049.77853-1-natechancellor@gmail.com> <20191014025101.18567-1-natechancellor@gmail.com> <20191014025101.18567-4-natechancellor@gmail.com> <20191014093501.GE28442@gate.crashing.org> <20191014191141.GK28442@gate.crashing.org> <20191018190022.GA1292@ubuntu-m2-xlarge-x86> <20191018200210.GR28442@gate.crashing.org> <20191022051529.GA44041@ubuntu-m2-xlarge-x86> <20191022085709.GI28442@gate.crashing.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191022085709.GI28442@gate.crashing.org> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 22, 2019 at 03:57:09AM -0500, Segher Boessenkool wrote: > On Mon, Oct 21, 2019 at 10:15:29PM -0700, Nathan Chancellor wrote: > > On Fri, Oct 18, 2019 at 03:02:10PM -0500, Segher Boessenkool wrote: > > > I think the proper solution is for the kernel to *do* use -ffreestanding, > > > and then somehow tell the kernel that memcpy etc. are the standard > > > functions. A freestanding GCC already requires memcpy, memmove, memset, > > > memcmp, and sometimes abort to exist and do the standard thing; why cannot > > > programs then also rely on it to be the standard functions. > > > > > > What exact functions are the reason the kernel does not use -ffreestanding? > > > Is it just memcpy? Is more wanted? > > > > I think Linus summarized it pretty well here: > > > > https://lore.kernel.org/lkml/CAHk-=wi-epJZfBHDbKKDZ64us7WkF=LpUfhvYBmZSteO8Q0RAg@mail.gmail.com/ > > GCC recognises __builtin_memcpy (or any other __builtin) just fine even > with -ffreestanding. > > So the kernel wants a warning (or error) whenever a call to one of these > library functions is generated by the compiler without the user asking > for it directly (via a __builtin)? And that is all that is needed for > the kernel to use -ffreestanding? > > That shouldn't be hard. Anything missing here? > > > Segher Yes, I suppose that would be good enough. I don't know if there are any other optimizations that are missed out on by using -ffreestanding. It would probably be worth asking other kernel developers on a separate thread (or the one I linked above). Would be nice to get this shored up soon since our PowerPC builds have been broken since the beginning of August :/ Cheers, Nathan