Commit 541ecb8d authored by Eric Andersen's avatar Eric Andersen
Browse files

Make binutils not leak libraries

parent 772128bd
Loading
Loading
Loading
Loading
+6 −19
Original line number Diff line number Diff line
@@ -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
+22 −0
Original line number Diff line number Diff line
--- 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@
+17 −0
Original line number Diff line number Diff line
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)
+12 −0
Original line number Diff line number Diff line
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;
+21 −0
Original line number Diff line number Diff line
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,
Loading