qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] fix compilation/link with clang, target-i386/cp


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH] fix compilation/link with clang, target-i386/cpu.c
Date: Mon, 11 Nov 2013 21:14:44 +0000

On 11 November 2013 21:12, Andreas Tobler <address@hidden> wrote:
> On 11.11.13 22:02, Peter Maydell wrote:
>> I think I would agree with the commenter in the bug report you
>> reference (http://llvm.org/bugs/show_bug.cgi?id=17882)
>> that this is not a clang bug. We shouldn't be relying on the
>> compiler's dead code elimination to get rid of references to
>> functions that don't exist in certain configurations. This will
>> always be unreliable (especially if compiling without optimization).
>> Instead we should either be using ifdefs or stub functions (probably
>> the latter in this case).
>
> I know it is a difficult business. And probably you're right, but from a
> dump users point of view I do not agree.
>
> I'm used to gcc, which is able to compile this, and I expect other
> compilers to be able to do the same. The compiler should work for me not
> vice versa :)

Unfortunately C doesn't work that way. If you rely on behaviour
which isn't guaranteed by the compiler authors then you have
unreliable programs. I bet if you asked the gcc developers they'd
say they didn't guarantee this to work either.

>> If you put a stub implementation of kvm_arch_get_supported_cpuid()
>> into target-i386/kvm-stub.c does this fix the compilation issue?
>
> Will try and let you know.

I've actually reproduced this with my clang/macos system (it
was masked by another build failure for which there's a patch
on list that hasn't been applied yet). I'm working up a patch
that I'll send shortly.

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]