GMP test fails with -flto
Torbjörn Granlund
tg at gmplib.org
Tue Jul 2 10:41:15 UTC 2019
Richard Biener <richard.guenther at gmail.com> writes:
On Mon, Jul 1, 2019 at 11:13 PM Torbjörn Granlund <tg at gmplib.org> wrote:
>
> Vincent Lefevre <vincent at vinc17.net> writes:
>
> Yes, with LTO, the object file does not contain the structure as is.
> Thus the detection from "od -b conftest.$OBJEXT" does not work.
>
> That could be solved by generating a final executable, right?
>
Yes.
Does the patch below make sense?
The main funcion is needed as we create an executable, its references to
foo are needed, else LTO will remove foo altogether.
*** /tmp/extdiff.MsIr0g/gmp-main.3300fbb5d615/acinclude.m4 Mon Jun 17 00:11:50 2019
--- /home/tege/prec/gmp-main/acinclude.m4 Tue Jul 2 12:37:53 2019
***************
*** 3307,3313 ****
-123456789.0,
{ '\376', '\334', '\272', '\230', '\166', '\124', '\062', '\020' },
! };]
EOF
! gmp_compile="$CC $CFLAGS $CPPFLAGS -c conftest.c >&AC_FD_CC 2>&1"
if AC_TRY_EVAL(gmp_compile); then
cat >conftest.awk <<\EOF
--- 3307,3320 ----
-123456789.0,
{ '\376', '\334', '\272', '\230', '\166', '\124', '\062', '\020' },
! };
! int main(){
! int i;
! for (i = 0; i < 8; i++) {
! printf ("%d %d %f\n", foo.before[i] + foo.after[i], foo.x);
! }
! return 0;
! }]
EOF
! gmp_compile="$CC $CFLAGS $CPPFLAGS conftest.c -o conftest >&AC_FD_CC 2>&1"
if AC_TRY_EVAL(gmp_compile); then
cat >conftest.awk <<\EOF
***************
*** 3462,3470 ****
]
EOF
! gmp_cv_c_double_format=`od -b conftest.$OBJEXT | $AWK -f conftest.awk`
case $gmp_cv_c_double_format in
unknown*)
! echo "cannot match anything, conftest.$OBJEXT contains" >&AC_FD_CC
! od -b conftest.$OBJEXT >&AC_FD_CC
;;
esac
--- 3469,3477 ----
]
EOF
! gmp_cv_c_double_format=`od -b conftest | $AWK -f conftest.awk`
case $gmp_cv_c_double_format in
unknown*)
! echo "cannot match anything, conftest contains" >&AC_FD_CC
! od -b conftest >&AC_FD_CC
;;
esac
--
Torbjörn
Please encrypt, key id 0xC8601622
More information about the gmp-bugs
mailing list