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=-5.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 13993C433E1 for ; Mon, 20 Jul 2020 21:05:02 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3EA42207FC for ; Mon, 20 Jul 2020 21:05:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3EA42207FC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4B9Z4B4G3YzDqZn for ; Tue, 21 Jul 2020 07:04:58 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=permerror (SPF Permanent Error: Unknown mechanism found: ip:192.40.192.88/32) smtp.mailfrom=kernel.crashing.org (client-ip=63.228.1.57; helo=gate.crashing.org; envelope-from=segher@kernel.crashing.org; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by lists.ozlabs.org (Postfix) with ESMTP id 4B9Z2S3bGHzDqZN for ; Tue, 21 Jul 2020 07:03:28 +1000 (AEST) Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 06KL2tAD003247; Mon, 20 Jul 2020 16:02:55 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 06KL2qPF003246; Mon, 20 Jul 2020 16:02:52 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Mon, 20 Jul 2020 16:02:52 -0500 From: Segher Boessenkool To: Geert Uytterhoeven Subject: Re: [PATCH] powerpc/boot: Use address-of operator on section symbols Message-ID: <20200720210252.GO30544@gate.crashing.org> References: <20200624035920.835571-1-natechancellor@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnd Bergmann , Geoff Levand , Linux Kernel Mailing List , clang-built-linux , Paul Mackerras , Joel Stanley , Nathan Chancellor , linuxppc-dev Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Hi! On Sat, Jul 18, 2020 at 09:50:50AM +0200, Geert Uytterhoeven wrote: > On Wed, Jun 24, 2020 at 6:02 AM Nathan Chancellor > wrote: > > /* If we have an image attached to us, it overrides anything > > * supplied by the loader. */ > > - if (_initrd_end > _initrd_start) { > > + if (&_initrd_end > &_initrd_start) { > > Are you sure that fix is correct? > > extern char _initrd_start[]; > extern char _initrd_end[]; > extern char _esm_blob_start[]; > extern char _esm_blob_end[]; > > Of course the result of their comparison is a constant, as the addresses > are constant. If clangs warns about it, perhaps that warning should be moved > to W=1? > > But adding "&" is not correct, according to C. Why not? 6.5.3.2/3 The unary & operator yields the address of its operand. [...] Otherwise, the result is a pointer to the object or function designated by its operand. This is the same as using the name of an array without anything else, yes. It is a bit clearer if it would not be declared as array, perhaps, but it is correct just fine like this. Segher