Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1982479pxa; Mon, 3 Aug 2020 04:33:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnmHd8B+pHv6elRqn2O7I0NjxCgTMmxhudgOEstfWzO4eChMTDRpFw5FRwqBE3vUMrR+3q X-Received: by 2002:aa7:c358:: with SMTP id j24mr14663648edr.377.1596454408001; Mon, 03 Aug 2020 04:33:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596454407; cv=none; d=google.com; s=arc-20160816; b=ZLApavDSIXsPqjZ0ylFMHGtPEIfDQyqsoKs8PXjVanIp1ed2rM3zR3rvn4kMVRXupU ezD1wA7Dmy0ma6tlydMVhccfSp6VnW/4cBOYojejP4ixWPVusqCXgrPBuOPR3RSVnA/3 nPvsTi+zH08rgqrmrWJNef5aVo0rJ0a6Q090VlnCPN5yWQKfFoSZLJ6dQou/gArX8jmk QBxeNeLWONQBkOY7oeDuz65xBGEjE6qQlhJPIYYzVXpKqJZ9VMNNvnHBbJhb+AqT7p+e 1dYeLAMMXRf9oW35r+aNS3ASva+8g+k2a7eqHlgRwsiZqfJ4yY3heJ++zcB9ZJ2g9vJB S8fA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=ODp5lgvPXWeexmhqKkzjrjceKYAAQRDTCREmTlObIIg=; b=OfX2NKjOmvRc9rrSz4jFjwDZwpEMEzyCx94qPdwRRbpYdbY3FMjcBUC4Z8D0D/s5dS o0q8+oE3Yr5rObseq+SwYOC/J1Rwiex57MkmTuC4ILKXWvTgj9M9pphYXai7ZXyokyZF q8fCvtiRdI64+rlgUhoRsEMF5uNsIKaYBXQuVAjBvaO+Q0LVo2UQBm/c73iiSwU0GqBI GFw6h8bGUYEEnODiPkFJI5XPEKgPeNhQW2ceQ8P+jZdsUHSKsSnlJZlKunjqbCwcLHSw j3bv2FXOrw3p8nVLsQiEQx2MQaGSQSwbQiFieUomM3HOxq3+GIP6aavCxRwYtAc4xcwU ZtIQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z15si9627259eja.112.2020.08.03.04.33.05; Mon, 03 Aug 2020 04:33:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726222AbgHCLcl (ORCPT + 99 others); Mon, 3 Aug 2020 07:32:41 -0400 Received: from mail-oi1-f195.google.com ([209.85.167.195]:42480 "EHLO mail-oi1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726007AbgHCLcl (ORCPT ); Mon, 3 Aug 2020 07:32:41 -0400 Received: by mail-oi1-f195.google.com with SMTP id j7so16553769oij.9 for ; Mon, 03 Aug 2020 04:32:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ODp5lgvPXWeexmhqKkzjrjceKYAAQRDTCREmTlObIIg=; b=NQWkbyWJHIH/Wb2su7XXy+dXfd/tDKWsibjTG5zcqq6JgOSDOwlDEfjdX7oSDP26J/ krtE7nDnz4V1OmbBJlApLS1vZqJdJl20LHbUl1oCSc6zuIxWx6zdT01MovwIwyzkgcur sTkwIBBKfSEo+Px0PJJFslRwH50tuMV2Ri0kkie0W23nD2e7Sr5uTlUi07U6e04BqFxn /+bs3Pf8PnePSxs1WVZNEvSNEp6do4PqsXWJ76IqBu5gIebF1bD/3Oqy8A/453yEAg1g RO3+4rZ/cFjeTkxiD1vAXmI/Bf/27gZoeWNbIJD+kFQ6KlSt0BnAp0Y6NuAsJUqDnWEQ ObXA== X-Gm-Message-State: AOAM533qLtNawgubk6P0X6xlIJwu/9VvWj+lc7k+5jClHAKn2KrPd1xC ClknaD8fgtrZWLLDiPi0BxeDTYe2sqhVWfrEthA= X-Received: by 2002:aca:adc4:: with SMTP id w187mr11723507oie.153.1596454359917; Mon, 03 Aug 2020 04:32:39 -0700 (PDT) MIME-Version: 1.0 References: <20200624035920.835571-1-natechancellor@gmail.com> <20200720210252.GO30544@gate.crashing.org> <87zh7cyoi7.fsf@mpe.ellerman.id.au> In-Reply-To: <87zh7cyoi7.fsf@mpe.ellerman.id.au> From: Geert Uytterhoeven Date: Mon, 3 Aug 2020 13:32:28 +0200 Message-ID: Subject: Re: [PATCH] powerpc/boot: Use address-of operator on section symbols To: Michael Ellerman Cc: Segher Boessenkool , Nathan Chancellor , Arnd Bergmann , Geoff Levand , Linux Kernel Mailing List , clang-built-linux , Paul Mackerras , Joel Stanley , linuxppc-dev Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Michael, On Mon, Aug 3, 2020 at 1:09 PM Michael Ellerman wrote: > Geert Uytterhoeven writes: > > On Mon, Jul 20, 2020 at 11:03 PM Segher Boessenkool > > wrote: > >> 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. > > > > Thanks, I stand corrected. > > > > Regardless, the comparison is still a comparison between two constant > > addresses, so my fear is that the compiler will start generating > > warnings for that in the near or distant future, making this change > > futile. > > They're not constant at compile time though. So I don't think the > compiler could (sensibly) warn about that? (surely!) They're constant, but the compiler doesn't know their value. That doesn't change by (not) using the address-of operator. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds