Re: [PATCH 3/3] objtool: move tools/objtool/ to scripts/objtool/

Josh Poimboeuf
2019-03-05T16:36:14Z

On Wed, Mar 06, 2019 at 01:08:27AM +0900, Masahiro Yamada wrote:
> > I do see the benefits. In many ways objtool is a more natural fit in
> > the scripts dir. But there are also some downsides to this change:
> >
> > - This will make it harder to package objtool as a standalone tool. It
> > has a lot of functionality that could be useful to other non-kernel
> > projects.
>
>
> If it is really useful for other projects,
> I'd like to see it as a real standalone tool,
> i.e. split as a separate project.

Fine, but who's going to do it? I don't have time for creating such a
project anytime soon. And anyway, moving the code to scripts in the
meantime would just make that harder when we do it eventually.

> > - It shares libsubcmd with perf. Including the subcmd .c files from
> > tools is hacky.
>
> Yes, hacky. We are shifting the ugliness between C and Build system.
>
> But, this hack can be solved; if subcmd library is useful, you can copy
> only necessary code into the objtool directory. You do not need all
> helpers from libsubcmd.

But then we are duplicating code...

> > - It's disruptive: it will break all the out-of-tree distro kernel
> > packaging scripts which now look for objtool in tools.
>
> All artifacts under scripts/ should be contained in the package.
> So, it should work.

It *will* break distro scripts which already expect objtool to be
located at tools/objtool/objtool.

> > You're right that objtool isn't a natural fit in tools, because it's
> > also used as part of the build. But it's not a natural fit in scripts
> > either. I think we've resolved most of those issues and it seems to be
> > working well these days.
> >
> > So instead of disrupting everything because "make mrproper" doesn't
> > work, I think I'd rather just do the following:
> >
> > diff --git a/Makefile b/Makefile
> > index ac5ac28a24e9..7e6696c9b862 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -1364,7 +1364,7 @@ PHONY += $(mrproper-dirs) mrproper
> > $(mrproper-dirs):
> > $(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@)
> >
> > -mrproper: clean $(mrproper-dirs)
> > +mrproper: clean $(mrproper-dirs) tools/objtool_clean
> > $(call cmd,rmdirs)
> > $(call cmd,rmfiles)
> >
>
> Works, and the clean log is also brilliant.
>
> I see the same log even when
> there is nothing to clean.
>
>
> masahiro@grover:~/ref/linux$ make mrproper
> CLEAN .
> CLEAN arch/x86/entry/vdso
> CLEAN usr
> CLEAN arch/x86/tools
> CLEAN .tmp_versions
> CLEAN scripts/basic
> CLEAN scripts/kconfig
> CLEAN scripts/mod
> CLEAN scripts/selinux/genheaders
> CLEAN scripts/selinux/mdp
> CLEAN scripts
> DESCEND objtool
> CLEAN objtool
> CLEAN include/config include/generated arch/x86/include/generated
> CLEAN .config
> masahiro@grover:~/ref/linux$ make mrproper
> DESCEND objtool
> CLEAN objtool
> masahiro@grover:~/ref/linux$ make mrproper
> DESCEND objtool
> CLEAN objtool

Ok, but I'm sure that could be fixed. That's hardly a justification to
move objtool.

Anyway I would like to hear what Ingo and Peter think about moving it.

--
Josh