Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2063216iof; Tue, 7 Jun 2022 18:31:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4wE/PafHLtrclJttU76a0aRefoF7ONvrGWZeOENHPxZDbPKxzZp55rAwMV8RUGtcT25Gf X-Received: by 2002:a63:6aca:0:b0:3ab:a56:126a with SMTP id f193-20020a636aca000000b003ab0a56126amr27522714pgc.576.1654651871900; Tue, 07 Jun 2022 18:31:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654651871; cv=none; d=google.com; s=arc-20160816; b=Acd8oEE8zlEDpuOnTAaT2sIyK+LYejE9A/kUHkdqJrEEvuPwYy9dBcOuudp6hnOZuy AmOIEQzNf+upcpUnDoDwjs1yUM6uITJUTDKM8MGY4RSmSqvDYDQQRLJcLRsnruPKsdbP 3xNoEmqKeKtTEkILHsNifkLecr799jtD2txIz6T6uhqy/9VpX65L43TxuySwP4yLOugp tjEesAtDE8Z4lue8bYBKFVyxU9jHpmDMIQNkkDp7fY+YBJFZ1+cdMKX1sON6c247CHyY 1z1NW7St2MYW/SbMEBBXKMBcmNkPu8c5roaNnbEAq1GfLU2WrzSQAgiFa6JyAX89e0xd /8yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=tPdxbRoIotRMqe4pfIqtb0hWhbSEqaAMK6paX1Fa30M=; b=zuGLAXeSuMVWDAlS/Ar9dRYORGCqS8MWK+Wmh17IthkHsZMmW7GmEfNm8ev7unU+/W QSahR9BA8nJwDyJxxo27NaUnePa7MIGrSiAHgDGz+N1un/xOUQryh05VaTvLm60jJD9L vU0PV4O+EsAp1TVyU3sRVFy/QRe2aklwSCH6J/6NYjllenD7uR/W6MUef4taNptMBz9h ByK0k8ryOKidvogEixilctNdKujMEVLX75EtBy+GNvzWgr6YGQcuNwP+v878c8Dhnuht 6UgNT7KklEuZjOkWDQe9aPfBQoQahBAQrNMzqT28oLJwt2mBYI8HPVXIsI9rSOi68w6E lBQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rBR0PNsJ; 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 v37-20020a631525000000b003f9f41da8c6si26775274pgl.2.2022.06.07.18.31.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 18:31:11 -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=rBR0PNsJ; 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 out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 67C682945C6; Tue, 7 Jun 2022 18:23:19 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244372AbiFGO0B (ORCPT + 99 others); Tue, 7 Jun 2022 10:26:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245411AbiFGOZ4 (ORCPT ); Tue, 7 Jun 2022 10:25:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCDD8F339F; Tue, 7 Jun 2022 07:25:53 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 6743F615BC; Tue, 7 Jun 2022 14:25:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25812C385A5; Tue, 7 Jun 2022 14:25:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1654611952; bh=eTmmhNitWRhmgZXJiNPWVRwjucfXXcjZHpQJMAyvH58=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rBR0PNsJs3s/xFyjfBsc4EC9G3D/5SUtETmaEp5FfEHy2Y4GkLRefOZZC16UJYwF1 ZLnF7A38kqHH808gvWreIM8pzJ9/T2hLyN12swLRB0jh6pA93lbsFjiD56+LsV2vXm 4kT+r3l0XMMjXazYdAxlil8FhZQ3fscdk+ObtXevsiol99sqlgyuXCEahsvWKzM+Dw 2f3hgoRrcHZj/n+bUqhHB6hMZgYfg/DsNmLsZ9YIOJ77WN0UdIu/imQNcAG7FhF+UJ +90y5Yc98fFqkKvcRz/9VZnhx+8DpTr8UccPT4POnxYj+2sT3QPAA6h3/XM1RA/Hna zedNydLz/9Hxw== Date: Tue, 7 Jun 2022 07:25:50 -0700 From: Nathan Chancellor To: Jon Hunter Cc: Masahiro Yamada , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Nick Desaulniers , Nicolas Schier , Peter Zijlstra , linux-modules@vger.kernel.org, llvm@lists.linux.dev, Ard Biesheuvel , Sami Tolvanen , "linux-tegra@vger.kernel.org" Subject: Re: [PATCH v6 06/10] kbuild: check static EXPORT_SYMBOL* by script instead of modpost Message-ID: References: <20220513113930.10488-1-masahiroy@kernel.org> <20220513113930.10488-7-masahiroy@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-3.5 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 Tue, Jun 07, 2022 at 03:22:21PM +0100, Jon Hunter wrote: > > On 13/05/2022 12:39, Masahiro Yamada wrote: > > The 'static' specifier and EXPORT_SYMBOL() are an odd combination. > > > > Commit 15bfc2348d54 ("modpost: check for static EXPORT_SYMBOL* > > functions") tried to detect it, but this check has false negatives. > > > > Here is the sample code. > > > > Makefile: > > > > obj-y += foo1.o foo2.o > > > > foo1.c: > > > > #include > > static void foo(void) {} > > EXPORT_SYMBOL(foo); > > > > foo2.c: > > > > void foo(void) {} > > > > foo1.c exports the static symbol 'foo', but modpost cannot catch it > > because it is fooled by foo2.c, which has a global symbol with the > > same name. > > > > s->is_static is cleared if a global symbol with the same name is found > > somewhere, but EXPORT_SYMBOL() and the global symbol do not necessarily > > belong to the same compilation unit. > > > > This check should be done per compilation unit, but I do not know how > > to do it in modpost. modpost runs against vmlinux.o or modules, which > > merges multiple objects, then forgets their origin. > > > > It is true modpost gets access to the lists of all the member objects > > (.vmlinux.objs and *.mod), but modpost cannot parse individual objects > > because they may not be ELF but LLVM IR when CONFIG_LTO_CLANG=y. > > > > Add a simple bash script to parse the output from ${NM}. This works for > > CONFIG_LTO_CLANG=y because llvm-nm can dump symbols of LLVM IR files. > > > > Revert 15bfc2348d54. > > > > Signed-off-by: Masahiro Yamada > > Reviewed-by: Nick Desaulniers > > Tested-by: Nathan Chancellor > > > One some older build machines this is causing some builds (ARM/ARM64) > to fail ... > > /dvs/git/dirty/git-master_l4t-upstream/kernel/scripts/check-local-export: line 54: wait: pid 48433 is not a child of this shell > /dvs/git/dirty/git-master_l4t-upstream/kernel/scripts/Makefile.build:250: recipe for target 'scripts/mod/empty.o' failed > make[2]: *** [scripts/mod/empty.o] Error 127 > make[2]: *** Deleting file 'scripts/mod/empty.o' > make[2]: *** Waiting for unfinished jobs.... > /dvs/git/dirty/git-master_l4t-upstream/kernel/Makefile:1285: recipe for target 'prepare0' failed > make[1]: *** [prepare0] Error 2 > make[1]: Leaving directory '/dvs/git/dirty/git-master_l4t-upstream/artifacts/linux/arm64-defconfig-jetson' > Makefile:228: recipe for target '__sub-make' failed > make: *** [__sub-make] Error 2 > > Any ideas? https://lore.kernel.org/20220607084317.211785-1-masahiroy@kernel.org/ should resolve it if you wanted to give it a test. Cheers, Nathan