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