• Finn Thain's avatar
    m68k: Add -ffreestanding to CFLAGS · 1255e281
    Finn Thain authored
    commit 28713169d879b67be2ef2f84dcf54905de238294 upstream.
    
    This patch fixes a build failure when using GCC 8.1:
    
    /usr/bin/ld: block/partitions/ldm.o: in function `ldm_parse_tocblock':
    block/partitions/ldm.c:153: undefined reference to `strcmp'
    
    This is caused by a new optimization which effectively replaces a
    strncmp() call with a strcmp() call. This affects a number of strncmp()
    call sites in the kernel.
    
    The entire class of optimizations is avoided with -fno-builtin, which
    gets enabled by -ffreestanding. This may avoid possible future build
    failures in case new optimizations appear in future compilers.
    
    I haven't done any performance measurements with this patch but I did
    count the function calls in a defconfig build. For example, there are now
    23 more sprintf() calls and 39 fewer strcpy() calls. The effect on the
    other libc functions is smaller.
    
    If this harms performance we can tackle that regression by optimizing
    the call sites, ideally using semantic patches. That way, clang and ICC
    builds might benfit too.
    
    Cc: stable@vger.kernel.org
    Reference: https://marc.info/?l=linux-m68k&m=154514816222244&w=2Signed-off-by: 's avatarFinn Thain <fthain@telegraphics.com.au>
    Signed-off-by: 's avatarGeert Uytterhoeven <geert@linux-m68k.org>
    Signed-off-by: 's avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    1255e281
Name
Last commit
Last update
..
68000 Loading commit data...
amiga Loading commit data...
apollo Loading commit data...
atari Loading commit data...
bvme6000 Loading commit data...
coldfire Loading commit data...
configs Loading commit data...
emu Loading commit data...
fpsp040 Loading commit data...
hp300 Loading commit data...
ifpsp060 Loading commit data...
include Loading commit data...
kernel Loading commit data...
lib Loading commit data...
mac Loading commit data...
math-emu Loading commit data...
mm Loading commit data...
mvme147 Loading commit data...
mvme16x Loading commit data...
q40 Loading commit data...
sun3 Loading commit data...
sun3x Loading commit data...
tools/amiga Loading commit data...
Kconfig Loading commit data...
Kconfig.bus Loading commit data...
Kconfig.cpu Loading commit data...
Kconfig.debug Loading commit data...
Kconfig.devices Loading commit data...
Kconfig.machine Loading commit data...
Makefile Loading commit data...
install.sh Loading commit data...