Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp353051iob; Wed, 11 May 2022 16:19:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqor3Z4w0PfNSJcZ5tjJWxP8NwCDz6EQkl2usAQY9soiExPyC/tcg4tVOTNlrUF1j+7CeQ X-Received: by 2002:a65:55c8:0:b0:3c6:6833:5730 with SMTP id k8-20020a6555c8000000b003c668335730mr19792289pgs.325.1652311162754; Wed, 11 May 2022 16:19:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652311162; cv=none; d=google.com; s=arc-20160816; b=Q2eEZkMWf9tbr3SKHSiYWjIergf+NVL1Aaj8l70RE6Ti+QM9mm9DWrc+MwYQyNwT7/ kyG3/ywFyxlQ8N4RvKss25P0islgQ2Yn6L+0JHxvfNh0BBzLaa5NSK13mbqNwESRhrhU QA6KDOtUHVGk+lEZ4CQDmQ7gkoBbsPxYeZ2JaWwbe9PW43SwG4Qlp+b7g+NDgaN0deQ8 3ZUt7R5QnmuGA+Xxx3S7DmSgZ7vQ6aqMjmytPmnF/E+jYaOxg3yHRhAG27xWz6ag+V8l ShDHHtAP1UzZwHLA8pWYUhHRZdiVOofnnVUIY51HpE7wyZms+Wo65EBcj3omY0sHdnU0 dDng== 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:dkim-filter; bh=EaTId7H8QGxZ4wR/UutapdHBioVSBlwASrI8kZas40s=; b=FWpiY1QwmBwjaEuKTW8SKZdC6rdFIFQ3iH72F5Wdqz7oeO/jsOPzNEymnjtnbFoIZ9 h9EOPnM9nimn/D1HSXb94BG69egimAwExats2aa/IsT6MN+ra4/gQ5KeQndhGWkSeW5A VZIKM6OcIE7sexhFUG+3Lck6J6UsmuNvu4hicaMq3L1ImR+/nz4EISSbbd5JdOBv1mum pU92cD0JwcN+G8puUXPiWLCe4rCkRkzfdyFkmJgFHNvodEWL3l+FK6FnnLtTD1VjGtsh KJix0OhLH/zZMd7M0b+my3X73IC8tpD9kEVirVqA+wao+sqN5H5VxL1NDM3IscmyQiky hTBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=S17erul5; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q19-20020a17090a2e1300b001d122ce86cdsi1207491pjd.94.2022.05.11.16.19.10; Wed, 11 May 2022 16:19:22 -0700 (PDT) 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; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=S17erul5; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346829AbiEKT3N (ORCPT + 99 others); Wed, 11 May 2022 15:29:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229566AbiEKT3M (ORCPT ); Wed, 11 May 2022 15:29:12 -0400 Received: from conssluserg-06.nifty.com (conssluserg-06.nifty.com [210.131.2.91]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A319DF1367; Wed, 11 May 2022 12:29:08 -0700 (PDT) Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) (authenticated) by conssluserg-06.nifty.com with ESMTP id 24BJSoZ9018134; Thu, 12 May 2022 04:28:50 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-06.nifty.com 24BJSoZ9018134 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1652297330; bh=EaTId7H8QGxZ4wR/UutapdHBioVSBlwASrI8kZas40s=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=S17erul53RNIeBjJYir+J8mpHUWqK7sXKHJMWRa/l2xSCxZgrdV1dU3+5hX9DFRPB CxgugLFeqTZ4qkrOp/w8aAs9LC1q5WTQ18lo39qoonMr7iIjV8mWFGdEhV4ZCcs80q 2791ONW4kWbmvpu0bg8Ie6WMg2pBrWyRDmAD0TVba9wY0wF1xKvLuuao/XsCXNDByB 38FzgA8r7So3M8VePGduejUpewfBieSKGIXseq+GW7ZP4YbOEsCZ9Y+Cm76syaoNJ6 t7jCNxWrBvLyml46hUxkvSFtyWpcS1C/UwFi4wohFk8Ysn7VrS2i2PxIpRBTLc+/r3 YjPePFoJdPHHA== X-Nifty-SrcIP: [209.85.216.52] Received: by mail-pj1-f52.google.com with SMTP id l20-20020a17090a409400b001dd2a9d555bso2975792pjg.0; Wed, 11 May 2022 12:28:50 -0700 (PDT) X-Gm-Message-State: AOAM530Sk2S5gpR8eoR0AEnHcHmWIS8+HImf5ur29pRT6pczkG3LLJcl +WzvlT0pUi+j8EBsjQ41t0G7SEzyQ1Br31/6EfI= X-Received: by 2002:a17:903:1205:b0:15e:8cbc:fd2b with SMTP id l5-20020a170903120500b0015e8cbcfd2bmr26952485plh.99.1652297329721; Wed, 11 May 2022 12:28:49 -0700 (PDT) MIME-Version: 1.0 References: <20220508190631.2386038-1-masahiroy@kernel.org> <20220508190631.2386038-4-masahiroy@kernel.org> In-Reply-To: From: Masahiro Yamada Date: Thu, 12 May 2022 04:27:37 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v4 03/14] modpost: split the section mismatch checks into section-check.c To: Nick Desaulniers Cc: Linux Kbuild mailing list , Linux Kernel Mailing List , Nathan Chancellor , Nicolas Schier , Peter Zijlstra , linux-modules , linux-s390 , linuxppc-dev , Ard Biesheuvel , Sami Tolvanen , clang-built-linux Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_SOFTFAIL, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no 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 Thu, May 12, 2022 at 3:48 AM Nick Desaulniers wrote: > > On Mon, May 9, 2022 at 11:57 PM Masahiro Yamada wrote: > > > > > > diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c > > > > index a78b75f0eeb0..e7e2c70a98f5 100644 > > > > --- a/scripts/mod/modpost.c > > > > +++ b/scripts/mod/modpost.c > > > > @@ -31,7 +31,7 @@ static bool external_module; > > > > /* Only warn about unresolved symbols */ > > > > static bool warn_unresolved; > > > > > > > > -static int sec_mismatch_count; > > > > +int sec_mismatch_count; > > > > > > ^ this should go in modpost.h if it is to be used in two translation > > > units, rather than forward declaring it in section-check.c. You did > > > this for the functions. > > > > > > Sorry, I do not understand. > > > > > > In modpost.h, I put the declaration: > > > > extern int sec_mismatch_count; > > > > If I moved it to the header without 'extern' > > I would get multiple definitions. > > Yeah, you need to _declare_ it w/ extern in the header, then _define_ > it in one source file. > > That way, if the type ever changes, the sources will agree on type in > all source files. You will get a redefinition error if the definition > changes the type of the variable since the last declaration. > > What you're doing is forward declaring, which works, and is a common > pattern for (bloated) C++, but is less type safe than sharing a single > common declaration between multiple source files via a single common > shared header. (Sorry I didn't respond before you sent v5) Sorry, I still do not understand your suggestion. Could you provide me with a code diff showing how to do this better? -- Best Regards Masahiro Yamada