kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Alexandru Elisei <alexandru.elisei@arm.com>,
	Thomas Huth <thuth@redhat.com>, Andrew Jones <drjones@redhat.com>,
	kvm-devel <kvm@vger.kernel.org>,
	"kvmarm@lists.cs.columbia.edu" <kvmarm@lists.cs.columbia.edu>
Subject: Re: [kvm-unit-tests BUG] lib/ldiv32.c breaks arm compilation
Date: Tue, 11 May 2021 18:43:09 +0200	[thread overview]
Message-ID: <604b1638-452f-e8e3-b674-014d634e2767@redhat.com> (raw)
In-Reply-To: <348f023d-f313-3d98-dc18-b53b6879fe45@arm.com>

On 11/05/21 17:43, Alexandru Elisei wrote:
> 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.

The Fedora one is fixed in the commit immediately after, which replaces 
inttypes.h with stdint.h.

For Arch Linux I'm not sure what the compiler is complaining about 
(especially since there are no options such as -fno-null-pointer-checks) 
but perhaps we can just initialize rem to 0?  Any chance you can check 
if that affects the assembly output?  (It shouldn't).

Paolo

> 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
> 


  reply	other threads:[~2021-05-11 16:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-11 15:43 [kvm-unit-tests BUG] lib/ldiv32.c breaks arm compilation Alexandru Elisei
2021-05-11 16:43 ` Paolo Bonzini [this message]
2021-05-11 17:03   ` Alexandru Elisei
2021-05-11 17:10     ` Paolo Bonzini
2021-05-11 17:41     ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=604b1638-452f-e8e3-b674-014d634e2767@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=alexandru.elisei@arm.com \
    --cc=drjones@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).