Re: [PATCH] arch: mips: kernel: traps: Remove some unused functions

From: James Hogan
Date: Fri Jan 02 2015 - 06:54:26 EST


On 02/01/15 11:20, Rickard Strandqvist wrote:
> 2015-01-02 11:38 GMT+01:00 James Hogan <james.hogan@xxxxxxxxxx
> <mailto:james.hogan@xxxxxxxxxx>>:
>
> On 01/01/15 17:48, Rickard Strandqvist wrote:
> > Removes some functions that are not used anywhere:
> > do_bp() do_ftlb() do_dsp() do_mcheck() do_mdmx() do_msa() do_msa_fpe()
> >
> > This was partially found by using a static code analysis program called cppcheck.
>
> To elaborate on Leonid's comment, These functions are used from
> arch/mips/kernel/genex.S. See BUILD_HANDLER assembly macro. Each one
> builds a handle_* assembly function which saves appropriate exception
> state and calls do_*() with return address pointing to
> ret_from_exception. The handle_* functions are set as handlers for
> various exceptions by set_except_vector() in arch/mips/kernel/traps.c.
>
> Hi
>
> Nope no New Years joke, did not even know they were something that
> occurred:)
>
> My tests before submitting a patch is to search through the entire
> kernel after function name, see if it seems reasonable, Delete and test
> build three times as allyesconfig allmodconfig allnoconfig.
>
> Is not mips a port of these build?

If you built on a PC then you probably would have built x86_64 kernel
images which wouldn't have used any code in arch/ except arch/x86/. To
build for another architecture you need a cross compiler, and use e.g.
ARCH=mips CROSS_COMPILE=/path/to/your/mips-linux- on your make command
line, both for the *config target and for the build itself.

In any case your best bet to know whether a source file is actually
built by the configuration (e.g. for the platform specific code you're
touching in other patches) is to check whether a corresponding .o file
is created by the build or use something like #error. Kernels are
generally built for a single platform on MIPS at the moment rather than
all of them.

You may find the following link useful to quickly get cross compilers
for different architectures:

https://www.kernel.org/pub/tools/crosstool/

Cheers
James

>
> Kind regards
> Rickard Strandqvist

Attachment: signature.asc
Description: OpenPGP digital signature