Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1649378pxp; Sun, 6 Mar 2022 22:13:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJzMU2wLRVLRaMZgGxFyWokV7r/QyDGrMXY3pkJi7CrjEr68AImtv1XY+Yt/8zfKBlq62uL8 X-Received: by 2002:a05:6402:69a:b0:416:5f39:982b with SMTP id f26-20020a056402069a00b004165f39982bmr92336edy.147.1646633631706; Sun, 06 Mar 2022 22:13:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646633631; cv=none; d=google.com; s=arc-20160816; b=BVS2UttZehLB9xUn1fy572YExysqPe2RFlJMoqfaeBXU3t3wtNAOn5+jxGaddV/00H zC97WaQX4T9zhgoWjm3PWM6/yaLr9l43GQAT6c3/2Oy9cV8kxWRSdUepHdgddR8IjlQD iXfF0fdUkkBLyN3gaRTyHPI8yu01gpr/aB+jZbWagR4ePaNBEETw/wltT+Hf+Uj9NTWi We2tcuH5Ao6vaou4ceYV4rXI4eVUizbgXZ5rEj+JTAXiXELcUOkAdb3VZS32xpikMTNT Nqve9QPA7kr5F7zSKi+oKPkxxyK7MZW3t3GxV4T1PYM+XEqAcEojMDVUvBqwvIRIyieA TWRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=KQCj4TQL9BRV370L1DSaeeHDpjyUdB8ZfYvZ4s6+wso=; b=AWWCk7h35JIW2PKRdj1IQXvfIXJTzR6uiEX0uLMb+lPAjt8Mdry3lDDkT8cfGc/v4l hrUxfWr4pwhNmEQ6TuRGyE/4ElvGNcyayQHbk1knmZw5eZrIE6ehasRAh10b7z7bFVi2 J+i7xqUUZMzQLveeF8PC+6mwOkTGA3lr3U1no6E9jSGuJ+YlIVM2MAqzSKhvkTN9preV hsNwfwgroM5z1OX9QE4s1HGtLDWHDDeeJHl3b7fr7I5MWF+kBwjAZVuVishtu4AQw6qi /XH6fZw0zeFoFoCsavpfKn36U6yPMusybPSq3IL5lOW2C0l8E/2/I2UYkAHeqkEyUDF8 AqrQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r16-20020a05640251d000b004165237e150si778346edd.279.2022.03.06.22.13.29; Sun, 06 Mar 2022 22:13:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233880AbiCFRLW (ORCPT + 99 others); Sun, 6 Mar 2022 12:11:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231218AbiCFRLV (ORCPT ); Sun, 6 Mar 2022 12:11:21 -0500 Received: from smtp.smtpout.orange.fr (smtp08.smtpout.orange.fr [80.12.242.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30D9666CA0 for ; Sun, 6 Mar 2022 09:10:28 -0800 (PST) Received: from localhost.localdomain ([106.133.21.169]) by smtp.orange.fr with ESMTPA id QuObnKJQ7uvBOQuOhnsSxM; Sun, 06 Mar 2022 18:10:26 +0100 X-ME-Helo: localhost.localdomain X-ME-Auth: MDU0YmViZGZmMDIzYiBlMiM2NTczNTRjNWZkZTMwOGRiOGQ4ODf3NWI1ZTMyMzdiODlhOQ== X-ME-Date: Sun, 06 Mar 2022 18:10:26 +0100 X-ME-IP: 106.133.21.169 From: Vincent Mailhol To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H . Peter Anvin" Cc: linux-kernel@vger.kernel.org, Vincent Mailhol Subject: [RFC PATCH v1] x86/build: add -fno-builtin flag to prevent shadowing Date: Mon, 7 Mar 2022 02:10:09 +0900 Message-Id: <20220306171009.1973074-1-mailhol.vincent@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 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. arch/x86/Makefile.um already adds the -fno-builtin but does not get included in arch/x86/Makefile (the only consumer of Makefile.um is arch/um/Makefile). I do not understand what is the role of Makefile.um here. Because of my lack of confidence on this Makefile.um, and because it is the first time for me to send a patch for x86/build I am sending this as an RFC. Regarless, this patch is my best shot on this issue. I hope I did not miss anything obvious. --- 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