public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
* RFA: Fix the shell used to execute mloop.in
@ 2008-07-24  7:46 Nick Clifton
  2008-07-24 10:15 ` Frank Ch. Eigler
  0 siblings, 1 reply; 8+ messages in thread
From: Nick Clifton @ 2008-07-24  7:46 UTC (permalink / raw)
  To: gdb-patches, brolley, bje, fche; +Cc: cgen

Hi Guys,

  This may be the cause of some derision but I use tcsh as my shell.
  
  The reason that I bring this up is that I recently encountered a
  problem building the FRV simulator.  It took a while but I tracked
  the problem down to the fact that the genloop.sh script in
  sim/common was invoking the target specific mloop.in script using
  the SHELL from my environment (ie tcsh) rather than the SHELL from
  the makefile that invoked it (ie bash).  Since sim/frv/mloop.in is
  written for sh-style shells using tcsh naturally did not work.  The
  genmloop.sh script does not check for a failed execution of its
  target input file (maybe it should) and the end result was an
  mloop.c file in my sim/frv build directory that was mostly empty.

  So anyway I am proposing the patch below as a solution.  It adds a
  new optional parameter to the genmloop.sh script which specifies the
  shell to use when invoking the target input file.  The I have
  modified the Makefile.in files that use genmloop.sh to pass this
  parameter specifying the shell that they use.

  I tested the patch by rebuilding all of the simulators and
  confirming that I now have a working FRV simulator which can run the
  gcc testsuite.

  There was one other problem that was specific to the FRV.  Its
  mloop.in file was missing a start-of-line-comment character near the
  beginning.  Fixing this one counts as obvious I believe.
  
  Please may I apply this patch ?

Cheers
  Nick

sim/ChangeLog
2008-07-23  Nick Clifton  <nickc@redhat.com>

	* common/genmloop.sh: Add new parameter: -shell to specify the
	command interpreter to use to run the input file.  This is
	necessary because otherwise SHELL is taken from the user's
	environment, and not from the makefile that invoked this script
	and the user might not be running an sh-like shell.
	* cris/Makefile.in: Pass -shell parameter to genmloop.sh.
	* fr30/Makefile.in: Likewise.
	* frv/Makefile.in: Likewise.
	* i960/Makefile.in: Likewise.
	* iq2000/Makefile.in: Likewise.
	* m32r/Makefile.in: Likewise.

	* frv/mloop.in: Add missing start of line comment marker.

Index: sim/common/genmloop.sh
===================================================================
RCS file: /cvs/src/src/sim/common/genmloop.sh,v
retrieving revision 1.5
diff -c -3 -p -r1.5 genmloop.sh
*** sim/common/genmloop.sh	1 Jan 2008 22:53:23 -0000	1.5
--- sim/common/genmloop.sh	24 Jul 2008 07:33:07 -0000
***************
*** 118,123 ****
--- 118,127 ----
  #
  #	Specify the suffix to append to output files.
  #
+ # -shell <shell>
+ #
+ #	Specify the shell to use to execute <input-file>
+ #
  # Only one of -scache/-pbb may be selected.
  # -simple is the default.
  #
*************** do
*** 160,165 ****
--- 164,170 ----
  	-switch) shift ; switch=$1 ;;
  	-cpu) shift ; cpu=$1 ;;
  	-infile) shift ; infile=$1 ;;
+ 	-shell) shift ; SHELL=$1 ;;
  	*) echo "unknown option: $1" >&2 ; exit 1 ;;
  	esac
  	shift
Index: sim/cris/Makefile.in
===================================================================
RCS file: /cvs/src/src/sim/cris/Makefile.in,v
retrieving revision 1.8
diff -c -3 -p -r1.8 Makefile.in
*** sim/cris/Makefile.in	1 Jan 2008 22:53:23 -0000	1.8
--- sim/cris/Makefile.in	24 Jul 2008 07:33:07 -0000
*************** crisv10f.o: crisv10f.c cris-tmpl.c $(CRI
*** 95,101 ****
  # than the apparent; some "mono" feature is work in progress)?
  mloopv10f.c engv10.h: stamp-v10fmloop
  stamp-v10fmloop: $(srcdir)/../common/genmloop.sh mloop.in Makefile
! 	$(SHELL) $(srccom)/genmloop.sh \
  		-mono -no-fast -pbb -switch semcrisv10f-switch.c \
  		-cpu crisv10f -infile $(srcdir)/mloop.in
  	$(SHELL) $(srcroot)/move-if-change eng.hin engv10.h
--- 95,101 ----
  # than the apparent; some "mono" feature is work in progress)?
  mloopv10f.c engv10.h: stamp-v10fmloop
  stamp-v10fmloop: $(srcdir)/../common/genmloop.sh mloop.in Makefile
! 	$(SHELL) $(srccom)/genmloop.sh -shell $(SHELL) \
  		-mono -no-fast -pbb -switch semcrisv10f-switch.c \
  		-cpu crisv10f -infile $(srcdir)/mloop.in
  	$(SHELL) $(srcroot)/move-if-change eng.hin engv10.h
*************** mloopv32f.c engv32.h: stamp-v32fmloop
*** 121,127 ****
  # We depend on stamp-v10fmloop to get serialization to avoid
  # racing with it for the same temporary file-names when "make -j".
  stamp-v32fmloop: stamp-v10fmloop $(srcdir)/../common/genmloop.sh mloop.in Makefile
! 	$(SHELL) $(srccom)/genmloop.sh \
  		-mono -no-fast -pbb -switch semcrisv32f-switch.c \
  		-cpu crisv32f -infile $(srcdir)/mloop.in
  	$(SHELL) $(srcroot)/move-if-change eng.hin engv32.h
--- 121,127 ----
  # We depend on stamp-v10fmloop to get serialization to avoid
  # racing with it for the same temporary file-names when "make -j".
  stamp-v32fmloop: stamp-v10fmloop $(srcdir)/../common/genmloop.sh mloop.in Makefile
! 	$(SHELL) $(srccom)/genmloop.sh -shell $(SHELL) \
  		-mono -no-fast -pbb -switch semcrisv32f-switch.c \
  		-cpu crisv32f -infile $(srcdir)/mloop.in
  	$(SHELL) $(srcroot)/move-if-change eng.hin engv32.h
Index: sim/frv/Makefile.in
===================================================================
RCS file: /cvs/src/src/sim/frv/Makefile.in,v
retrieving revision 1.7
diff -c -3 -p -r1.7 Makefile.in
*** sim/frv/Makefile.in	1 Jan 2008 22:53:24 -0000	1.7
--- sim/frv/Makefile.in	24 Jul 2008 07:33:07 -0000
*************** sim-if.o: sim-if.c $(FRVBF_INCLUDE_DEPS)
*** 89,95 ****
  # FIXME: Use of `mono' is wip.
  mloop.c eng.h: stamp-mloop
  stamp-mloop: $(srcdir)/../common/genmloop.sh mloop.in Makefile
