From f8885d9d0742deab59d0dfda28dbbf12bf0ecedc Mon Sep 17 00:00:00 2001 From: Bernardo Meurer Date: Fri, 20 Aug 2021 13:40:52 -0700 Subject: [PATCH] libbfd: fix binutils components patch Co-authored-by: John Ericson --- .../build-components-separately.patch | 49 ++++++++++--------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/pkgs/development/tools/misc/binutils/build-components-separately.patch b/pkgs/development/tools/misc/binutils/build-components-separately.patch index 38fa4934a28a..8e2052820121 100644 --- a/pkgs/development/tools/misc/binutils/build-components-separately.patch +++ b/pkgs/development/tools/misc/binutils/build-components-separately.patch @@ -1,8 +1,8 @@ diff --git a/bfd/configure.ac b/bfd/configure.ac -index c5bfbd5d..45ad4c26 100644 +index fec067b2135..377e1f5443f 100644 --- a/bfd/configure.ac +++ b/bfd/configure.ac -@@ -278,31 +278,19 @@ AC_CACHE_CHECK(linker --as-needed support, bfd_cv_ld_as_needed, +@@ -292,30 +292,16 @@ AC_CACHE_CHECK(linker --as-needed support, bfd_cv_ld_as_needed, LT_LIB_M @@ -21,24 +21,22 @@ index c5bfbd5d..45ad4c26 100644 - if test -n "$x"; then - SHARED_LIBADD="-L`pwd`/../libiberty/pic -liberty" - fi +-fi - + SHARED_LIBADD="$SHARED_LIBADD $LIBINTL" + +-if test "$enable_shared" = "yes"; then case "${host}" in # More hacks to build DLLs on Windows. *-*-cygwin*) SHARED_LDFLAGS="-no-undefined" -- SHARED_LIBADD="-L`pwd`/../libiberty -liberty -L`pwd`/../intl -lintl -lcygwin -lkernel32" -+ SHARED_LIBADD="-liberty -lintl -lcygwin -lkernel32" - ;; - - # Use built-in libintl on macOS, since it is not provided by libc. - *-*-darwin*) -- SHARED_LIBADD="-L`pwd`/../libiberty/pic -L`pwd`/../intl -liberty -lintl" -+ SHARED_LIBADD="-liberty -lintl" +- SHARED_LIBADD="-L`pwd`/../libiberty -liberty $SHARED_LIBADD -lcygwin -lkernel32" ++ SHARED_LIBADD="-liberty $SHARED_LIBADD -lcygwin -lkernel32" ;; esac diff --git a/opcodes/Makefile.am b/opcodes/Makefile.am -index 4f06074a..6836c589 100644 +index 0e04b4c05c4..848a02662e7 100644 --- a/opcodes/Makefile.am +++ b/opcodes/Makefile.am @@ -51,7 +51,7 @@ libopcodes_la_LDFLAGS += -rpath $(rpath_bfdlibdir) @@ -50,7 +48,7 @@ index 4f06074a..6836c589 100644 BUILD_LIBS = @BUILD_LIBS@ BUILD_LIB_DEPS = @BUILD_LIB_DEPS@ -@@ -301,7 +301,7 @@ OFILES = @BFD_MACHINES@ +@@ -303,7 +303,7 @@ OFILES = @BFD_MACHINES@ # development.sh is used to determine -Werror default. CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/development.sh @@ -59,7 +57,7 @@ index 4f06074a..6836c589 100644 disassemble.lo: disassemble.c if am__fastdepCC -@@ -322,12 +322,21 @@ libopcodes_la_SOURCES = dis-buf.c disassemble.c dis-init.c +@@ -324,12 +324,21 @@ libopcodes_la_SOURCES = dis-buf.c disassemble.c dis-init.c # old version of libbfd, or to pick up libbfd for the wrong architecture # if host != build. So for building with shared libraries we use a # hardcoded path to libbfd.so instead of relying on the entries in libbfd.la. @@ -84,18 +82,19 @@ index 4f06074a..6836c589 100644 # the build directory so that we don't have to convert all the # programs that use libopcodes.a simultaneously. This is a hack which diff --git a/opcodes/configure.ac b/opcodes/configure.ac -index 00be9c88..6e589ae4 100644 +index e564f067334..5da62a3d58b 100644 --- a/opcodes/configure.ac +++ b/opcodes/configure.ac -@@ -86,6 +86,7 @@ AC_PROG_INSTALL +@@ -96,6 +96,8 @@ BFD_CC_FOR_BUILD + AC_SUBST(HDEFINES) + AC_PROG_INSTALL - AC_CHECK_HEADERS(string.h strings.h stdlib.h limits.h) - ACX_HEADER_STRING +GCC_HEADER_STDINT(bfd_stdint.h) - ++ AC_CHECK_DECLS([basename, stpcpy]) -@@ -137,61 +138,27 @@ AC_CACHE_CHECK(linker --as-needed support, bfd_cv_ld_as_needed, + # Check if sigsetjmp is available. Using AC_CHECK_FUNCS won't do +@@ -146,67 +148,31 @@ AC_CACHE_CHECK(linker --as-needed support, bfd_cv_ld_as_needed, LT_LIB_M @@ -122,7 +121,7 @@ index 00be9c88..6e589ae4 100644 -SHARED_LIBADD= +SHARED_LIBADD=-liberty SHARED_DEPENDENCIES= - if test "$enable_shared" = "yes"; then +-if test "$enable_shared" = "yes"; then -# When building a shared libopcodes, link against the pic version of libiberty -# so that apps that use libopcodes won't need libiberty just to satisfy any -# libopcodes references. @@ -131,18 +130,24 @@ index 00be9c88..6e589ae4 100644 # Note that linking against libbfd as we do here, which is itself linked # against libiberty, may not satisfy all the libopcodes libiberty references # since libbfd may not pull in the entirety of libiberty. + # Also, jam libintl into the right place in all of this: after libiberty, + # which uses it, but before -lcygwin, which it uses. -changequote(,)dnl - x=`sed -n -e 's/^[ ]*PICFLAG[ ]*=[ ]*//p' < ../libiberty/Makefile | sed -n '$p'` -changequote([,])dnl - if test -n "$x"; then - SHARED_LIBADD="-L`pwd`/../libiberty/pic -liberty" - fi +-fi - + SHARED_LIBADD="$SHARED_LIBADD $LIBINTL" + + if test "$enable_shared" = "yes"; then case "${host}" in *-*-cygwin*) SHARED_LDFLAGS="-no-undefined" -- SHARED_LIBADD="-L`pwd`/../bfd -lbfd -L`pwd`/../libiberty -liberty -L`pwd`/../intl -lintl -lcygwin" -+ SHARED_LIBADD="-lbfd -liberty -lintl -lcygwin" +- SHARED_LIBADD="-L`pwd`/../bfd -lbfd -L`pwd`/../libiberty -liberty $SHARED_LIBADD" ++ SHARED_LIBADD="-lbfd -liberty $SHARED_LIBADD" ;; - *-*-darwin*) - SHARED_LIBADD="-Wl,`pwd`/../bfd/.libs/libbfd.dylib ${SHARED_LIBADD}"