Fix sim/cris MAXPATHLEN breakage. Heads-up re configury in sim

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Fix sim/cris MAXPATHLEN breakage. Heads-up re configury in sim

Hans-Peter Nilsson
First three heads-ups.

1. The "utility" in sim/Makefile.in is a bit broken (and
autoheader-common missing from .PHONY):

# Utility to run autoconf in each directory that uses the common framework.
# This is intended to be invoked in $srcdir as
# "make -f Makefile.in autoconf-common".

but:

make -f Makefile.in autoconf-common
for d in * ; \
do \
   (stuff elided)
done
make: @SHELL@: Command not found
make: *** [autoconf-common] Error 127

Ho hum, $(SHELL) is used internally by GNU make IIRC.
Perhaps the best fix is just to suggest:
# "make -f Makefile.in autoconf-common SHELL=/bin/sh".
I used "make -f $(OBJDIR)/sim/Makefile autoconf-common"
instead, which works once you've configured.

2. An autoconf/autoheader 2.59 run over sim reveals

sim/{arm,common,d10v,erc32,h8300,igen,iq2000,m32r,mips,mn10300,ppc,sh,v850}
/configure.ac (or whatever) emitting warnings like this:
Running autoheader in arm ...
autoheader: WARNING: Using auxiliary files such as `acconfig.h', `config.h.bot'
autoheader: WARNING: and `config.h.top', to define templates for `config.h.in'
autoheader: WARNING: is deprecated and discouraged.
autoheader:
autoheader: WARNING: Using the third argument of `AC_DEFINE' and
autoheader: WARNING: `AC_DEFINE_UNQUOTED' allows to define a template without
autoheader: WARNING: `acconfig.h':
autoheader:
autoheader: WARNING:   AC_DEFINE([NEED_FUNC_MAIN], 1,
autoheader:             [Define if a function `main' is needed.])
autoheader:
autoheader: WARNING: More sophisticated templates can also be produced, see the
autoheader: WARNING: documentation.
and:
Running autoheader in testsuite ...
autoheader: error: AC_CONFIG_HEADERS not found in configure.ac

so I guess something needing tweaking.  Not exactly sure about
what. :) Maybe just never to run autoheader, at least not over
all directories like suggested in sim/Makefile.in. :)

3. A cvs diff shows that the files
sim/{arm,common,d10v,erc32,frv,h8300,igen,iq2000,m32r,m68hc11,mcore,
mips,mn10300,ppc,sh,sh64,v850}/config.in need regenerating as
well as sim/{mips,sh64}/configure.  Well ok, sim/cris/config.in
too, but it was just empty and fixed now anyway.

Trying to build a baseline for a patch, it seems something has
happened in configury since I last built sim/cris, revealing
this breakage on FC 4 x86_64:

...
gcc -c -DHAVE_CONFIG_H   -DWITH_DEFAULT_MODEL='"crisv32"'  -DPROFILE=1 -DWITH_PROFILE=-1   -DWITH_ALIGNMENT=NONSTRICT_ALIGNMENT   -DWITH_ENVIRONMENT=ALL_ENVIRONMENT  -DWITH_HW=0 -DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN     -DWITH_SCACHE=16384   -Wimplicit -Wreturn-type -Wcomment -Wtrigraphs -Wformat -Wparentheses -Wpointer-arith -Wuninitialized       -I. -I/SRC/DIR/src/sim/cris -I../common -I/SRC/DIR/src/sim/cris/../common -I../../include -I/SRC/DIR/src/sim/cris/../../include -I../../bfd -I/SRC/DIR/src/sim/cris/../../bfd -I../../opcodes -I/SRC/DIR/src/sim/cris/../../opcodes  -g -O2 /SRC/DIR/src/sim/cris/traps.c
(warnings elided)
/SRC/DIR/src/sim/cris/traps.c: In function cris_break_13_handler:
/SRC/DIR/src/sim/cris/traps.c:2416: error: MAXPATHLEN undeclared (first use in this function)
/SRC/DIR/src/sim/cris/traps.c:2416: error: (Each undeclared identifier is reported only once
/SRC/DIR/src/sim/cris/traps.c:2416: error: for each function it appears in.)
make[3]: *** [traps.o] Error 1
make[3]: Leaving directory `/OBJ/DIR/sim/cris'

Looking at configury, I'm not sure how this worked before...  It
seems several header tests were actually missing from
cris/configure.ac.  Anyway, I found a fix in ld/sysdep.h.  Maybe
there should be a similar sim/sysdep.h?

Hey, why not vote for me as Authorized Committer of sim/* and
I'll (work towards) fixing all of the above, as well as running
autotesters for the sim testsuites, for applicable simulators!
(Offer valid for one month.)

With this patch, for --target=cris-axis-linux-gnu and check-sim,
I get a single:
Running /SRC/DIR/sim/testsuite/sim/cris/c/c.exp ...
FAIL: crisv10 pipe2.c (execution)

Committed.
sim:
        * cris/configure.ac: Check for limits.h and sys/param.h.
        * cris/configure, cris/config.in: Rebuild.
        * cris/traps.c (SIM_PATHMAX): New macro.
        (cris_break_13_handler): Use SIM_PATHMAX, not MAXPATHLEN.

Index: cris/configure.ac
===================================================================
RCS file: /cvs/src/src/sim/cris/configure.ac,v
retrieving revision 1.2
diff -p -u -r1.2 configure.ac
--- cris/configure.ac 3 Apr 2006 03:01:45 -0000 1.2
+++ cris/configure.ac 29 Sep 2006 02:39:30 -0000
@@ -10,7 +10,7 @@ sinclude(../common/aclocal.m4)
 sinclude(../common/common.m4)
 
 # For dv-rv and rvdummy.
-AC_CHECK_HEADERS(sys/socket.h sys/select.h)
+AC_CHECK_HEADERS(sys/socket.h sys/select.h limits.h sys/param.h)
 
 SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
 SIM_AC_OPTION_HOSTENDIAN
Index: cris/traps.c
===================================================================
RCS file: /cvs/src/src/sim/cris/traps.c,v
retrieving revision 1.7
diff -p -u -r1.7 traps.c
--- cris/traps.c 23 Feb 2006 02:01:51 -0000 1.7
+++ cris/traps.c 29 Sep 2006 02:39:32 -0000
@@ -38,6 +38,21 @@ with this program; if not, write to the
 #ifdef HAVE_SYS_STAT_H
 #include <sys/stat.h>
 #endif
+/* For PATH_MAX, originally. */
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
+/* From ld/sysdep.h.  */
+#ifdef PATH_MAX
+# define SIM_PATHMAX PATH_MAX
+#else
+# ifdef MAXPATHLEN
+#  define SIM_PATHMAX MAXPATHLEN
+# else
+#  define SIM_PATHMAX 1024
+# endif
+#endif
 
 /* The verbatim values are from asm-cris/unistd.h.  */
 
@@ -2413,8 +2428,8 @@ cris_break_13_handler (SIM_CPU *current_
     USI buf = arg1;
     USI size = arg2;
 
-    char *cwd = xmalloc (MAXPATHLEN);
-    if (cwd != getcwd (cwd, MAXPATHLEN))
+    char *cwd = xmalloc (SIM_PATHMAX);
+    if (cwd != getcwd (cwd, SIM_PATHMAX))
       abort ();
 
     /* FIXME: When and if we support chdir, we need something
@@ -2440,8 +2455,8 @@ cris_break_13_handler (SIM_CPU *current_
     SI path = arg1;
     SI buf = arg2;
     SI bufsiz = arg3;
-    char *pbuf = xmalloc (MAXPATHLEN);
-    char *lbuf = xmalloc (MAXPATHLEN);
+    char *pbuf = xmalloc (SIM_PATHMAX);
+    char *lbuf = xmalloc (SIM_PATHMAX);
     char *lbuf_alloc = lbuf;
     int nchars = -1;
     int i;
@@ -2453,7 +2468,7 @@ cris_break_13_handler (SIM_CPU *current_
  o += strlen (simulator_sysroot);
       }
 
-    for (i = 0; i + o < MAXPATHLEN; i++)
+    for (i = 0; i + o < SIM_PATHMAX; i++)
       {
  pbuf[i + o]
   = sim_core_read_unaligned_1 (current_cpu, pc, 0, path + i);
@@ -2461,7 +2476,7 @@ cris_break_13_handler (SIM_CPU *current_
   break;
       }
 
-    if (i + o == MAXPATHLEN)
+    if (i + o == SIM_PATHMAX)
       {
  retval = -cb_host_to_target_errno (cb, ENAMETOOLONG);
  break;
@@ -2497,8 +2512,8 @@ cris_break_13_handler (SIM_CPU *current_
   }
  else
   {
-    if (getcwd (lbuf, MAXPATHLEN) != NULL
- && strlen (lbuf) + 2 + strlen (argv0) < MAXPATHLEN)
+    if (getcwd (lbuf, SIM_PATHMAX) != NULL
+ && strlen (lbuf) + 2 + strlen (argv0) < SIM_PATHMAX)
       {
  if (strncmp (simulator_sysroot, lbuf,
      strlen (simulator_sysroot)) == 0)
@@ -2513,7 +2528,7 @@ cris_break_13_handler (SIM_CPU *current_
   }
       }
     else
-      nchars = readlink (pbuf, lbuf, MAXPATHLEN);
+      nchars = readlink (pbuf, lbuf, SIM_PATHMAX);
 
     /* We trust that the readlink result returns a *relative*
        link, or one already adjusted for the file-path-prefix.

brgds, H-P
Reply | Threaded
Open this post in threaded view
|

Re: Fix sim/cris MAXPATHLEN breakage. Heads-up re configury in sim

Daniel Jacobowitz-2
On Fri, Sep 29, 2006 at 04:52:23AM +0200, Hans-Peter Nilsson wrote:
> Hey, why not vote for me as Authorized Committer of sim/* and
> I'll (work towards) fixing all of the above, as well as running
> autotesters for the sim testsuites, for applicable simulators!
> (Offer valid for one month.)

Seems sensible.  I'll suggest it to the global maintainers.

--
Daniel Jacobowitz
CodeSourcery
Reply | Threaded
Open this post in threaded view
|

Re: Fix sim/cris MAXPATHLEN breakage. Heads-up re configury in sim

Daniel Jacobowitz-2
On Thu, Sep 28, 2006 at 11:51:30PM -0400, Daniel Jacobowitz wrote:
> On Fri, Sep 29, 2006 at 04:52:23AM +0200, Hans-Peter Nilsson wrote:
> > Hey, why not vote for me as Authorized Committer of sim/* and
> > I'll (work towards) fixing all of the above, as well as running
> > autotesters for the sim testsuites, for applicable simulators!
> > (Offer valid for one month.)
>
> Seems sensible.  I'll suggest it to the global maintainers.

There were no objections, unsurprisingly; Hans-Peter, feel free
to add an appropriate entry to sim/MAINTAINERS, and thanks for
sticking your neck out.

--
Daniel Jacobowitz
CodeSourcery
Reply | Threaded
Open this post in threaded view
|

Re: Fix sim/cris MAXPATHLEN breakage. Heads-up re configury in sim

Hans-Peter Nilsson
> Date: Sun, 15 Oct 2006 18:22:40 -0400
> From: Daniel Jacobowitz <[hidden email]>

> On Thu, Sep 28, 2006 at 11:51:30PM -0400, Daniel Jacobowitz wrote:
> > On Fri, Sep 29, 2006 at 04:52:23AM +0200, Hans-Peter Nilsson wrote:
> > > Hey, why not vote for me as Authorized Committer of sim/* and
> > > I'll (work towards) fixing all of the above, as well as running
> > > autotesters for the sim testsuites, for applicable simulators!
> > > (Offer valid for one month.)
> >
> > Seems sensible.  I'll suggest it to the global maintainers.
>
> There were no objections, unsurprisingly; Hans-Peter, feel free
> to add an appropriate entry to sim/MAINTAINERS, and thanks for
> sticking your neck out.

Thanks and sorry for the delay.  Now, nitpickingly, "*" isn't a
"particular sim", but there seemed to be predecence to use that
in the "Maintainers for particular sims" list.

FWIW, my sim autobuilder (not -tester yet; need to add framework
to export recent working binutils from my binutils autotester),
reveals build failures for erc32 (sparc-elf), d10v-elf and
w65-elf.  The failures seem to be framework-related, so I hope
to fix them.

Happy Holidays.

        * Makefile.in (autoconf-common autoheader-common): In documented
        usage, say SHELL=/bin/sh.
        (.PHONY): Add autoheader-common.

        * MAINTAINERS: Add self as authorized committer for *.

Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/sim/Makefile.in,v
retrieving revision 1.8
diff -p -u -r1.8 Makefile.in
--- Makefile.in 8 Aug 2006 18:57:25 -0000 1.8
+++ Makefile.in 20 Dec 2006 12:32:49 -0000
@@ -207,8 +207,8 @@ config.status: configure
 
 # Utility to run autoconf in each directory that uses the common framework.
 # This is intended to be invoked in $srcdir as
-# "make -f Makefile.in autoconf-common".
-.PHONY: autoconf-common
+# "make -f Makefile.in autoconf-common SHELL=/bin/sh".
+.PHONY: autoconf-common autoheader-common
 autoconf-common autoheader-common:
  for d in * ; \
  do \
Index: MAINTAINERS
===================================================================
RCS file: /cvs/src/src/sim/MAINTAINERS,v
retrieving revision 1.20
diff -p -u -r1.20 MAINTAINERS
--- MAINTAINERS 1 Oct 2006 04:00:30 -0000 1.20
+++ MAINTAINERS 20 Dec 2006 12:32:49 -0000
@@ -24,6 +24,7 @@ common Frank Ch. Eigler <[hidden email]
 
  Authorized committers for particular sims:
 v850 DJ Delorie <[hidden email]>
+* Hans-Peter Nilsson <[hidden email]>
 
  Past sim maintainers:
 

brgds, H-P
Reply | Threaded
Open this post in threaded view
|

Committed, sim: fixes for most minor maintainer issues I raised in September

Hans-Peter Nilsson
In reply to this post by Hans-Peter Nilsson
> Date: Fri, 29 Sep 2006 04:52:23 +0200
> From: Hans-Peter Nilsson <[hidden email]>

> 2. An autoconf/autoheader 2.59 run over sim reveals
>
> sim/{arm,common,d10v,erc32,h8300,igen,iq2000,m32r,mips,mn10300,ppc,sh,v850}
> /configure.ac (or whatever) emitting warnings like this:
> Running autoheader in arm ...
> autoheader: WARNING: Using auxiliary files such as `acconfig.h', `config.h.bot'
> autoheader: WARNING: and `config.h.top', to define templates for `config.h.in'
> autoheader: WARNING: is deprecated and discouraged.

Fixed by removing the stale acconfig.h from those directories.
Pertinent ChangeLogs all similar:

sim/*:
        * acconfig.h: Remove.

> and:
> Running autoheader in testsuite ...
> autoheader: error: AC_CONFIG_HEADERS not found in configure.ac

Fixed by requiring config.in in autoheader'd subdirs:

sim:
        * Makefile.in (autoconf-common autoheader-common): Only run
        autoheader on subdirs with a file config.in.

Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/sim/Makefile.in,v
retrieving revision 1.9
retrieving revision 1.10
diff -p -u -r1.9 -r1.10
--- Makefile.in 20 Dec 2006 12:35:07 -0000 1.9
+++ Makefile.in 21 Dec 2006 04:46:52 -0000 1.10
@@ -216,7 +216,7 @@ autoconf-common autoheader-common:
     then \
  echo "Running autoconf in $$d ..." ; \
  (cd $$d && autoconf --force) ; \
- if [ $@ = autoheader-common ] ; \
+ if [ $@ = autoheader-common ] && [ -f $$d/config.in ] ; \
  then \
    echo "Running autoheader in $$d ..." ; \
    (cd $$d && autoheader --force) ; \


> 3. A cvs diff shows that the files
> sim/{arm,common,d10v,erc32,frv,h8300,igen,iq2000,m32r,m68hc11,mcore,
> mips,mn10300,ppc,sh,sh64,v850}/config.in need regenerating as
> well as sim/{mips,sh64}/configure.  Well ok, sim/cris/config.in
> too, but it was just empty and fixed now anyway.

Done.  Pertinent ChangeLogs all similar:

sim/*:
        * config.in: Regenerate.

and for sh64 and mips also:

sim/{mips,sh64}:

        * configure: Regenerate.

Tested by rebuilding the sims.

brgds, H-P