Skip to content

Commit

Permalink
Fix support for the bfd library
Browse files Browse the repository at this point in the history
There was a regression: -ldl was not tried to link with the bfd library.

This commit fixes this regression.
  • Loading branch information
shindere committed Feb 13, 2020
1 parent d26d37b commit 4199406
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -547,8 +547,8 @@ OCaml 4.10.0
- #8843, #8841: fix use of off_t on 32-bit systems.
(Stephen Dolan, report by Richard Jones, review by Xavier Leroy)

- #8947, #9134: fix/improve support for the BFD library
(Sébastien Hinderer, review by Damien Doligez)
- #8947, #9134, #9302: fix/improve support for the BFD library
(Sébastien Hinderer, review by Damien Doligez and David Allsopp)

- #8951: let make's default target build the compiler
(Sébastien Hinderer, review by David Allsopp)
Expand Down
55 changes: 49 additions & 6 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -16083,7 +16083,7 @@ if ${ac_cv_lib_bfd_bfd_openr+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lbfd -liberty $LIBS"
LIBS="-lbfd -ldl $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

Expand Down Expand Up @@ -16114,7 +16114,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bfd_bfd_openr" >&5
$as_echo "$ac_cv_lib_bfd_bfd_openr" >&6; }
if test "x$ac_cv_lib_bfd_bfd_openr" = xyes; then :
bfd_ldlibs="-lbfd -liberty"
bfd_ldlibs="-lbfd -ldl"
fi

fi
Expand All @@ -16126,7 +16126,7 @@ if ${ac_cv_lib_bfd_bfd_openr+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lbfd -liberty -lz $LIBS"
LIBS="-lbfd -ldl -liberty $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

Expand Down Expand Up @@ -16157,7 +16157,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bfd_bfd_openr" >&5
$as_echo "$ac_cv_lib_bfd_bfd_openr" >&6; }
if test "x$ac_cv_lib_bfd_bfd_openr" = xyes; then :
bfd_ldlibs="-lbfd -liberty -lz"
bfd_ldlibs="-lbfd -ldl -liberty"
fi

fi
Expand All @@ -16169,7 +16169,7 @@ if ${ac_cv_lib_bfd_bfd_openr+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lbfd -liberty -lz -lintl $LIBS"
LIBS="-lbfd -ldl -liberty -lz $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

Expand Down Expand Up @@ -16200,7 +16200,50 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bfd_bfd_openr" >&5
$as_echo "$ac_cv_lib_bfd_bfd_openr" >&6; }
if test "x$ac_cv_lib_bfd_bfd_openr" = xyes; then :
bfd_ldlibs="-lbfd -liberty -lz -lintl"
bfd_ldlibs="-lbfd -ldl -liberty -lz"
fi

fi
if test -z "$bfd_ldlibs"; then :
unset ac_cv_lib_bfd_bfd_openr
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for bfd_openr in -lbfd" >&5
$as_echo_n "checking for bfd_openr in -lbfd... " >&6; }
if ${ac_cv_lib_bfd_bfd_openr+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lbfd -ldl -liberty -lz -lintl $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char bfd_openr ();
int
main ()
{
return bfd_openr ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_bfd_bfd_openr=yes
else
ac_cv_lib_bfd_bfd_openr=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bfd_bfd_openr" >&5
$as_echo "$ac_cv_lib_bfd_bfd_openr" >&6; }
if test "x$ac_cv_lib_bfd_bfd_openr" = xyes; then :
bfd_ldlibs="-lbfd -ldl -liberty -lz -lintl"
fi

fi
Expand Down
12 changes: 8 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1516,16 +1516,20 @@ AS_IF([test x"$with_bfd" != "xno"],
AS_IF([test -z "$bfd_ldlibs"],
[unset ac_cv_lib_bfd_bfd_openr
AC_CHECK_LIB([bfd], [bfd_openr],
[bfd_ldlibs="-lbfd -liberty"], [], [-liberty])])
[bfd_ldlibs="-lbfd -ldl"], [], [-ldl])])
AS_IF([test -z "$bfd_ldlibs"],
[unset ac_cv_lib_bfd_bfd_openr
AC_CHECK_LIB([bfd], [bfd_openr],
[bfd_ldlibs="-lbfd -liberty -lz"], [], [-liberty -lz])])
[bfd_ldlibs="-lbfd -ldl -liberty"], [], [-ldl -liberty])])
AS_IF([test -z "$bfd_ldlibs"],
[unset ac_cv_lib_bfd_bfd_openr
AC_CHECK_LIB([bfd], [bfd_openr],
[bfd_ldlibs="-lbfd -liberty -lz -lintl"], [],
[-liberty -lz -lintl])])
[bfd_ldlibs="-lbfd -ldl -liberty -lz"], [], [-ldl -liberty -lz])])
AS_IF([test -z "$bfd_ldlibs"],
[unset ac_cv_lib_bfd_bfd_openr
AC_CHECK_LIB([bfd], [bfd_openr],
[bfd_ldlibs="-lbfd -ldl -liberty -lz -lintl"], [],
[-ldl -liberty -lz -lintl])])
AS_IF([test -n "$bfd_ldlibs"],
[bfd_available=true
AC_DEFINE([HAS_LIBBFD])])])
Expand Down

0 comments on commit 4199406

Please sign in to comment.