This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[PATCH] fix use of 'if !' in shell script inld/emultempl/elf32.em
- To: binutils at sources dot redhat dot com
- Subject: [PATCH] fix use of 'if !' in shell script inld/emultempl/elf32.em
- From: cgd at broadcom dot com
- Date: 10 Oct 2001 15:25:04 -0700
When building for target mips-elf (and probably others 8-) on host
sparc-solaris (solaris 2.6, 7 and 8, at least), the generation of the
ld scripts chokes with:
/bin/sh ../../src/ld/genscripts.sh ../../src/ld /usr/local/lib /usr/local sparc-sun-solaris2.7 mips-mips-elf mips-elf "elf32ebmip" "/usr/ccs/lib" elf32ebmip "mips-elf"
../../src/ld/genscripts.sh: !: not found
(Actually, it produces that error message and continues on. That's
kind-of concerning, too, but i'm going to delcare it SEP for now. 8-)
Anyway, the code currently does:
if ! cmp -s ....; then
The 'if !' construct is not supported by the Solaris /bin/sh. (*sigh*)
If i hear no objections about the following, I'll check it in tonight
or tomorrow morning. ("obvious and trivial." 8-)
Tested by building for target mips-elf on host sparc-solaris. Error
message went away. No unexpected failures from 'make check'.
chris
==
for ld/ChangeLog:
2001-10-10 Chris Demetriou <cgd@broadcom.com>
* emultempl/elf32.em: Fix shell 'if' usage for portability.
Index: emultempl/elf32.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/elf32.em,v
retrieving revision 1.61
diff -u -r1.61 elf32.em
--- elf32.em 2001/10/05 16:36:55 1.61
+++ elf32.em 2001/10/10 22:23:16
@@ -1349,7 +1349,8 @@
sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
-if ! cmp -s ldscripts/${EMULATION_NAME}.x ldscripts/${EMULATION_NAME}.xn; then
+cmp -s ldscripts/${EMULATION_NAME}.x ldscripts/${EMULATION_NAME}.xn
+if test "$?" -ne 0 ; then
echo ' ; else if (!config.magic_demand_paged) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xn >> e${EMULATION_NAME}.c
fi