public inbox for gas2@sourceware.org
 help / color / mirror / Atom feed
* ldscripts should be renamed ldscripts.new
@ 1994-11-08 21:03 Rick Sladkey
  0 siblings, 0 replies; only message in thread
From: Rick Sladkey @ 1994-11-08 21:03 UTC (permalink / raw)
  To: gas2

When invoked with an emulation, as in:

	ld -m elf_i386

the GNU linker will look for and use, for example:

	 ldscripts/elf_i386.x

relative to the current directory.

Since this may be the case when linking the GNU linker with a previous
version of itself, it is possible for the old linker not to understand
the new linker's command file syntax.

I was bitten by this problem when building ELF versions of binutils
2.5.2 when the default emulation is a.out.  This is because the specs
file for i486-linuxelf invokes ld as described above.

Perhaps the search order for emulations should not include the current
directory by default (its too late to change old versions :-).  To be
entirely safe we should also change the bintutils-x.y.z/ld/ldscripts
directory to binutils-x.y.z/ld/ldscripts.new.

Untested sample patch follows.
-----
Tue Nov  8 23:56:45 1994  Rick Sladkey  <jrs@world.std.com>

	* Makefile.in, configure.in, genscripts.sh: Use ldscripts.new
	instead of ldscripts to prevent possible old linker conflicts.
	* ldmain.c (set_scripts_dir): Don't default to the current
	directory if we can't determine the pathname of the binary.

--- binutils-2.5.2/ld/Makefile.in-dist	Wed Oct 19 14:36:47 1994
+++ binutils-2.5.2/ld/Makefile.in	Tue Nov  8 23:50:07 1994
@@ -222,7 +222,7 @@
 
 LINTSOURCES = $(CFILES) $(GENERATED_CFILES) e*.c
 
-STAGESTUFF = *.o ldscripts/* e*.c
+STAGESTUFF = *.o ldscripts.new/* e*.c
 
 info: ld.info
 .PHONY: info
@@ -705,7 +705,7 @@
 clean: mostlyclean
 	-rm -f $(LD_PROG) configdoc.texi
 distclean:
-	-rm -fr Makefile config.status TAGS sysdep.h ldscripts site.exp site.bak \
+	-rm -fr Makefile config.status TAGS sysdep.h ldscripts.new site.exp site.bak \
 		$(STAGESTUFF) ld.?? ld.??s ld.toc ld.aux ld.log ldlex.[qp] \
 		$(LD_PROG) ld ld1 ld2 ld3 *.o y.output cdtest cdtest.out \
 		configdoc.texi tmpdir
@@ -733,8 +733,8 @@
 install: 
 	$(INSTALL_XFORM) ld.new $(bindir)/ld
 	$(INSTALL_XFORM1) $(srcdir)/ld.1 $(man1dir)/ld.1
-	for f in ldscripts/*; do \
-	  $(INSTALL_DATA) $$f $(scriptdir)/$$f ; \
+	for f in `(cd ldscripts.new && echo *)`; do \
+	  $(INSTALL_DATA) $$f $(scriptdir)/ldscripts/$$f ; \
 	done
 	-n=`t='$(program_transform_name)'; echo ld | sed -e "" $$t`; \
 	  rm -f $(tooldir)/bin/ld; \
--- binutils-2.5.2/ld/configure.in-dist	Fri Oct 21 18:19:47 1994
+++ binutils-2.5.2/ld/configure.in	Tue Nov  8 23:51:34 1994
@@ -175,4 +175,4 @@
 rm -f Makefile.tmp
 mv Makefile.2 Makefile
 
-mkdir ldscripts 2>/dev/null
+mkdir ldscripts.new 2>/dev/null
--- binutils-2.5.2/ld/genscripts.sh-dist	Mon Sep 26 14:00:13 1994
+++ binutils-2.5.2/ld/genscripts.sh	Tue Nov  8 23:48:53 1994
@@ -78,30 +78,30 @@
 DATA_ALIGNMENT=${DATA_ALIGNMENT_r}
 DEFAULT_DATA_ALIGNMENT="ALIGN(${SEGMENT_SIZE})"
 (. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc) | sed -e '/^ *$/d' > \
-  ldscripts/${EMULATION_NAME}.xr
+  ldscripts.new/${EMULATION_NAME}.xr
 
 LD_FLAG=u
 DATA_ALIGNMENT=${DATA_ALIGNMENT_u}
 CONSTRUCTING=" "
 (. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc) | sed -e '/^ *$/d' > \
-  ldscripts/${EMULATION_NAME}.xu
+  ldscripts.new/${EMULATION_NAME}.xu
 
 LD_FLAG=
 DATA_ALIGNMENT=${DATA_ALIGNMENT_}
 RELOCATING=" "
 (. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc) | sed -e '/^ *$/d' > \
-  ldscripts/${EMULATION_NAME}.x
+  ldscripts.new/${EMULATION_NAME}.x
 
 LD_FLAG=n
 DATA_ALIGNMENT=${DATA_ALIGNMENT_n}
 TEXT_START_ADDR=${NONPAGED_TEXT_START_ADDR-${TEXT_START_ADDR}}
 (. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc) | sed -e '/^ *$/d' > \
-  ldscripts/${EMULATION_NAME}.xn
+  ldscripts.new/${EMULATION_NAME}.xn
 
 LD_FLAG=N
 DATA_ALIGNMENT=${DATA_ALIGNMENT_N}
 (. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc) | sed -e '/^ *$/d' > \
-  ldscripts/${EMULATION_NAME}.xbn
+  ldscripts.new/${EMULATION_NAME}.xbn
 
 if test -n "$GENERATE_SHLIB_SCRIPT"; then
   LD_FLAG=shared
@@ -109,7 +109,7 @@
   CREATE_SHLIB=" "
   # Note that TEXT_START_ADDR is set to NONPAGED_TEXT_START_ADDR.
   (. ${srcdir}/scripttempl/${SCRIPT_NAME}.sc) | sed -e '/^ *$/d' > \
-    ldscripts/${EMULATION_NAME}.xs
+    ldscripts.new/${EMULATION_NAME}.xs
 fi
 
 test "$DEFAULT_EMULATION" = "$EMULATION_NAME" && COMPILE_IN=true
--- binutils-2.5.2/ld/ldmain.c-dist	Wed Oct 26 01:23:55 1994
+++ binutils-2.5.2/ld/ldmain.c	Tue Nov  8 23:55:51 1994
@@ -451,9 +451,9 @@
     }
   else
     {
-      dirlen = 1;
-      dir = (char *) xmalloc (dirlen + 8);
-      strcpy (dir, ".");
+      /* Who knows where we came from.  We could look ourselves
+	 in the path as this point but even that is unreliable.  */
+      return;
     }
 
   if (check_for_scripts_dir (dir))

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1994-11-08 21:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1994-11-08 21:03 ldscripts should be renamed ldscripts.new Rick Sladkey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).