Re: [PATCH v4 03/14] modpost: split the section mismatch checks into section-check.c

Masahiro Yamada
2022-05-10T07:35:40Z

On Tue, May 10, 2022 at 2:20 AM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> On Sun, May 8, 2022 at 12:10 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
> >
> > modpost.c is too big, and the half of the code is for section checks.
> > Split it.
> >
> > I fixed some style issues in the moved code.
>
> It would be helpful for review if the split and restyle were distinct
> patches. Otherwise I can't tell what has changed.
>
> This does lose the ability to use git blame to get more context on
> some of the oddities in modpost (which I have found useful in the
> past). I don't feel strongly though.

OK, I will just move the code in v5.

> > 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.

--
Best Regards
Masahiro Yamada