• Michael Ellerman's avatar
    powerpc/boot: Fix 64-bit boot wrapper build with non-biarch compiler · 65c5ec11
    Michael Ellerman authored
    Historically the boot wrapper was always built 32-bit big endian, even
    for 64-bit kernels. That was because old firmwares didn't necessarily
    support booting a 64-bit image. Because of that arch/powerpc/boot/Makefile
    uses CROSS32CC for compilation.
    
    However when we added 64-bit little endian support, we also added
    support for building the boot wrapper 64-bit. However we kept using
    CROSS32CC, because in most cases it is just CC and everything works.
    
    However if the user doesn't specify CROSS32_COMPILE (which no one ever
    does AFAIK), and CC is *not* biarch (32/64-bit capable), then CROSS32CC
    becomes just "gcc". On native systems that is probably OK, but if we're
    cross building it definitely isn't, leading to eg:
    
      gcc ... -m64 -mlittle-endian -mabi=elfv2 ... arch/powerpc/boot/cpm-serial.c
      gcc: error: unrecognized argument in option ‘-mabi=elfv2’
      gcc: error: unrecognized command line option ‘-mlittle-endian’
      make: *** [zImage] Error 2
    
    To fix it, stop using CROSS32CC, because we may or may not be building
    32-bit. Instead setup a BOOTCC, which defaults to CC, and only use
    CROSS32_COMPILE if it's set and we're building for 32-bit.
    
    Fixes: 147c0516 ("powerpc/boot: Add support for 64bit little endian wrapper")
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    Reviewed-by: default avatarCyril Bur <cyrilbur@gmail.com>
    65c5ec11
Makefile 18.6 KB