! 	$(SHELL) $(srccom)/genmloop.sh \
  		-mono -scache -parallel-generic-write -parallel-only \
  		-cpu frvbf -infile $(srcdir)/mloop.in
  	$(SHELL) $(srcroot)/move-if-change eng.hin eng.h
--- 89,95 ----
  # FIXME: Use of `mono' is wip.
  mloop.c eng.h: stamp-mloop
  stamp-mloop: $(srcdir)/../common/genmloop.sh mloop.in Makefile
! 	$(SHELL) $(srccom)/genmloop.sh -shell $(SHELL) \
  		-mono -scache -parallel-generic-write -parallel-only \
  		-cpu frvbf -infile $(srcdir)/mloop.in
  	$(SHELL) $(srcroot)/move-if-change eng.hin eng.h
Index: sim/frv/mloop.in
===================================================================
RCS file: /cvs/src/src/sim/frv/mloop.in,v
retrieving revision 1.7
diff -c -3 -p -r1.7 mloop.in
*** sim/frv/mloop.in	1 Jan 2008 22:53:24 -0000	1.7
--- sim/frv/mloop.in	24 Jul 2008 07:33:08 -0000
***************
*** 1,6 ****
  # Simulator main loop for frv. -*- C -*-
  # Copyright (C) 1998, 1999, 2000, 2001, 2003, 2007, 2008
