lkml.org 
[lkml]   [2022]   [Jul]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v1 2/5] powerpc/32: Don't always pass -mcpu=powerpc to the compiler
    On Mon, Jul 11, 2022 at 04:19:30PM +0200, Christophe Leroy wrote:
    > Since commit 4bf4f42a2feb ("powerpc/kbuild: Set default generic
    > machine type for 32-bit compile"), when building a 32 bits kernel
    > with a bi-arch version of GCC, or when building a book3s/32 kernel,
    > the option -mcpu=powerpc is passed to GCC at all time, relying on it
    > being eventually overriden by a subsequent -mcpu=xxxx.
    >
    > But when building the same kernel with a 32 bits only version of GCC,
    > that is not done, relying on gcc being built with the expected default
    > CPU.
    >
    > This logic has two problems. First, it is a bit fragile to rely on
    > whether the GCC version is bi-arch or not, because today we can have
    > bi-arch versions of GCC configured with a 32 bits default. Second,
    > there are some versions of GCC which don't support -mcpu=powerpc,
    > for instance for e500 SPE-only versions.

    More fundamentally, the *only* thing you should check biarch for is
    for determining if you can use both -m32 and -m64 with the same
    compiler. Everything behaves identically in a biarch and a non-biarch
    compiler, other than the latter screams bloody murder if you try to
    change the architecture from 32 to 64 bit or vice versa.

    > So, stop relying on this approximative logic and allow the user to
    > decide whether he/she wants to use the toolchain's default CPU or if
    > he/she wants to set one, and allow only possible CPUs based on the
    > selected target.
    >
    > Reported-by: Pali Rohár <pali@kernel.org>
    > Tested-by: Pali Rohár <pali@kernel.org>
    > Reviewed-by: Arnd Bergmann <arnd@arndb.de>
    > Cc: Segher Boessenkool <segher@kernel.crashing.org>
    > Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>

    Reviewed-by: Segher Boessenkool <segher@kernel.crashing.org>

    Looks good to me. This untangles/demystifies quite some code :-)


    Segher

    \
     
     \ /
      Last update: 2022-07-11 18:55    [W:3.691 / U:0.164 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site