Fixes trac ticket #5909
Bud-Id: https://bugs.gentoo.org/show_bug.cgi?id=598054
Acked-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
(cherry picked from commit 890eb3d7c477b9fd2c6b1fa0785aca1d02a12e29)
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
... | ... |
@@ -1146,10 +1146,16 @@ check_func_headers(){ |
1146 | 1146 |
for hdr in $headers; do |
1147 | 1147 |
print_include $hdr |
1148 | 1148 |
done |
1149 |
+ echo "#include <stdint.h>" |
|
1149 | 1150 |
for func in $funcs; do |
1150 | 1151 |
echo "long check_$func(void) { return (long) $func; }" |
1151 | 1152 |
done |
1152 |
- echo "int main(void) { return 0; }" |
|
1153 |
+ echo "int main(void) { int ret = 0;" |
|
1154 |
+ # LTO could optimize out the test functions without this |
|
1155 |
+ for func in $funcs; do |
|
1156 |
+ echo " ret |= ((intptr_t)check_$func) & 0xFFFF;" |
|
1157 |
+ done |
|
1158 |
+ echo "return ret; }" |
|
1153 | 1159 |
} | check_ld "cc" "$@" && enable $funcs && enable_safe $headers |
1154 | 1160 |
} |
1155 | 1161 |
|