!   Free Software Foundation, Inc.
  # Contributed by Red Hat.
  #
  # This file is part of the GNU Simulators.
--- 1,6 ----
  # Simulator main loop for frv. -*- C -*-
  # Copyright (C) 1998, 1999, 2000, 2001, 2003, 2007, 2008
! #  Free Software Foundation, Inc.
  # Contributed by Red Hat.
  #
  # This file is part of the GNU Simulators.
Index: sim/iq2000/Makefile.in
===================================================================
RCS file: /cvs/src/src/sim/iq2000/Makefile.in,v
retrieving revision 1.4
diff -c -3 -p -r1.4 Makefile.in
*** sim/iq2000/Makefile.in	1 Jan 2008 22:53:24 -0000	1.4
--- sim/iq2000/Makefile.in	24 Jul 2008 07:33:08 -0000
*************** iq2000.o: $(srcdir)/iq2000.c $(IQ2000BF_
*** 69,75 ****
  # FIXME: Use of `mono' is wip.
  mloop.c eng.h: stamp-mloop
  stamp-mloop: $(srcdir)/../common/genmloop.sh mloop.in Makefile
! 	$(SHELL) $(srccom)/genmloop.sh \
  		-mono -fast -pbb -switch sem-switch.c \
  		-cpu iq2000bf -infile $(srcdir)/mloop.in
  	$(SHELL) $(srcroot)/move-if-change eng.hin eng.h
--- 69,75 ----
  # FIXME: Use of `mono' is wip.
  mloop.c eng.h: stamp-mloop
  stamp-mloop: $(srcdir)/../common/genmloop.sh mloop.in Makefile
! 	$(SHELL) $(srccom)/genmloop.sh -shell $(SHELL) \
  		-mono -fast -pbb -switch sem-switch.c \
  		-cpu iq2000bf -infile $(srcdir)/mloop.in
  	$(SHELL) $(srcroot)/move-if-change eng.hin eng.h
Index: sim/m32r/Makefile.in
===================================================================
RCS file: /cvs/src/src/sim/m32r/Makefile.in,v
retrieving revision 1.14
diff -c -3 -p -r1.14 Makefile.in
*** sim/m32r/Makefile.in	1 Jan 2008 22:53:25 -0000	1.14
--- sim/m32r/Makefile.in	24 Jul 2008 07:33:08 -0000
*************** m32r.o: m32r.c $(M32RBF_INCLUDE_DEPS)
*** 81,87 ****
  # FIXME: Use of `mono' is wip.
  mloop.c eng.h: stamp-mloop
  stamp-mloop: $(srcdir)/../common/genmloop.sh mloop.in Makefile
! 	$(SHELL) $(srccom)/genmloop.sh \
  		-mono -fast -pbb -switch sem-switch.c \
  		-cpu m32rbf -infile $(srcdir)/mloop.in
  	$(SHELL) $(srcroot)/move-if-change eng.hin eng.h
--- 81,87 ----
  # FIXME: Use of `mono' is wip.
  mloop.c eng.h: stamp-mloop
  stamp-mloop: $(srcdir)/../common/genmloop.sh mloop.in Makefile
! 	$(SHELL) $(srccom)/genmloop.sh -shell $(SHELL) \
  		-mono -fast -pbb -switch sem-switch.c \
  		-cpu m32rbf -infile $(srcdir)/mloop.in
  	$(SHELL) $(srcroot)/move-if-change eng.hin eng.h
*************** m32rx.o: m32rx.c $(M32RXF_INCLUDE_DEPS)
*** 105,111 ****
  # FIXME: Use of `mono' is wip.
  mloopx.c engx.h: stamp-xmloop
  stamp-xmloop: $(srcdir)/../common/genmloop.sh mloopx.in Makefile
! 	$(SHELL) $(srccom)/genmloop.sh \
  		-mono -no-fast -pbb -parallel-write -switch semx-switch.c \
  		-cpu m32rxf -infile $(srcdir)/mloopx.in \
  		-outfile-suffix x
--- 105,111 ----
  # FIXME: Use of `mono' is wip.
  mloopx.c engx.h: stamp-xmloop
  stamp-xmloop: $(srcdir)/../common/genmloop.sh mloopx.in Makefile
! 	$(SHELL) $(srccom)/genmloop.sh -shell $(SHELL) \
  		-mono -no-fast -pbb -parallel-write -switch semx-switch.c \
  		-cpu m32rxf -infile $(srcdir)/mloopx.in \
  		-outfile-suffix x
*************** m32r2.o: m32r2.c $(M32R2F_INCLUDE_DEPS)
*** 130,136 ****
  # FIXME: Use of `mono' is wip.
  mloop2.c eng2.h: stamp-2mloop
  stamp-2mloop: $(srcdir)/../common/genmloop.sh mloop2.in Makefile
! 	$(SHELL) $(srccom)/genmloop.sh \
  		-mono -no-fast -pbb -parallel-write -switch sem2-switch.c \
  		-cpu m32r2f -infile $(srcdir)/mloop2.in \
  		-outfile-suffix 2
--- 130,136 ----
  # FIXME: Use of `mono' is wip.
  mloop2.c eng2.h: stamp-2mloop
  stamp-2mloop: $(srcdir)/../common/genmloop.sh mloop2.in Makefile
! 	$(SHELL) $(srccom)/genmloop.sh -shell $(SHELL) \
  		-mono -no-fast -pbb -parallel-write -switch sem2-switch.c \
  		-cpu m32r2f -infile $(srcdir)/mloop2.in \
  		-outfile-suffix 2

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: RFA: Fix the shell used to execute mloop.in
  2008-07-24  7:46 RFA: Fix the shell used to execute mloop.in Nick Clifton
@ 2008-07-24 10:15 ` Frank Ch. Eigler
  2008-07-24 10:20   ` Nick Clifton
  0 siblings, 1 reply; 8+ messages in thread
From: Frank Ch. Eigler @ 2008-07-24 10:15 UTC (permalink / raw)
  To: Nick Clifton; +Cc: gdb-patches, brolley, bje, cgen

Hi -

On Thu, Jul 24, 2008 at 08:46:04AM +0100, Nick Clifton wrote:

> [...]  So anyway I am proposing the patch below as a solution.  It
> adds a new optional parameter to the genmloop.sh script which
> specifies the shell to use when invoking the target input
> file. [...]

Is there some reason you can't just hard-code SHELL=/bin/sh in
genmloop.sh?


- FChE

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: RFA: Fix the shell used to execute mloop.in
  2008-07-24 10:15 ` Frank Ch. Eigler
@ 2008-07-24 10:20   ` Nick Clifton
  2008-07-24 14:44     ` Frank Ch. Eigler
  0 siblings, 1 reply; 8+ messages in thread
From: Nick Clifton @ 2008-07-24 10:20 UTC (permalink / raw)
  To: Frank Ch. Eigler; +Cc: gdb-patches, brolley, bje, cgen

Hi Frank,

> Is there some reason you can't just hard-code SHELL=/bin/sh in
> genmloop.sh?

Because /bin/sh is not the appropriate shell to use on some systems.  (I 
know for example than on some Solaris machines using /bin/zsh is better).

Cheers
   Nick


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: RFA: Fix the shell used to execute mloop.in
  2008-07-24 10:20   ` Nick Clifton
@ 2008-07-24 14:44     ` Frank Ch. Eigler
  2008-07-24 15:14       ` Nick Clifton
  0 siblings, 1 reply; 8+ messages in thread
From: Frank Ch. Eigler @ 2008-07-24 14:44 UTC (permalink / raw)
  To: Nick Clifton; +Cc: gdb-patches, brolley, bje, cgen

> >Is there some reason you can't just hard-code SHELL=/bin/sh in
> >genmloop.sh?
> 
> Because /bin/sh is not the appropriate shell to use on some systems.  (I 
> know for example than on some Solaris machines using /bin/zsh is better).

If the associated shell script not compatible with the unix standard
/bin/sh, perhaps that needs to be fixed.

- FChE

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: RFA: Fix the shell used to execute mloop.in
  2008-07-24 14:44     ` Frank Ch. Eigler
@ 2008-07-24 15:14       ` Nick Clifton
  2008-07-26 19:32         ` Frank Ch. Eigler
  0 siblings, 1 reply; 8+ messages in thread
From: Nick Clifton @ 2008-07-24 15:14 UTC (permalink / raw)
  To: Frank Ch. Eigler; +Cc: gdb-patches, brolley, bje, cgen

Hi Frank,

>>> Is there some reason you can't just hard-code SHELL=/bin/sh in
>>> genmloop.sh?
>> Because /bin/sh is not the appropriate shell to use on some systems.  (I 
>> know for example than on some Solaris machines using /bin/zsh is better).
> 
> If the associated shell script not compatible with the unix standard
> /bin/sh, perhaps that needs to be fixed.

Oh no, the script is compatible with /bin/sh.  It is just that (if I 
remember correctly) on some earlier versions of Solaris /bin/sh is 
broken and you need to use /bin/zsh instead.

Cheers
   Nick


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: RFA: Fix the shell used to execute mloop.in
  2008-07-24 15:14       ` Nick Clifton
@ 2008-07-26 19:32         ` Frank Ch. Eigler
  2008-07-29 11:50           ` Nick Clifton
  0 siblings, 1 reply; 8+ messages in thread
From: Frank Ch. Eigler @ 2008-07-26 19:32 UTC (permalink / raw)
  To: Nick Clifton; +Cc: gdb-patches, brolley, bje, cgen

Nick Clifton <nickc@redhat.com> writes:

> Oh no, the script is compatible with /bin/sh.  It is just that (if I
> remember correctly) on some earlier versions of Solaris /bin/sh is
> broken and you need to use /bin/zsh instead.

It would be helpful if you could find some information on this; if
it's only a rumour, or if it only applies to a fifteen-year-old
operating system, maybe it's not worth worrying about it.

- FChE

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: RFA: Fix the shell used to execute mloop.in
  2008-07-26 19:32         ` Frank Ch. Eigler
@ 2008-07-29 11:50           ` Nick Clifton
  2008-07-29 12:57             ` Frank Ch. Eigler
  0 siblings, 1 reply; 8+ messages in thread
From: Nick Clifton @ 2008-07-29 11:50 UTC (permalink / raw)
  To: Frank Ch. Eigler; +Cc: gdb-patches, brolley, bje, cgen

Hi Frank,

>> Oh no, the script is compatible with /bin/sh.  It is just that (if I
>> remember correctly) on some earlier versions of Solaris /bin/sh is
>> broken and you need to use /bin/zsh instead.

I was mistaken - I should have said /bin/ksh not /bin/zsh.

> It would be helpful if you could find some information on this; if
> it's only a rumour, or if it only applies to a fifteen-year-old
> operating system, maybe it's not worth worrying about it.

There are some limitations of various shells mentioned here:

http://www.gnu.org/software/libtool/manual/autoconf/Limitations-of-Builtins.html

Essentially though I think that the correct thing to do is to allow the 
user the choice of which shell they are going to use to execute scripts, 
precisely because of the possibility of bugs in the "standard" shell 
they might exist on their host machine.

Cheers
   Nick

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: RFA: Fix the shell used to execute mloop.in
  2008-07-29 11:50           ` Nick Clifton
@ 2008-07-29 12:57             ` Frank Ch. Eigler
  0 siblings, 0 replies; 8+ messages in thread
From: Frank Ch. Eigler @ 2008-07-29 12:57 UTC (permalink / raw)
  To: Nick Clifton; +Cc: gdb-patches, brolley, bje, cgen

Hi -

> [...]  Essentially though I think that the correct thing to do is to
> allow the user the choice of which shell they are going to use to
> execute scripts, precisely because of the possibility of bugs in the
> "standard" shell they might exist on their host machine.

OK, thanks.  If this is the best way of doing that (e.g., better than
environment variables), please go ahead.

- FChE

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-07-29 12:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-24  7:46 RFA: Fix the shell used to execute mloop.in Nick Clifton
2008-07-24 10:15 ` Frank Ch. Eigler
2008-07-24 10:20   ` Nick Clifton
2008-07-24 14:44     ` Frank Ch. Eigler
2008-07-24 15:14       ` Nick Clifton
2008-07-26 19:32         ` Frank Ch. Eigler
2008-07-29 11:50           ` Nick Clifton
2008-07-29 12:57             ` Frank Ch. Eigler

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).