This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Committed: update simulated Linux for sim/cris


Update from 2.4.5 to 2.6.27, so I don't get a "FATAL: kernel too
old" for all programs linked with a newer glibc, which require a
kernel this new for TLS support (upcoming patch).  And, of
course the date would be humorous but unpossible or at least
imcorrect, so better fix that.  And, the machine type wasn't set
correctly.  (And, a TODO: pass the kernel version some better
way than parsing uname.)

Committed.  (And fixing a nit in the previous ChangeLog format.)

sim/testsuite:
	* sim/cris/c/uname1.c: New test.

sim:
	* cris/traps.c (TARGET_UTSNAME): Update to 2009-01-01.
	(TARGET_EPOCH): Update to match TARGET_UTSNAME.  Correct comment.
	(cris_break_13_handler) <case TARGET_SYS_uname>: Update to
	2.6.27.  Set machine field to the BFD printable name of the
	machine.

Index: sim/cris/c/uname1.c
===================================================================
RCS file: sim/cris/c/uname1.c
diff -N sim/cris/c/uname1.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ sim/cris/c/uname1.c	3 Jan 2009 19:52:40 -0000
@@ -0,0 +1,21 @@
+/* Check that the right machine name appears in the uname result.
+#notarget: *-*-elf
+*/
+#include <sys/utsname.h>
+#include <stdio.h>
+#include <stdlib.h>
+int main (void)
+{
+  struct utsname buf;
+  if (uname (&buf) != 0
+      || strcmp (buf.machine,
+#ifdef __arch_v32
+		 "crisv32"
+#else
+		 "cris"
+#endif
+		 ) != 0)
+    abort ();
+  printf ("pass\n");
+  exit (0);
+}

Index: cris/traps.c
===================================================================
RCS file: /cvs/src/src/sim/cris/traps.c,v
retrieving revision 1.17
diff -p -u -r1.17 traps.c
--- cris/traps.c	3 Jan 2009 19:21:42 -0000	1.17
+++ cris/traps.c	3 Jan 2009 19:53:55 -0000
@@ -144,10 +144,11 @@ along with this program.  If not, see <h
 
 #define TARGET_TCGETS 0x5401
 
-#define TARGET_UTSNAME "#38 Sun Apr 1 00:00:00 MET 2001"
+#define TARGET_UTSNAME "#7 Thu Jan 1 00:00:00 MET 2009"
 
-/* Seconds since the above date + 10 minutes.  */
-#define TARGET_EPOCH 986080200
+/* Seconds since 1970-01-01 to the above date + 10 minutes;
+   'date -d "Thu Jan 1 00:00:10 MET 2009" +%s'.  */
+#define TARGET_EPOCH 1230764410
 
 /* Milliseconds since start of run.  We use the number of syscalls to
    avoid introducing noise in the execution time.  */
@@ -1570,16 +1571,23 @@ cris_break_13_handler (SIM_CPU *current_
 	case TARGET_SYS_uname:
 	  {
 	    /* Fill in a few constants to appease glibc.  */
-	    static const char sim_utsname[6][65] =
+	    static char sim_utsname[6][65] =
 	    {
 	      "Linux",
 	      "sim-target",
-	      "2.4.5",
+	      "2.6.27",
 	      TARGET_UTSNAME,
-	      "cris",
+	      "cris",		/* Overwritten below.  */
 	      "localdomain"
 	    };
 
+	    /* Having the hardware type in Linux equal to the bfd
+	       printable name is deliberate: if you make config.guess
+	       work on your Linux-type system the usual way, it
+	       probably will; either the bfd printable_name or the
+	       ambiguous arch_name.  */
+	    strcpy (sim_utsname[4], STATE_ARCHITECTURE (sd)->printable_name);
+
 	    if ((s.write_mem) (cb, &s, arg1, (const char *) sim_utsname,
 			       sizeof (sim_utsname))
 		!= sizeof (sim_utsname))

brgds, H-P


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]