[kvm-unit-tests BUG] lib/ldiv32.c breaks arm compilation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

Commit 0b2d3dafc0d3 ("libcflat: provide long division routines"), which added the
lib/ldiv32.c file, breaks compilation for the arm architecture; arm64 seems to be
working just fine.

On Arch Linux:

$ ./configure --arch=arm --cross-prefix=arm-none-eabi-
$ make clean && make
rm -f lib/arm/asm-offsets.h lib/arm/asm-offsets.s \
      lib/generated/asm-offsets.h
rm -f arm/*.{o,flat,elf} lib/arm/libeabi.a lib/arm/eabi_compat.o \
      arm/.*.d lib/arm/.*.d
  CLEAN (libfdt)
rm -f lib/libfdt/*.o lib/libfdt/.*.d
rm -f lib/libfdt/libfdt.so.1
rm -f lib/libfdt/libfdt.a
rm -f lib/.*.d lib/libcflat.a lib/argv.o lib/printf.o lib/string.o lib/abort.o
lib/report.o lib/stack.o lib/arm/spinlock.o lib/arm/processor.o lib/arm/stack.o
lib/ldiv32.o lib/util.o lib/getchar.o lib/alloc_phys.o lib/alloc_page.o
lib/vmalloc.o lib/alloc.o lib/devicetree.o lib/pci.o lib/pci-host-generic.o
lib/pci-testdev.o lib/virtio.o lib/virtio-mmio.o lib/chr-testdev.o lib/arm/io.o
lib/arm/setup.o lib/arm/mmu.o lib/arm/bitops.o lib/arm/psci.o lib/arm/smp.o
lib/arm/delay.o lib/arm/gic.o lib/arm/gic-v2.o lib/arm/gic-v3.o
[..]
arm-none-eabi-gcc -marm -mfpu=vfp -mcpu=cortex-a15 -mno-unaligned-access
-std=gnu99 -ffreestanding -O2 -I /home/alex/data/repos/kvm-unit-tests/lib -I
/home/alex/data/repos/kvm-unit-tests/lib/libfdt -I lib -g -MMD -MF lib/.ldiv32.d
-fno-strict-aliasing -fno-common -Wall -Wwrite-strings -Wempty-body
-Wuninitialized -Wignored-qualifiers -Werror  -fno-omit-frame-pointer 
-fno-stack-protector    -Wno-frame-address -D__U32_LONG_FMT__  -fno-pic  -no-pie 
-Wclobbered  -Wunused-but-set-parameter  -Wmissing-parameter-type 
-Wold-style-declaration -Woverride-init -Wmissing-prototypes -Wstrict-prototypes  
-c -o lib/ldiv32.o lib/ldiv32.c
lib/ldiv32.c: In function '__moddi3':
lib/ldiv32.c:73:11: error: 'rem' may be used uninitialized in this function
[-Werror=maybe-uninitialized]
   73 |  uint64_t rem;
      |           ^~~
lib/ldiv32.c: In function '__umoddi3':
lib/ldiv32.c:75:9: error: 'rem' may be used uninitialized in this function
[-Werror=maybe-uninitialized]
   75 |  return rem;
      |         ^~~
cc1: all warnings being treated as errors
make: *** [<builtin>: lib/ldiv32.o] Error 1
$ arm-none-eabi-gcc --version
arm-none-eabi-gcc (Arch Repository) 10.3.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

On Fedora 33:

$ ./configure --arch=arm --cross-prefix=arm-linux-gnu-
$ make clean && make
rm -f lib/arm/asm-offsets.h lib/arm/asm-offsets.s \
      lib/generated/asm-offsets.h
rm -f arm/*.{o,flat,elf} lib/arm/libeabi.a lib/arm/eabi_compat.o \
      arm/.*.d lib/arm/.*.d
  CLEAN (libfdt)
rm -f lib/libfdt/*.o lib/libfdt/.*.d
rm -f lib/libfdt/libfdt.so.1
rm -f lib/libfdt/libfdt.a
rm -f lib/.*.d lib/libcflat.a lib/argv.o lib/printf.o lib/string.o lib/abort.o
lib/report.o lib/stack.o lib/arm/spinlock.o lib/arm/processor.o lib/arm/stack.o
lib/ldiv32.o lib/util.o lib/getchar.o lib/alloc_phys.o lib/alloc_page.o
lib/vmalloc.o lib/alloc.o lib/devicetree.o lib/pci.o lib/pci-host-generic.o
lib/pci-testdev.o lib/virtio.o lib/virtio-mmio.o lib/chr-testdev.o lib/arm/io.o
lib/arm/setup.o lib/arm/mmu.o lib/arm/bitops.o lib/arm/psci.o lib/arm/smp.o
lib/arm/delay.o lib/arm/gic.o lib/arm/gic-v2.o lib/arm/gic-v3.o
[..]
arm-linux-gnu-gcc -marm -mfpu=vfp -mcpu=cortex-a15 -mno-unaligned-access
-std=gnu99 -ffreestanding -O2 -I /home/alex/data/repos/kvm-unit-tests/lib -I
/home/alex/data/repos/kvm-unit-tests/lib/libfdt -I lib -g -MMD -MF lib/.ldiv32.d
-fno-strict-aliasing -fno-common -Wall -Wwrite-strings -Wempty-body
-Wuninitialized -Wignored-qualifiers -Werror  -fno-omit-frame-pointer 
-fno-stack-protector    -Wno-frame-address   -fno-pic  -no-pie  -Wclobbered 
-Wunused-but-set-parameter  -Wmissing-parameter-type  -Wold-style-declaration
-Woverride-init -Wmissing-prototypes -Wstrict-prototypes   -c -o lib/ldiv32.o
lib/ldiv32.c
lib/ldiv32.c:1:10: fatal error: inttypes.h: No such file or directory
    1 | #include <inttypes.h>
      |          ^~~~~~~~~~~~
compilation terminated.
make: *** [<builtin>: lib/ldiv32.o] Error 1
$ arm-linux-gnu-gcc --version
arm-linux-gnu-gcc (GCC) 10.2.1 20200826 (Red Hat Cross 10.2.1-3)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Reverting the commit makes arm build again. I am not familiar with toolchains, and
unfortunately I can't propose a fix.

Thanks,

Alex




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux