Fix sim/cris MAXPATHLEN breakage. Heads-up re configury in sim
Hans-Peter Nilsson
hans-peter.nilsson@axis.com
Fri Sep 29 02:52:00 GMT 2006
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
More information about the Gdb-patches
mailing list