0002-fix-static-build-with-binutils-2.40.patch 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. From 1e4cd78bca2bd6e0d17b6cb9caf1b172d7bac564 Mon Sep 17 00:00:00 2001
  2. From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  3. Date: Mon, 6 May 2024 08:41:49 +0200
  4. Subject: [PATCH] fix static build with binutils >= 2.40
  5. sframe library was added by binutils 2.40 and
  6. https://github.com/bminor/binutils-gdb/commit/19e559f1c91bfaedbd2f91d85ee161f3f03fda3c
  7. resulting in the following static build failure:
  8. /home/buildroot/autobuild/run/instance-1/output-1/build/binutils-2.41/bfd/elf-sframe.c:220: undefined reference to `sframe_decode'
  9. [...]
  10. configure: error: bfd library not found
  11. Fixes:
  12. - http://autobuild.buildroot.org/results/a9f3e09e6543b3773440c011e93bd41e357691e4
  13. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  14. Upstream: https://sourceforge.net/p/oprofile/bugs/295
  15. ---
  16. configure.ac | 2 +-
  17. m4/binutils.m4 | 7 +++++--
  18. 2 files changed, 6 insertions(+), 3 deletions(-)
  19. diff --git a/configure.ac b/configure.ac
  20. index dc447f89..72ef0a21 100644
  21. --- a/configure.ac
  22. +++ b/configure.ac
  23. @@ -334,7 +334,7 @@ AX_CHECK_DOCBOOK
  24. dnl finally restore the original libs setting
  25. LIBS="$ORIG_SAVE_LIBS"
  26. LIBERTY_LIBS="-liberty $DL_LIB $INTL_LIB"
  27. -BFD_LIBS="-lbfd -liberty $DL_LIB $INTL_LIB $Z_LIB"
  28. +BFD_LIBS="-lbfd -liberty $DL_LIB $INTL_LIB $SFRAME_LIB $Z_LIB"
  29. POPT_LIBS="-lpopt"
  30. AC_SUBST(LIBERTY_LIBS)
  31. AC_SUBST(BFD_LIBS)
  32. diff --git a/m4/binutils.m4 b/m4/binutils.m4
  33. index c50e2f3c..e1ccd8e7 100644
  34. --- a/m4/binutils.m4
  35. +++ b/m4/binutils.m4
  36. @@ -10,11 +10,14 @@ AC_CHECK_FUNCS(xmemdup)
  37. AC_CHECK_LIB(dl, dlopen, LIBS="$LIBS -ldl"; DL_LIB="-ldl", DL_LIB="")
  38. AC_CHECK_LIB(intl, main, LIBS="$LIBS -lintl"; INTL_LIB="-lintl", INTL_LIB="")
  39. -AC_CHECK_LIB(bfd, bfd_openr, LIBS="-lbfd $LIBS"; Z_LIB="",
  40. +AC_CHECK_LIB(bfd, bfd_openr, LIBS="-lbfd $LIBS"; SFRAME_LIB=""; Z_LIB="",
  41. [AC_CHECK_LIB(z, compress,
  42. dnl Use a different bfd function here so as not to use cached result from above
  43. [AC_CHECK_LIB(bfd, bfd_fdopenr, LIBS="-lbfd -lz $LIBS"; Z_LIB="-lz",
  44. - [AC_MSG_ERROR([bfd library not found])], -lz)
  45. +dnl Use a different bfd function here so as not to use cached result from above
  46. + [AC_CHECK_LIB(bfd, bfd_close, LIBS="-lbfd -lsframe -lz $LIBS"; SFRAME_LIB="-lsframe"; Z_LIB="-lz",
  47. + [AC_MSG_ERROR([bfd library not found])], -lsframe -lz)
  48. + ], -lz)
  49. ],
  50. [AC_MSG_ERROR([libz library not found; required by libbfd])])
  51. ]
  52. --
  53. 2.43.0