diff mbox

[FFmpeg-devel] configure: make sure LTO does not optimize out the test functions

Message ID c7d04402-40de-1e13-08ad-54f151bb202c@googlemail.com
State Accepted
Headers show

Commit Message

Andreas Cadhalpun Oct. 25, 2016, 11:35 p.m. UTC
On 26.10.2016 01:26, Michael Niedermayer wrote:
> On Wed, Oct 26, 2016 at 01:16:13AM +0200, Andreas Cadhalpun wrote:
>>  configure |    7 ++++++-
>>  1 file changed, 6 insertions(+), 1 deletion(-)
>> 742684cf379693d08075d43fdfb75ed5e2e936c6  0001-configure-make-sure-LTO-does-not-optimize-out-the-te.patch
>> From bb289a0b2b0948afa99227bcff188301c1143624 Mon Sep 17 00:00:00 2001
>> From: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
>> Date: Tue, 25 Oct 2016 19:09:46 +0200
>> Subject: [PATCH] configure: make sure LTO does not optimize out the test
>>  functions
>>
>> Fixes trac ticket #5909
>>
>> Bud-Id: https://bugs.gentoo.org/show_bug.cgi?id=598054
>> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
>> ---
>>  configure | 7 ++++++-
>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/configure b/configure
>> index 481f692..54faef1 100755
>> --- a/configure
>> +++ b/configure
>> @@ -1150,7 +1150,12 @@ check_func_headers(){
>>          for func in $funcs; do
>>              echo "long check_$func(void) { return (long) $func; }"
>>          done
>> -        echo "int main(void) { return 0; }"
>> +        echo "int main(void) { int ret = 0;"
>> +        # LTO could optimize out the test functions without this
>> +        for func in $funcs; do
>> +            echo " ret |= ((intptr_t)check_$func) & 0xFFFF;"
>> +        done
>> +        echo "return ret; }"
> 
> breaks configure
> 
> i get this:
> 
> ERROR: LoadLibrary/dlopen not found for avisynth

I forgot to include stdint.h. Fixed patch attached.

Best regards,
Andreas

Comments

Michael Niedermayer Oct. 26, 2016, 12:07 a.m. UTC | #1
On Wed, Oct 26, 2016 at 01:35:34AM +0200, Andreas Cadhalpun wrote:
> On 26.10.2016 01:26, Michael Niedermayer wrote:
> > On Wed, Oct 26, 2016 at 01:16:13AM +0200, Andreas Cadhalpun wrote:
> >>  configure |    7 ++++++-
> >>  1 file changed, 6 insertions(+), 1 deletion(-)
> >> 742684cf379693d08075d43fdfb75ed5e2e936c6  0001-configure-make-sure-LTO-does-not-optimize-out-the-te.patch
> >> From bb289a0b2b0948afa99227bcff188301c1143624 Mon Sep 17 00:00:00 2001
> >> From: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
> >> Date: Tue, 25 Oct 2016 19:09:46 +0200
> >> Subject: [PATCH] configure: make sure LTO does not optimize out the test
> >>  functions
> >>
> >> Fixes trac ticket #5909
> >>
> >> Bud-Id: https://bugs.gentoo.org/show_bug.cgi?id=598054
> >> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
> >> ---
> >>  configure | 7 ++++++-
> >>  1 file changed, 6 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/configure b/configure
> >> index 481f692..54faef1 100755
> >> --- a/configure
> >> +++ b/configure
> >> @@ -1150,7 +1150,12 @@ check_func_headers(){
> >>          for func in $funcs; do
> >>              echo "long check_$func(void) { return (long) $func; }"
> >>          done
> >> -        echo "int main(void) { return 0; }"
> >> +        echo "int main(void) { int ret = 0;"
> >> +        # LTO could optimize out the test functions without this
> >> +        for func in $funcs; do
> >> +            echo " ret |= ((intptr_t)check_$func) & 0xFFFF;"
> >> +        done
> >> +        echo "return ret; }"
> > 
> > breaks configure
> > 
> > i get this:
> > 
> > ERROR: LoadLibrary/dlopen not found for avisynth
> 
> I forgot to include stdint.h. Fixed patch attached.

seems working here now

Acked-by: Michael

[...]
Carl Eugen Hoyos Oct. 26, 2016, 8:55 a.m. UTC | #2
2016-10-26 1:35 GMT+02:00 Andreas Cadhalpun <andreas.cadhalpun@googlemail.com>:

> I forgot to include stdint.h. Fixed patch attached.

Why don't you cast to (int)?

Carl Eugen
Andreas Cadhalpun Oct. 28, 2016, 10:57 p.m. UTC | #3
On 26.10.2016 02:07, Michael Niedermayer wrote:
> On Wed, Oct 26, 2016 at 01:35:34AM +0200, Andreas Cadhalpun wrote:
>> On 26.10.2016 01:26, Michael Niedermayer wrote:
>>> On Wed, Oct 26, 2016 at 01:16:13AM +0200, Andreas Cadhalpun wrote:
>>>>  configure |    7 ++++++-
>>>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>>> 742684cf379693d08075d43fdfb75ed5e2e936c6  0001-configure-make-sure-LTO-does-not-optimize-out-the-te.patch
>>>> From bb289a0b2b0948afa99227bcff188301c1143624 Mon Sep 17 00:00:00 2001
>>>> From: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
>>>> Date: Tue, 25 Oct 2016 19:09:46 +0200
>>>> Subject: [PATCH] configure: make sure LTO does not optimize out the test
>>>>  functions
>>>>
>>>> Fixes trac ticket #5909
>>>>
>>>> Bud-Id: https://bugs.gentoo.org/show_bug.cgi?id=598054
>>>> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
>>>> ---
>>>>  configure | 7 ++++++-
>>>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/configure b/configure
>>>> index 481f692..54faef1 100755
>>>> --- a/configure
>>>> +++ b/configure
>>>> @@ -1150,7 +1150,12 @@ check_func_headers(){
>>>>          for func in $funcs; do
>>>>              echo "long check_$func(void) { return (long) $func; }"
>>>>          done
>>>> -        echo "int main(void) { return 0; }"
>>>> +        echo "int main(void) { int ret = 0;"
>>>> +        # LTO could optimize out the test functions without this
>>>> +        for func in $funcs; do
>>>> +            echo " ret |= ((intptr_t)check_$func) & 0xFFFF;"
>>>> +        done
>>>> +        echo "return ret; }"
>>>
>>> breaks configure
>>>
>>> i get this:
>>>
>>> ERROR: LoadLibrary/dlopen not found for avisynth
>>
>> I forgot to include stdint.h. Fixed patch attached.
> 
> seems working here now
> 
> Acked-by: Michael

Pushed.

Best regards,
Andreas
diff mbox

Patch

From 3f062e381b69c8e9b59f6caa700c23deaec53b45 Mon Sep 17 00:00:00 2001
From: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Date: Tue, 25 Oct 2016 19:09:46 +0200
Subject: [PATCH] configure: make sure LTO does not optimize out the test
 functions

Fixes trac ticket #5909

Bud-Id: https://bugs.gentoo.org/show_bug.cgi?id=598054
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
---
 configure | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 481f692..5ee78eb 100755
--- a/configure
+++ b/configure
@@ -1147,10 +1147,16 @@  check_func_headers(){
         for hdr in $headers; do
             print_include $hdr
         done
+        echo "#include <stdint.h>"
         for func in $funcs; do
             echo "long check_$func(void) { return (long) $func; }"
         done
-        echo "int main(void) { return 0; }"
+        echo "int main(void) { int ret = 0;"
+        # LTO could optimize out the test functions without this
+        for func in $funcs; do
+            echo " ret |= ((intptr_t)check_$func) & 0xFFFF;"
+        done
+        echo "return ret; }"
     } | check_ld "cc" "$@" && enable $funcs && enable_safe $headers
 }
 
-- 
2.9.3