mirror of
https://github.com/yuzu-emu/unicorn
synced 2024-11-24 18:48:27 +00:00
configure: Always compile with -fwrapv
QEMU's code relies on left shifts of signed integers always being defined behaviour with the obvious 2s-complement semantics. The only way to tell the compiler (and any associated undefined-behaviour sanitizer) that we require a C dialect with these semantics is to use the -fwrapv option. This is a bit of a heavy hammer for the job as it also gives us guaranteed semantics on integer arithmetic overflow which in theory we don't require. In an ideal world this would allow us to drop the warning flag -Wno-shift-negative-value, but we must retain this to avoid spurious warnings on clang versions predating the fix to https://llvm.org/bugs/show_bug.cgi?id=25552. Backports commit 2d31515bc0880a1cea86ce638d2a109f4f4e6f7d from qemu
This commit is contained in:
parent
8b5400d675
commit
eb77f61bea
1 changed files with 5 additions and 1 deletions
6
qemu/configure
vendored
6
qemu/configure
vendored
|
@ -223,7 +223,11 @@ strip="${STRIP-${cross_prefix}strip}"
|
||||||
ARFLAGS="${ARFLAGS-rv}"
|
ARFLAGS="${ARFLAGS-rv}"
|
||||||
|
|
||||||
# default flags for all hosts
|
# default flags for all hosts
|
||||||
QEMU_CFLAGS="-fno-strict-aliasing -fno-common $QEMU_CFLAGS"
|
# We use -fwrapv to tell the compiler that we require a C dialect where
|
||||||
|
# left shift of signed integers is well defined and has the expected
|
||||||
|
# 2s-complement style results. (Both clang and gcc agree that it
|
||||||
|
# provides these semantics.)
|
||||||
|
QEMU_CFLAGS="-fno-strict-aliasing -fno-common -fwrapv $QEMU_CFLAGS"
|
||||||
QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
|
QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
|
||||||
QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
|
QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
|
||||||
QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
|
QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
|
||||||
|
|
Loading…
Reference in a new issue