Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp201062ybh; Sat, 18 Jul 2020 00:55:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwc0RRnZktKM2yCFUiwFz0t44XVKn/7blNyu+md/O0GNf3FqYcRC8pWXzesTBeG4uBPlMNh X-Received: by 2002:a50:cf43:: with SMTP id d3mr13292136edk.40.1595058924781; Sat, 18 Jul 2020 00:55:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595058924; cv=none; d=google.com; s=arc-20160816; b=yg9tjF0OSXpvoQBlZn9/lxkqgAJFerqfBSJv2bD4G9vCZUoBN1jA8MMGS2Ugf+oxOU MhB7AVB7uP5QiiIiLHWTy27wvI8T9IPASXrDCzTobPWdKnlTRVIbgU0uRLlHKxRWUHK/ lAOiECOPAwDXdEOhhcNvZwyETO038L8SrJEEChU2VvKHC16STKP8xGmJQmm0hgmZ7oq9 UNXlnp5Zp/oohDLuCOl9tXL+4B8dOy/IsqijzPmoyAmq+mN1I9Cl3zaT/leKZSV4iW71 IYBcInReChukolJypwH8EGq1/nM4beZR6m1ZuUYhAtnUF4f1uf9EPub4ed6vqnimhCvG trOg== 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=KEEvd4u3UvGoBQRrd8r0flfbXnRfcEtkikuqiW2DLRE=; b=XXDVAybSQlwaLQcZyJgejWBzAqxEODXYLztb4Huo3LSRVxGcEkSF1SnvyX7q5Hcl3g 9hZsUJX9EaVXPmyLSx8LpJ3GUHxjQaZb9uf3Fk0C+lOt8r6pmcb+Ae8FTIENuXbJRiAX jjhE1Ap2YlmDDYdCe5HLnaStgX44D1QMDMH2Rog//WHKdKh+NxHEdp21YG+l2XVnf7/T cSkAs2gOFIL2/RO09tHdwK0P+hv4VlT0ji4gHuUIEl0/dPgT0F+iWlTh9OxF9tbwQ993 vPmoIwnmTpW9arNLzAl8v4xlkXVq32I5kHxnuNiPdwFGo1fzIulyRE1nF6U4gYBvHfU0 0e4w== 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 n6si6653832edy.324.2020.07.18.00.54.49; Sat, 18 Jul 2020 00:55:24 -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 S1729158AbgGRHvD (ORCPT + 99 others); Sat, 18 Jul 2020 03:51:03 -0400 Received: from mail-oi1-f194.google.com ([209.85.167.194]:32964 "EHLO mail-oi1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728936AbgGRHvC (ORCPT ); Sat, 18 Jul 2020 03:51:02 -0400 Received: by mail-oi1-f194.google.com with SMTP id k22so10026857oib.0 for ; Sat, 18 Jul 2020 00:51:02 -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=KEEvd4u3UvGoBQRrd8r0flfbXnRfcEtkikuqiW2DLRE=; b=VdTIISXYSJnmOV2gsSCROT3wTZXARF83gJrNzaUzgyN1WMKHb297dFeCI+3jbL0sWQ kvKJ2ZphK6B8ZFRg/cBAwF8XGIPG0unxVid8XzW+dpRhVDsHGatlBvsb1PeyuWTfAyhs tERnrcjCJoAtKrZ5jgvHb9tcY+ndaPj5X8xe8CxlVRDJPa2SHyJ7vexUkgHSFsiX+YCF 4yaEss/1lTfZt8HofrkoiFvkiGGMQCj5GWrd/xNtRMLvPtxLes9uICvMfy+9NLIh6TM8 mvAJvDUCd1fCkoykBiCveBtYfwuM8bMGmWv9v0IDy6Q6LCFZEykGEAsyIRufCQtGqSrh BG9w== X-Gm-Message-State: AOAM531mzzAHRJb8U55+OUyPGKi8TfFAc7e+6hnghfOnepRuv50xOlTY pdU24h+K6qVv6vN8V+tzUR3Olrj+KRBRtDWDYF4= X-Received: by 2002:a05:6808:64a:: with SMTP id z10mr10530650oih.54.1595058661714; Sat, 18 Jul 2020 00:51:01 -0700 (PDT) MIME-Version: 1.0 References: <20200624035920.835571-1-natechancellor@gmail.com> In-Reply-To: <20200624035920.835571-1-natechancellor@gmail.com> From: Geert Uytterhoeven Date: Sat, 18 Jul 2020 09:50:50 +0200 Message-ID: Subject: Re: [PATCH] powerpc/boot: Use address-of operator on section symbols To: Nathan Chancellor Cc: Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Geoff Levand , linuxppc-dev , Linux Kernel Mailing List , clang-built-linux , Joel Stanley , Arnd Bergmann 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 Nathan, On Wed, Jun 24, 2020 at 6:02 AM Nathan Chancellor wrote: > arch/powerpc/boot/main.c:107:18: warning: array comparison always > evaluates to a constant [-Wtautological-compare] > if (_initrd_end > _initrd_start) { > ^ > arch/powerpc/boot/main.c:155:20: warning: array comparison always > evaluates to a constant [-Wtautological-compare] > if (_esm_blob_end <= _esm_blob_start) > ^ > 2 warnings generated. > > These are not true arrays, they are linker defined symbols, which are > just addresses. Using the address of operator silences the warning > and does not change the resulting assembly with either clang/ld.lld > or gcc/ld (tested with diff + objdump -Dr). > > Link: https://github.com/ClangBuiltLinux/linux/issues/212 > Reported-by: Joel Stanley > Signed-off-by: Nathan Chancellor > --- > arch/powerpc/boot/main.c | 4 ++-- > arch/powerpc/boot/ps3.c | 2 +- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/arch/powerpc/boot/main.c b/arch/powerpc/boot/main.c > index a9d209135975..cae31a6e8f02 100644 > --- a/arch/powerpc/boot/main.c > +++ b/arch/powerpc/boot/main.c > @@ -104,7 +104,7 @@ static struct addr_range prep_initrd(struct addr_range vmlinux, void *chosen, > { > /* 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. 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