Ping, still valid. On 15.02.2019 00:38, Kamil Rytarowski wrote: > On 14.02.2019 21:51, Paolo Bonzini wrote: >> On 14/02/19 20:41, Kamil Rytarowski wrote: >>> Please do replace the current kludge that is sensitive to: >>> - compiler behavior that can change with new versions >>> - compiler gcc/clang >>> - optimization options >> >> Not really, any half-decent compiler will optimize away "if (0)" and >> QEMU is far from being the only software that relies on that. >> >> GCC has been doing that even at -O0 for like 15 years, at some point it >> was basically the only optimization it did. Just try it for yourself: >> >> int f(void); >> >> int main() >> { >> if (0) >> return f(); >> else >> return 0; >> } >> >> Throw it at all compilers and optimization levels, and it *will* work. >> If it doesn't then I'll consider again your patch. >> > > I consider it as fragile hack and certainly not something to depend on. > Also in some circumstances of such code, especially "if (zero0)" we want > to enable disabled code under a debugger. > > There were also kernel backdoors due to this optimization. > >>> - linux(KVM) - non-linux (no-KVM) build >> >> That's the point. We want your non-Linux non-KVM build to be as lean as >> possible and not cause possible run-time failures due to people >> forgetting about them. >> >>> - community not actively testing non-linux no-kvm build with >>> optimization on clang >> >> False, we test OS X and there are VM builds for the BSDs. > > Unfortunately not in the same combination of options as nobody caught it > in years. (Probably not many people actually develop it on these OSes > with debug flags). I was keeping this patch locally for some time now. > This hack was introduced several years ago. > >>> My patch replaced it makes it work. >>> >>> Build error: >>> >>> LINK i386-bsd-user/qemu-i386 >> >> Ok, please use "make -C i386-bsd-user target/i386/cpu.o V=1" to get the >> command line, invoke it again with "-save-temps" at the end, and send me >> both the command line and the resulting "cpu.i" file. >> > > I'm building qemu with pkgsrc that provides all the dependencies and > compiler settings. It also uses wrappers to translate original compiler > options with transformed ones. > > Log from pkgsrc with command lines: > > http://netbsd.org/~kamil/qemu/qemu-build-2019-02-14.txt.bz2 > > Requested cpu.i (hopefully correctly generated) > > http://netbsd.org/~kamil/qemu/cpu.i.bz2 > > I've generated it manually with this command. > > /usr/local/bin/clang -iquote > /tmp/pkgsrc-tmp/wip/qemu-haxm/work/qemu-3.0.0/target/i386 -iquote > target/i386 -iquote /tmp/pkgsrc-tmp/wip/qemu-haxm/work/qemu-3.0.0/tcg > -iquote /tmp/pkgsrc-tmp/wip/qemu-haxm/work/qemu-3.0.0/tcg/i386 -iquote . > -iquote /tmp/pkgsrc-tmp/wip/qemu-haxm/work/qemu-3.0.0 -iquote > /tmp/pkgsrc-tmp/wip/qemu-haxm/work/qemu-3.0.0/accel/tcg -iquote > /tmp/pkgsrc-tmp/wip/qemu-haxm/work/qemu-3.0.0/include > -I/tmp/pkgsrc-tmp/wip/qemu-haxm/work/.x11-buildlink/include/pixman-1 > -I/tmp/pkgsrc-tmp/wip/qemu-haxm/work/qemu-3.0.0/dtc/libfdt -pthread > -I/tmp/pkgsrc-tmp/wip/qemu-haxm/work/.buildlink/include/glib/glib-2.0 > -I/tmp/pkgsrc-tmp/wip/qemu-haxm/work/.buildlink/lib/glib-2.0/include > -I/tmp/pkgsrc-tmp/wip/qemu-haxm/work/.buildlink/include -m64 -mcx16 > -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE > -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings > -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv > -Wno-error=address-of-packed-member -Wno-string-plus-int > -Wno-initializer-overrides -Wexpansion-to-defined -Wendif-labels > -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body > -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self > -Wignored-qualifiers -Wold-style-definition -Wtype-limits > -fstack-protector-strong > -I/tmp/pkgsrc-tmp/wip/qemu-haxm/work/.buildlink/include/libpng16 > -I/tmp/pkgsrc-tmp/wip/qemu-haxm/work/qemu-3.0.0/capstone/include -iquote > .. -iquote /tmp/pkgsrc-tmp/wip/qemu-haxm/work/qemu-3.0.0/target/i386 > -DNEED_CPU_H -iquote > /tmp/pkgsrc-tmp/wip/qemu-haxm/work/qemu-3.0.0/include -MMD -MP -MT > target/i386/cpu.o -MF target/i386/cpu.d -O2 -g -O2 -O0 -g -ggdb > -I/tmp/pkgsrc-tmp/wip/qemu-haxm/work/.buildlink/include/SDL2 > -I/tmp/pkgsrc-tmp/wip/qemu-haxm/work/.x11-buildlink/include > -I/tmp/pkgsrc-tmp/wip/qemu-haxm/work/.x11-buildlink/include/libdrm > -I/tmp/pkgsrc-tmp/wip/qemu-haxm/work/.buildlink/include/glib/gio-unix-2.0 > -I/usr/include/krb5 -c -o target/i386/cpu.o > /tmp/pkgsrc-tmp/wip/qemu-haxm/work/qemu-3.0.0/target/i386/cpu.c > -Qunused-arguments -fstack-protector -save-temps > >> Paolo >> >>> /usr/bin/ld: /usr/lib/libc.so and /usr/lib/crt0.o: warning: multiple >>> common of `environ' >>> /usr/bin/ld: target/i386/cpu.o: in function `x86_cpu_filter_features': >>> /tmp/pkgsrc-tmp/emulators/qemu/work/qemu-3.1.0/target/i386/cpu.c:5047: >>> undefined reference to `kvm_arch_get_supported_cpuid' >>> /usr/bin/ld: >>> /tmp/pkgsrc-tmp/emulators/qemu/work/qemu-3.1.0/target/i386/cpu.c:5048: >>> undefined reference to `kvm_arch_get_supported_cpuid' >>> /usr/bin/ld: >>> /tmp/pkgsrc-tmp/emulators/qemu/work/qemu-3.1.0/target/i386/cpu.c:5049: >>> undefined reference to `kvm_arch_get_supported_cpuid' >>> /usr/bin/ld: >>> /tmp/pkgsrc-tmp/emulators/qemu/work/qemu-3.1.0/target/i386/cpu.c:5050: >>> undefined reference to `kvm_arch_get_supported_cpuid' >>> /usr/bin/ld: >>> /tmp/pkgsrc-tmp/emulators/qemu/work/qemu-3.1.0/target/i386/cpu.c:5051: >>> undefined reference to `kvm_arch_get_supported_cpuid' >>> clang-9: error: linker command failed with exit code 1 (use -v to see >>> invocation) >>> make[1]: *** [Makefile:199: qemu-i386] Error 1 >>> gmake: *** [Makefile:483: subdir-i386-bsd-user] Error 2 >>> gmake: *** Waiting for unfinished jobs.... >>> LINK x86_64-bsd-user/qemu-x86_64 >>> /usr/bin/ld: /usr/lib/libc.so and /usr/lib/crt0.o: warning: multiple >>> common of `environ' >>> /usr/bin/ld: target/i386/cpu.o: in function `x86_cpu_filter_features': >>> /tmp/pkgsrc-tmp/emulators/qemu/work/qemu-3.1.0/target/i386/cpu.c:5047: >>> undefined reference to `kvm_arch_get_supported_cpuid' >>> /usr/bin/ld: >>> /tmp/pkgsrc-tmp/emulators/qemu/work/qemu-3.1.0/target/i386/cpu.c:5048: >>> undefined reference to `kvm_arch_get_supported_cpuid' >>> /usr/bin/ld: >>> /tmp/pkgsrc-tmp/emulators/qemu/work/qemu-3.1.0/target/i386/cpu.c:5049: >>> undefined reference to `kvm_arch_get_supported_cpuid' >>> /usr/bin/ld: >>> /tmp/pkgsrc-tmp/emulators/qemu/work/qemu-3.1.0/target/i386/cpu.c:5050: >>> undefined reference to `kvm_arch_get_supported_cpuid' >>> /usr/bin/ld: >>> /tmp/pkgsrc-tmp/emulators/qemu/work/qemu-3.1.0/target/i386/cpu.c:5051: >>> undefined reference to `kvm_arch_get_supported_cpuid' >>> clang-9: error: linker command failed with exit code 1 (use -v to see >>> invocation) >>> make[1]: *** [Makefile:199: qemu-x86_64] Error 1 >>> gmake: *** [Makefile:483: subdir-x86_64-bsd-user] Error 2 >>> *** Error code 2 >>> >> >> > >
signature.asc
Description: OpenPGP digital signature