1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/patches/binutils/2.20/280-unexport_LD_LIBRARY_PATH.patch Sat Jan 22 22:35:43 2011 +0100
1.3 @@ -0,0 +1,95 @@
1.4 +Description:
1.5 +
1.6 +This patch is needed in situations where build system is running same version of
1.7 +binutils that is intended to be built cross-native ( build != host = target)
1.8 + and has shared libraries enabled. binutils/binutils
1.9 +Makefile has some tools which are built to run on build system. Toplevel makefile
1.10 +for binutils passes HOST_EXPORTS to sub-makefiles which also include RPATH_ENVVARS
1.11 +containing LD_LIBRARY_PATH which is modified so that it also includes host libraries
1.12 +like opcodes and libbfd which are just built for the host system.
1.13 +
1.14 +Now the problem is that same LD_LIBRARY_PATH value gets set in environment even
1.15 +for the tools that are being built for build system using CC_FOR_BUILD and the tools
1.16 +like as,ld it invokes from build machine get the LD_LIBRARY_PATH set to search
1.17 +the newly build host libraries like opcodes and bfd and if host is like a big endian
1.18 +system say (mips-linux) the build system linker and assembler do not run because
1.19 +ld.so tries to load these shared libraries instead of the ones from /usr/lib for
1.20 +the build tools.
1.21 +
1.22 +This patch fixes the issue by clearing LD_LIBRARY_PATH for BUILD tools
1.23 +
1.24 +This patch would be needed on other versions of binutils. I just cared about 2.20
1.25 +May be upstream is also interested in such a patch.
1.26 +
1.27 +-Khem
1.28 +
1.29 +Index: binutils-2.20/binutils/Makefile.am
1.30 +===================================================================
1.31 +--- binutils-2.20.orig/binutils/Makefile.am 2009-12-30 15:30:35.302438121 -0800
1.32 ++++ binutils-2.20/binutils/Makefile.am 2009-12-30 15:33:09.154420373 -0800
1.33 +@@ -251,24 +251,24 @@ sysroff.h: sysinfo$(EXEEXT_FOR_BUILD) sy
1.34 + ./sysinfo$(EXEEXT_FOR_BUILD) -d <$(srcdir)/sysroff.info >sysroff.h
1.35 +
1.36 + sysinfo$(EXEEXT_FOR_BUILD): sysinfo.o syslex.o
1.37 +- $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ sysinfo.o syslex.o
1.38 ++ LD_LIBRARY_PATH= $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ sysinfo.o syslex.o
1.39 +
1.40 + syslex.o: syslex.c sysinfo.h config.h
1.41 + if [ -r syslex.c ]; then \
1.42 +- $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) syslex.c -Wno-error ; \
1.43 ++ LD_LIBRARY_PATH= $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) syslex.c -Wno-error ; \
1.44 + else \
1.45 +- $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(srcdir)/syslex.c -Wno-error ;\
1.46 ++ LD_LIBRARY_PATH= $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(srcdir)/syslex.c -Wno-error ;\
1.47 + fi
1.48 +
1.49 + sysinfo.o: sysinfo.c
1.50 + if [ -r sysinfo.c ]; then \
1.51 +- $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) sysinfo.c -Wno-error ; \
1.52 ++ LD_LIBRARY_PATH= $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) sysinfo.c -Wno-error ; \
1.53 + else \
1.54 +- $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(srcdir)/sysinfo.c -Wno-error ; \
1.55 ++ LD_LIBRARY_PATH= $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(srcdir)/sysinfo.c -Wno-error ; \
1.56 + fi
1.57 +
1.58 + bin2c$(EXEEXT_FOR_BUILD):
1.59 +- $(CC_FOR_BUILD) -o $@ $(AM_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(srcdir)/bin2c.c $(srcdir)/version.c
1.60 ++ LD_LIBRARY_PATH= $(CC_FOR_BUILD) -o $@ $(AM_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(srcdir)/bin2c.c $(srcdir)/version.c
1.61 +
1.62 + embedspu: embedspu.sh
1.63 + sed "s@^program_transform_name=@program_transform_name=$(program_transform_name)@" < $< > $@
1.64 +Index: binutils-2.20/binutils/Makefile.in
1.65 +===================================================================
1.66 +--- binutils-2.20.orig/binutils/Makefile.in 2009-12-30 15:30:44.582922535 -0800
1.67 ++++ binutils-2.20/binutils/Makefile.in 2009-12-30 15:33:47.322422313 -0800
1.68 +@@ -1193,24 +1193,24 @@ sysroff.h: sysinfo$(EXEEXT_FOR_BUILD) sy
1.69 + ./sysinfo$(EXEEXT_FOR_BUILD) -d <$(srcdir)/sysroff.info >sysroff.h
1.70 +
1.71 + sysinfo$(EXEEXT_FOR_BUILD): sysinfo.o syslex.o
1.72 +- $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ sysinfo.o syslex.o
1.73 ++ LD_LIBRARY_PATH= $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@ sysinfo.o syslex.o
1.74 +
1.75 + syslex.o: syslex.c sysinfo.h config.h
1.76 + if [ -r syslex.c ]; then \
1.77 +- $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) syslex.c -Wno-error ; \
1.78 ++ LD_LIBRARY_PATH= $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) syslex.c -Wno-error ; \
1.79 + else \
1.80 +- $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(srcdir)/syslex.c -Wno-error ;\
1.81 ++ LD_LIBRARY_PATH= $(CC_FOR_BUILD) -c -I. -I$(srcdir) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(srcdir)/syslex.c -Wno-error ;\
1.82 + fi
1.83 +
1.84 + sysinfo.o: sysinfo.c
1.85 + if [ -r sysinfo.c ]; then \
1.86 +- $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) sysinfo.c -Wno-error ; \
1.87 ++ LD_LIBRARY_PATH= $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) sysinfo.c -Wno-error ; \
1.88 + else \
1.89 +- $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(srcdir)/sysinfo.c -Wno-error ; \
1.90 ++ LD_LIBRARY_PATH= $(CC_FOR_BUILD) -c -I. $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(srcdir)/sysinfo.c -Wno-error ; \
1.91 + fi
1.92 +
1.93 + bin2c$(EXEEXT_FOR_BUILD):
1.94 +- $(CC_FOR_BUILD) -o $@ $(AM_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(srcdir)/bin2c.c $(srcdir)/version.c
1.95 ++ LD_LIBRARY_PATH= $(CC_FOR_BUILD) -o $@ $(AM_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $(srcdir)/bin2c.c $(srcdir)/version.c
1.96 +
1.97 + embedspu: embedspu.sh
1.98 + sed "s@^program_transform_name=@program_transform_name=$(program_transform_name)@" < $< > $@