From 541ecb8d06fe2f1808606fa3ed8f46a285b4922d Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Fri, 22 Aug 2003 12:47:39 +0000 Subject: [PATCH] Make binutils not leak libraries --- make/uclibc_toolchain.mk | 25 ++----- sources/binutils-001_ld_makefile.patch | 22 ++++++ sources/binutils-006_better_file_error.patch | 17 +++++ sources/binutils-009_signed_char_fix.patch | 12 +++ .../binutils-012_check_ldrunpath_length.patch | 21 ++++++ sources/binutils-906-hjl_libtool_dso.patch | 73 +++++++++++++++++++ 6 files changed, 151 insertions(+), 19 deletions(-) create mode 100644 sources/binutils-001_ld_makefile.patch create mode 100644 sources/binutils-006_better_file_error.patch create mode 100644 sources/binutils-009_signed_char_fix.patch create mode 100644 sources/binutils-012_check_ldrunpath_length.patch create mode 100644 sources/binutils-906-hjl_libtool_dso.patch diff --git a/make/uclibc_toolchain.mk b/make/uclibc_toolchain.mk index 980381948d..94e3823cf4 100644 --- a/make/uclibc_toolchain.mk +++ b/make/uclibc_toolchain.mk @@ -41,9 +41,6 @@ MULTILIB:=--enable-multilib # here at the top... Easier to find things here anyways... # ############################################################# -#BINUTILS_SITE:=ftp://ftp.gnu.org/gnu/binutils -#BINUTILS_SOURCE:=binutils-2.13.2.1.tar.bz2 -#BINUTILS_DIR:=$(TOOL_BUILD_DIR)/binutils-2.13.2.1 BINUTILS_SITE:=http://ftp.kernel.org/pub/linux/devel/binutils BINUTILS_SOURCE:=binutils-2.14.90.0.5.tar.bz2 BINUTILS_DIR:=$(TOOL_BUILD_DIR)/binutils-2.14.90.0.5 @@ -125,23 +122,11 @@ $(BINUTILS_DIR)/.patched: $(BINUTILS_DIR)/.unpacked # Apply any files named binutils-*.patch from the source directory to binutils $(SOURCE_DIR)/patch-kernel.sh $(BINUTILS_DIR) $(SOURCE_DIR) binutils-*.patch # - # Enable combreloc, since it is such a nice thing to have... + # Hack binutils to use the correct default shared lib loader # - -perl -i -p -e "s,link_info.combreloc = false,link_info.combreloc = true,g;" \ - $(BINUTILS_DIR)/ld/ldmain.c - # - # Hack binutils to use the correct shared lib loader - # - (cd $(BINUTILS_DIR); perl -i -p -e "s,#.*define.*ELF_DYNAMIC_INTERPRETER.*\".*\"\ - ,#define ELF_DYNAMIC_INTERPRETER \"/lib/ld-uClibc.so.0\",;" \ - `grep -lr "ELF_DYNAMIC_INTERPRETER" $(BINUTILS_DIR)`); - # - # Hack binutils to prevent it from searching the host system - # for libraries. We only want libraries for the target system. - # - (cd $(BINUTILS_DIR); perl -i -p -e "s,^NATIVE_LIB_DIRS.*,\ - NATIVE_LIB_DIRS='$(STAGING_DIR)/usr/lib $(STAGING_DIR)/lib',;" \ - $(BINUTILS_DIR)/ld/configure.host); + (cd $(BINUTILS_DIR); perl -i -p -e "s,#.*define.*ELF_DYNAMIC_INTERPRETER.*\".*\",\ + #define ELF_DYNAMIC_INTERPRETER \"/lib/ld-uClibc.so.0\",;" \ + `grep -lr ELF_DYNAMIC_INTERPRETER *`); touch $(BINUTILS_DIR)/.patched $(BINUTILS_DIR1)/.configured: $(BINUTILS_DIR)/.patched @@ -163,6 +148,8 @@ $(BINUTILS_DIR1)/.configured: $(BINUTILS_DIR)/.patched --mandir=$(STAGING_DIR)/man \ --infodir=$(STAGING_DIR)/info \ --enable-targets=$(GNU_TARGET_NAME) \ + --with-lib-path="/usr/lib:/lib" \ + --with-sysroot=$(STAGING_DIR) \ $(MULTILIB) \ --program-prefix=$(ARCH)-uclibc-); touch $(BINUTILS_DIR1)/.configured diff --git a/sources/binutils-001_ld_makefile.patch b/sources/binutils-001_ld_makefile.patch new file mode 100644 index 0000000000..c1d2ac1ece --- /dev/null +++ b/sources/binutils-001_ld_makefile.patch @@ -0,0 +1,22 @@ +--- binutils-2.11.90.0.19.orig/ld/Makefile.am ++++ binutils-2.11.90.0.19/ld/Makefile.am +@@ -19,7 +19,7 @@ + # We put the scripts in the directory $(scriptdir)/ldscripts. + # We can't put the scripts in $(datadir) because the SEARCH_DIR + # directives need to be different for native and cross linkers. +-scriptdir = $(tooldir)/lib ++scriptdir = $(libdir) + + EMUL = @EMUL@ + EMULATION_OFILES = @EMULATION_OFILES@ +--- binutils-2.11.90.0.19.orig/ld/Makefile.in ++++ binutils-2.11.90.0.19/ld/Makefile.in +@@ -123,7 +123,7 @@ + # We put the scripts in the directory $(scriptdir)/ldscripts. + # We can't put the scripts in $(datadir) because the SEARCH_DIR + # directives need to be different for native and cross linkers. +-scriptdir = $(tooldir)/lib ++scriptdir = $(libdir) + + EMUL = @EMUL@ + EMULATION_OFILES = @EMULATION_OFILES@ diff --git a/sources/binutils-006_better_file_error.patch b/sources/binutils-006_better_file_error.patch new file mode 100644 index 0000000000..38ef52966e --- /dev/null +++ b/sources/binutils-006_better_file_error.patch @@ -0,0 +1,17 @@ +diff -urN binutils-2.11.92.0.5/bfd/opncls.c binutils-2.11.92.0.5.new/bfd/opncls.c +--- binutils-2.11.92.0.5/bfd/opncls.c Mon Oct 1 18:25:21 2001 ++++ binutils-2.11.92.0.5.new/bfd/opncls.c Sat Oct 13 11:26:59 2001 +@@ -127,6 +127,13 @@ + { + bfd *nbfd; + const bfd_target *target_vec; ++ struct stat s; ++ ++ if (stat (filename, &s) == 0) ++ if (S_ISDIR(s.st_mode)) { ++ bfd_set_error (bfd_error_file_not_recognized); ++ return NULL; ++ } + + nbfd = _bfd_new_bfd (); + if (nbfd == NULL) diff --git a/sources/binutils-009_signed_char_fix.patch b/sources/binutils-009_signed_char_fix.patch new file mode 100644 index 0000000000..b3709dabed --- /dev/null +++ b/sources/binutils-009_signed_char_fix.patch @@ -0,0 +1,12 @@ +diff -urN binutils-2.11.92.0.12.3/opcodes/i386-dis.c binutils-2.11.92.0.12.3.new/opcodes/i386-dis.c +--- binutils-2.11.92.0.12.3/opcodes/i386-dis.c Fri Nov 16 17:05:55 2001 ++++ binutils-2.11.92.0.12.3.new/opcodes/i386-dis.c Mon Dec 31 15:55:04 2001 +@@ -1830,7 +1830,7 @@ + * The function returns the length of this instruction in bytes. + */ + +-static char intel_syntax; ++static signed char intel_syntax; + static char open_char; + static char close_char; + static char separator_char; diff --git a/sources/binutils-012_check_ldrunpath_length.patch b/sources/binutils-012_check_ldrunpath_length.patch new file mode 100644 index 0000000000..5aa09abef5 --- /dev/null +++ b/sources/binutils-012_check_ldrunpath_length.patch @@ -0,0 +1,21 @@ +diff -urN binutils-2.12.90.0.12/ld/emultempl/elf32.em binutils-2.12.90.0.12.new/ld/emultempl/elf32.em +--- binutils-2.12.90.0.12/ld/emultempl/elf32.em Wed Jun 19 00:41:59 2002 ++++ binutils-2.12.90.0.12.new/ld/emultempl/elf32.em Wed Jun 26 10:00:26 2002 +@@ -672,6 +672,8 @@ + && command_line.rpath == NULL) + { + lib_path = (const char *) getenv ("LD_RUN_PATH"); ++ if ((lib_path) && (strlen (lib_path) == 0)) ++ lib_path = NULL; + if (gld${EMULATION_NAME}_search_needed (lib_path, l->name, + force)) + break; +@@ -867,6 +869,8 @@ + rpath = command_line.rpath; + if (rpath == NULL) + rpath = (const char *) getenv ("LD_RUN_PATH"); ++ if ((rpath) && (strlen (rpath) == 0)) ++ rpath = NULL; + if (! (bfd_elf${ELFSIZE}_size_dynamic_sections + (output_bfd, command_line.soname, rpath, + command_line.filter_shlib, diff --git a/sources/binutils-906-hjl_libtool_dso.patch b/sources/binutils-906-hjl_libtool_dso.patch new file mode 100644 index 0000000000..b778f39187 --- /dev/null +++ b/sources/binutils-906-hjl_libtool_dso.patch @@ -0,0 +1,73 @@ +http://sources.redhat.com/ml/binutils/2003-05/msg00739.html + +2003-05-23 H.J. Lu + + * ltmain.sh: Make symlink for shared library if needed. + +opcodes/ + +2003-05-23 H.J. Lu + + * Makefile.am (libopcodes_la_LIBADD): Use "-L../bfd -lbfd" + instead of "../bfd/libbfd.la". + * Makefile.in: Regenerated. + +--- binutils/ltmain.sh.dso 2002-03-22 00:16:20.000000000 -0800 ++++ binutils/ltmain.sh 2003-05-23 22:51:20.000000000 -0700 +@@ -4413,6 +4413,10 @@ relink_command=\"$relink_command\"" + # LD_LIBRARY_PATH before the program is installed. + $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" + $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? ++ if test -n "$linkname"; then ++ $show "(cd $output_objdir && $rm ../$linkname && $LN_S $output_objdir/$linkname ../$linkname)" ++ $run eval '(cd $output_objdir && $rm ../$linkname && $LN_S $output_objdir/$linkname ../$linkname)' || exit $? ++ fi + ;; + esac + exit 0 +--- binutils/opcodes/Makefile.am.dso 2003-05-19 08:23:00.000000000 -0700 ++++ binutils/opcodes/Makefile.am 2003-05-23 22:46:29.000000000 -0700 +@@ -283,7 +283,7 @@ disassemble.lo: disassemble.c $(INCDIR)/ + + libopcodes_la_SOURCES = dis-buf.c disassemble.c + libopcodes_la_DEPENDENCIES = $(OFILES) ../bfd/libbfd.la +-libopcodes_la_LIBADD = $(OFILES) @WIN32LIBADD@ ../bfd/libbfd.la ++libopcodes_la_LIBADD = $(OFILES) @WIN32LIBADD@ -L../bfd -lbfd + libopcodes_la_LDFLAGS = -release $(VERSION) @WIN32LDFLAGS@ + + # libtool will build .libs/libopcodes.a. We create libopcodes.a in +--- binutils/opcodes/Makefile.in.dso 2003-05-20 08:37:53.000000000 -0700 ++++ binutils/opcodes/Makefile.in 2003-05-23 22:46:31.000000000 -0700 +@@ -1,4 +1,4 @@ +-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am ++# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am + + # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation +@@ -393,7 +393,7 @@ INCLUDES = -D_GNU_SOURCE -I. -I$(srcdir) + + libopcodes_la_SOURCES = dis-buf.c disassemble.c + libopcodes_la_DEPENDENCIES = $(OFILES) ../bfd/libbfd.la +-libopcodes_la_LIBADD = $(OFILES) @WIN32LIBADD@ ../bfd/libbfd.la ++libopcodes_la_LIBADD = $(OFILES) @WIN32LIBADD@ -L../bfd -lbfd + libopcodes_la_LDFLAGS = -release $(VERSION) @WIN32LDFLAGS@ + + # libtool will build .libs/libopcodes.a. We create libopcodes.a in +@@ -592,7 +592,7 @@ libopcodes.la: $(libopcodes_la_OBJECTS) + all-recursive install-data-recursive install-exec-recursive \ + installdirs-recursive install-recursive uninstall-recursive install-info-recursive \ + check-recursive installcheck-recursive info-recursive dvi-recursive: +- @set fnord $(MAKEFLAGS); amf=$$2; \ ++ @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ +@@ -612,7 +612,7 @@ check-recursive installcheck-recursive i + + mostlyclean-recursive clean-recursive distclean-recursive \ + maintainer-clean-recursive: +- @set fnord $(MAKEFLAGS); amf=$$2; \ ++ @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ + rev="$$subdir $$rev"; \ -- 2.30.2