[FFmpeg-devel] [PATCH] configure: make sure LTO does not optimize out the test functions
Andreas Cadhalpun
andreas.cadhalpun at googlemail.com
Wed Oct 26 02:16:13 EEST 2016
On 25.10.2016 23:34, Carl Eugen Hoyos wrote:
> 2016-10-25 19:19 GMT+02:00 Andreas Cadhalpun <andreas.cadhalpun at googlemail.com>:
>
>> + # LTO could optimize out the test functions without this
>> + echo "#if defined(__GNUC__) && __GNUC__ >= 4"
>> + echo " #define USED __attribute__((used))"
>> + echo "#else"
>> + echo " #define USED"
>> + echo "#endif"
>
> Why is the ugly #if - #else - #endif necessary?
I'm under the impression that __attribute__((used)) is not available for all compilers,
see e.g. libavutil/attributes.h.
But thinking more about it, a better way is to actually use the functions so that
LTO can't optimize them out. This avoids the ugly preprocessor checks.
> Please mention ticket #5909 if it is related.
Sure, new patch attached.
By the way, this is not a regression in 3.1.5, but a fix included in that
release allowed them to drop their distro-specific patch, exposing the problem
with LTO.
Best regards,
Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-configure-make-sure-LTO-does-not-optimize-out-the-te.patch
Type: text/x-diff
Size: 1114 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20161026/509450a1/attachment.patch>
More information about the ffmpeg-devel
mailing list