Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4906978iob; Mon, 9 May 2022 04:35:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRhiwlo4Zd8l9J+h2C1do7TGDvvjfjMT4DuG2erGpCj2jSFlwyCXn5uUcxAEdMO0pqnoSv X-Received: by 2002:a17:903:228d:b0:15e:a2aa:2c55 with SMTP id b13-20020a170903228d00b0015ea2aa2c55mr16176306plh.121.1652096156441; Mon, 09 May 2022 04:35:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652096156; cv=none; d=google.com; s=arc-20160816; b=qWitd9tjxzY2MAdbysz3kJYIQb5wZc3omEYJdI/NkoZckLebZQtHkq63NYOJakQEqk Mr0zyanJPqsFUiKQhQq2nkhOC+c2RE90CQOXC/cyQy8SQGPjie7FLQuEVBoY0dMbtVuf Qe5qjx7JqP+WrgoqzgBwPuykSFsIveQWoq33uZ09Hhq0XudjVILPDT32rTQ5Iyd5wgax r1oWkAcdAccd6EssdkNF3VDHGPj9GpMVvaI6sVl9rAkih3mGih5CagWLE1zxXGJe0hFb OkDNldnVSazoqITkT1wAM12wAuud/i2dPhK3FPtTTRaGHGjq8jhyTDZbVJ40sW11N9C+ FW1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Qi5bale/E5oNRx3hp2uDIfg11mlcFYHHPizX1m1lJfU=; b=MLxES3UsbLRDIZj5/zi6LTBRg4LXBJAYPAhcc5wk4jzodEoeoDrjzlKc2Plh7gSliw +d6nthlZa/hxvy/Tdi++4b8kFBiX4rb9Z/XbmhbKa3olJ+5/gtde6zs6rNw/RjqfFnHB piXqSYT1WF0a9COg00BEDT359YTfu0joL6Cf29v6nwGMyR4qXhi+qx9NFlrYnYCSGExW e3c/B3P6jTsYCvjaBq9aKTU6dPQ2wySAqfXECtLJQW3hi0ASMZ4qsT+y1ip4ELEbkZAn y/dUzh4bkfGyDb1D7Q/ULgfYsQFM4lX1eVRoQXddl6eWK9A/vpr/eYaOHEIemNzmQWwx CVQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jhm+liNu; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id u12-20020a63234c000000b0038222818815si13879156pgm.112.2022.05.09.04.35.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 04:35:56 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jhm+liNu; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 73CB32C81AB; Mon, 9 May 2022 03:40:05 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231448AbiEHKcD (ORCPT + 99 others); Sun, 8 May 2022 06:32:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230152AbiEHKcA (ORCPT ); Sun, 8 May 2022 06:32:00 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F4ACDFBD for ; Sun, 8 May 2022 03:28:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 992DBB80D75 for ; Sun, 8 May 2022 10:28:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A0E9C385B3 for ; Sun, 8 May 2022 10:28:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1652005687; bh=lTqCp5J7KZYPMfSCve/gMBXjy4K1hDRCCDO9pSAkrCY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=jhm+liNuNsbsvNmvCYcx5p+Lt1dXtcVhg5oh5d9dnlbbrAyI+VIXxC5RNVnC5hiPy uDDWLcmtoMgqPvsgPlp9Y1Pz+L5szViBph1p66PawV2TDLp8r34OSESKNH45HCLUWS 4jfmiT7kqfZNKFMKt95hpmk2myPCcTIXrT+RZJbibNA+KHHtvVFj9qKVAnXTWD40Rh 9O7TvS4JtJ2abyxECgYZYsON3O++JsJpE3hrFD+SaBNcQBOOTkBiaxa35l5Sax5Mbc RWBK5JP82/A6c007XwSnBtQObSNS+4OD25hCjSJW9yWDjZKp4Hqc1Sj3kLKpCu05LH x0LuiLhfZgOuA== Received: by mail-yw1-f173.google.com with SMTP id 00721157ae682-2f7d7e3b5bfso118576117b3.5 for ; Sun, 08 May 2022 03:28:07 -0700 (PDT) X-Gm-Message-State: AOAM532ZmtAGGLAC/utQwBh0SfzizOm+9kcnOQPf/CWJfpVJegMoZE20 MzxJQAPQ5rXOpVbIzSn9tsx55PQbQo2Lgli0Y50= X-Received: by 2002:a81:2305:0:b0:2f7:dadb:2162 with SMTP id j5-20020a812305000000b002f7dadb2162mr9219506ywj.42.1652005686253; Sun, 08 May 2022 03:28:06 -0700 (PDT) MIME-Version: 1.0 References: <20220306171009.1973074-1-mailhol.vincent@wanadoo.fr> <20220508100907.61231-1-mailhol.vincent@wanadoo.fr> In-Reply-To: <20220508100907.61231-1-mailhol.vincent@wanadoo.fr> From: Arnd Bergmann Date: Sun, 8 May 2022 12:27:49 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RESEND PATCH v1] x86/build: add -fno-builtin flag to prevent shadowing To: Vincent Mailhol Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "the arch/x86 maintainers" , "H . Peter Anvin" , Linux Kernel Mailing List , clang-built-linux , Nathan Chancellor , Nick Desaulniers , Tom Rix Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, May 8, 2022 at 12:09 PM Vincent Mailhol wrote: > > Aside of the __builtin_foo() ones, x86 does not directly rely on any > builtin functions. > > However, such builtin functions are not explicitly deactivated, > creating some collisions, concrete example being ffs() from bitops.h, > c.f.: > > | ./arch/x86/include/asm/bitops.h:283:28: warning: declaration of 'ffs' shadows a built-in function [-Wshadow] > | 283 | static __always_inline int ffs(int x) > > This patch adds -fno-builtin to KBUILD_CFLAGS for the x86 > architectures in order to prevent shadowing of builtin functions. > > Signed-off-by: Vincent Mailhol > --- > FYI, I tested this patch on a "make allyesconfig" for both x86_32 and > x86_64. > > This is a resend. Only difference is that I dropped the RFC flag and > added Arnd in CC because he did a similar patch to fix ffs shadow > warnings in the past: > > https://lore.kernel.org/all/20201026160006.3704027-1-arnd@kernel.org/ I think this is a correct change, but unfortunately it exposes a clang bug with -mregparm=3. Nick should be able to provide more details, I think he has a plan. > --- > arch/x86/Makefile | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/arch/x86/Makefile b/arch/x86/Makefile > index e84cdd409b64..5ff7b6571dd2 100644 > --- a/arch/x86/Makefile > +++ b/arch/x86/Makefile > @@ -53,6 +53,8 @@ export REALMODE_CFLAGS > # e.g.: obj-y += foo_$(BITS).o > export BITS > > +KBUILD_CFLAGS += -fno-builtin > + > # > # Prevent GCC from generating any FP code by mistake. > # > -- > 2.34.1 >