* [Qemu-devel] [PATCH fix for 2.1 v2] makefile: Fix tools compile
@ 2014-07-01 7:30 Alexey Kardashevskiy
2014-07-01 7:41 ` Paolo Bonzini
0 siblings, 1 reply; 4+ messages in thread
From: Alexey Kardashevskiy @ 2014-07-01 7:30 UTC (permalink / raw)
To: qemu-devel; +Cc: Alexey Kardashevskiy, Peter Maydell, Paolo Bonzini
The existing test whether "-lm" needs to be included or not is
insufficient as it reports false negative on Fedora20/ppc64.
This happens because sin(0.0) is a constant value which compiler
can safely throw away and therefore there is no need to add "-lm".
As the result, qemu-nbd/qemu-io/qemu-img tools cannot compile.
This adds a global variable and uses it in the test to prevent
from optimization.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
Changes:
v2:
* previous s/sin/log/ replacement removed, a global variable is
used instead
---
configure | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure b/configure
index 23ecb37..6dd44a9 100755
--- a/configure
+++ b/configure
@@ -3453,7 +3453,7 @@ fi
# Do we need libm
cat > $TMPC << EOF
#include <math.h>
-int main(void) { return isnan(sin(0.0)); }
+double x; int main(void) {return isnan(sin(x));}
EOF
if compile_prog "" "" ; then
:
--
2.0.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH fix for 2.1 v2] makefile: Fix tools compile
2014-07-01 7:30 [Qemu-devel] [PATCH fix for 2.1 v2] makefile: Fix tools compile Alexey Kardashevskiy
@ 2014-07-01 7:41 ` Paolo Bonzini
2014-07-01 7:47 ` Alexey Kardashevskiy
0 siblings, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2014-07-01 7:41 UTC (permalink / raw)
To: Alexey Kardashevskiy, qemu-devel; +Cc: Peter Maydell
Il 01/07/2014 09:30, Alexey Kardashevskiy ha scritto:
> The existing test whether "-lm" needs to be included or not is
> insufficient as it reports false negative on Fedora20/ppc64.
> This happens because sin(0.0) is a constant value which compiler
> can safely throw away and therefore there is no need to add "-lm".
> As the result, qemu-nbd/qemu-io/qemu-img tools cannot compile.
>
> This adds a global variable and uses it in the test to prevent
> from optimization.
>
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
>
> ---
> Changes:
> v2:
> * previous s/sin/log/ replacement removed, a global variable is
> used instead
> ---
> configure | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index 23ecb37..6dd44a9 100755
> --- a/configure
> +++ b/configure
> @@ -3453,7 +3453,7 @@ fi
> # Do we need libm
> cat > $TMPC << EOF
> #include <math.h>
> -int main(void) { return isnan(sin(0.0)); }
> +double x; int main(void) {return isnan(sin(x));}
> EOF
> if compile_prog "" "" ; then
> :
>
Can you please test with this hunk on top:
diff --git a/Makefile.target b/Makefile.target
index 6089d29..137d0b0 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -163,10 +163,6 @@ dummy := $(call unnest-vars,.., \
all-obj-y += $(common-obj-y)
all-obj-$(CONFIG_SOFTMMU) += $(block-obj-y)
-ifndef CONFIG_HAIKU
-LIBS+=-lm
-endif
-
# build either PROG or PROGW
$(QEMU_PROG_BUILD): $(all-obj-y) ../libqemuutil.a ../libqemustub.a
$(call LINK,$^)
It should now be unnecessary.
Paolo
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH fix for 2.1 v2] makefile: Fix tools compile
2014-07-01 7:41 ` Paolo Bonzini
@ 2014-07-01 7:47 ` Alexey Kardashevskiy
2014-07-01 7:54 ` Paolo Bonzini
0 siblings, 1 reply; 4+ messages in thread
From: Alexey Kardashevskiy @ 2014-07-01 7:47 UTC (permalink / raw)
To: Paolo Bonzini, qemu-devel; +Cc: Peter Maydell
On 07/01/2014 05:41 PM, Paolo Bonzini wrote:
> Il 01/07/2014 09:30, Alexey Kardashevskiy ha scritto:
>> The existing test whether "-lm" needs to be included or not is
>> insufficient as it reports false negative on Fedora20/ppc64.
>> This happens because sin(0.0) is a constant value which compiler
>> can safely throw away and therefore there is no need to add "-lm".
>> As the result, qemu-nbd/qemu-io/qemu-img tools cannot compile.
>>
>> This adds a global variable and uses it in the test to prevent
>> from optimization.
>>
>> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
>>
>> ---
>> Changes:
>> v2:
>> * previous s/sin/log/ replacement removed, a global variable is
>> used instead
>> ---
>> configure | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/configure b/configure
>> index 23ecb37..6dd44a9 100755
>> --- a/configure
>> +++ b/configure
>> @@ -3453,7 +3453,7 @@ fi
>> # Do we need libm
>> cat > $TMPC << EOF
>> #include <math.h>
>> -int main(void) { return isnan(sin(0.0)); }
>> +double x; int main(void) {return isnan(sin(x));}
>> EOF
>> if compile_prog "" "" ; then
>> :
>>
>
> Can you please test with this hunk on top:
>
> diff --git a/Makefile.target b/Makefile.target
> index 6089d29..137d0b0 100644
> --- a/Makefile.target
> +++ b/Makefile.target
> @@ -163,10 +163,6 @@ dummy := $(call unnest-vars,.., \
> all-obj-y += $(common-obj-y)
> all-obj-$(CONFIG_SOFTMMU) += $(block-obj-y)
>
> -ifndef CONFIG_HAIKU
> -LIBS+=-lm
> -endif
> -
> # build either PROG or PROGW
> $(QEMU_PROG_BUILD): $(all-obj-y) ../libqemuutil.a ../libqemustub.a
> $(call LINK,$^)
>
> It should now be unnecessary.
Tried, all good.
--
Alexey
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH fix for 2.1 v2] makefile: Fix tools compile
2014-07-01 7:47 ` Alexey Kardashevskiy
@ 2014-07-01 7:54 ` Paolo Bonzini
0 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2014-07-01 7:54 UTC (permalink / raw)
To: Alexey Kardashevskiy, qemu-devel; +Cc: Peter Maydell
Il 01/07/2014 09:47, Alexey Kardashevskiy ha scritto:
> On 07/01/2014 05:41 PM, Paolo Bonzini wrote:
>> Il 01/07/2014 09:30, Alexey Kardashevskiy ha scritto:
>>> The existing test whether "-lm" needs to be included or not is
>>> insufficient as it reports false negative on Fedora20/ppc64.
>>> This happens because sin(0.0) is a constant value which compiler
>>> can safely throw away and therefore there is no need to add "-lm".
>>> As the result, qemu-nbd/qemu-io/qemu-img tools cannot compile.
>>>
>>> This adds a global variable and uses it in the test to prevent
>>> from optimization.
>>>
>>> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
>>>
>>> ---
>>> Changes:
>>> v2:
>>> * previous s/sin/log/ replacement removed, a global variable is
>>> used instead
>>> ---
>>> configure | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/configure b/configure
>>> index 23ecb37..6dd44a9 100755
>>> --- a/configure
>>> +++ b/configure
>>> @@ -3453,7 +3453,7 @@ fi
>>> # Do we need libm
>>> cat > $TMPC << EOF
>>> #include <math.h>
>>> -int main(void) { return isnan(sin(0.0)); }
>>> +double x; int main(void) {return isnan(sin(x));}
>>> EOF
>>> if compile_prog "" "" ; then
>>> :
>>>
>>
>> Can you please test with this hunk on top:
>>
>> diff --git a/Makefile.target b/Makefile.target
>> index 6089d29..137d0b0 100644
>> --- a/Makefile.target
>> +++ b/Makefile.target
>> @@ -163,10 +163,6 @@ dummy := $(call unnest-vars,.., \
>> all-obj-y += $(common-obj-y)
>> all-obj-$(CONFIG_SOFTMMU) += $(block-obj-y)
>>
>> -ifndef CONFIG_HAIKU
>> -LIBS+=-lm
>> -endif
>> -
>> # build either PROG or PROGW
>> $(QEMU_PROG_BUILD): $(all-obj-y) ../libqemuutil.a ../libqemustub.a
>> $(call LINK,$^)
>>
>> It should now be unnecessary.
>
>
> Tried, all good.
Thanks, applied to scsi-next.
Paolo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-07-01 7:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-01 7:30 [Qemu-devel] [PATCH fix for 2.1 v2] makefile: Fix tools compile Alexey Kardashevskiy
2014-07-01 7:41 ` Paolo Bonzini
2014-07-01 7:47 ` Alexey Kardashevskiy
2014-07-01 7:54 ` Paolo Bonzini
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).